Added export-helpers page

This commit is contained in:
Will Bamberg
2017-10-10 13:41:20 -07:00
parent 49dddba366
commit 236f1b0b3a
3 changed files with 24 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
<a href="content-script-page-script-messaging.html">content script <-> page script messaging</a><br/>
<a href="export-helpers.html">export helpers</a><br/>
</body>
</html>

11
export-helpers.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="button" value="Call an exported function" id="function-notify"/>
<input type="button" value="Call a function of an exported object" id="object-notify"/>
<script src="page-scripts/export-helpers.js"></script>
</body>
</html>

View File

@@ -0,0 +1,12 @@
const button1 = document.querySelector("#function-notify");
button1.addEventListener("click", () => {
window.notify("Message from the page script!");
});
const button2 = document.querySelector("#object-notify");
button2.addEventListener("click", () => {
window.messenger.notify("Message from the page script!");
});