mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
Added export-helpers page
This commit is contained in:
@@ -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
11
export-helpers.html
Normal 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>
|
||||
12
page-scripts/export-helpers.js
Normal file
12
page-scripts/export-helpers.js
Normal 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!");
|
||||
});
|
||||
Reference in New Issue
Block a user