Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // // メッセージの受信
- chrome.runtime.onMessage.addListener(
- function(request, sender, response) {
- console.log(sender.tab.id);
- response({ farewell: "goodbye" });
- // return 0;
- });
- // メッセージの送信
- const sendContentScript = greet => {
- chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
- chrome.tabs.sendMessage(tabs[0].id, { greeting: greet }, function(response) {
- // console.log(response);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement