SHARE
TWEET

Untitled

a guest Aug 19th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // // メッセージの受信
  2. chrome.runtime.onMessage.addListener(
  3.     function(request, sender, response) {
  4.         console.log(sender.tab.id);
  5.         response({ farewell: "goodbye" });
  6.         // return 0;
  7.     });
  8.  
  9. // メッセージの送信
  10. const sendContentScript = greet => {
  11.     chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
  12.         chrome.tabs.sendMessage(tabs[0].id, { greeting: greet }, function(response) {
  13.             // console.log(response);
  14.         });
  15.     });
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top