Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement