Created
June 7, 2023 03:38
-
-
Save trungpv1601/00c9381a4a3eec8aea7162b7402dabd6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (c) { | |
c.runtime.onMessage.addListener(async function ( | |
request, | |
sender, | |
sendResponse | |
) { | |
switch (request.type) { | |
case "EVENT_1": | |
// TODO: do something | |
break; | |
case "EVENT_2": | |
// TODO: do something | |
break; | |
default: | |
break; | |
} | |
return true; | |
}); | |
})(chrome); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.runtime.sendMessage({ | |
type: "EVENT_1", | |
data: {hey: 'EVENT_1'}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment