summaryrefslogtreecommitdiffstats
path: root/addon-sdk/source/test/addons/page-worker/data/page.js
blob: 04d0624979805b12193d667c207b34c19ddc762d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
window.addEventListener("load", function() {
  addon.port.emit("load", "ok");
});

addon.postMessage("first message");
addon.on("message", function(msg) {
  if (msg == "ping")
    addon.postMessage("pong");
});

addon.port.on("ping", function() {
  addon.port.emit("pong");
});