Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dascgo
Created March 16, 2011 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dascgo/873329 to your computer and use it in GitHub Desktop.
Save dascgo/873329 to your computer and use it in GitHub Desktop.
// --- MAIN.JS ---
const data = require("self").data;
const panel = require("panel");
const tabs = require("tabs");
view = panel.Panel({
width: 500, height: 300,
contentURL: data.url("panel.html"),
contentScriptFile: data.url("panel.js"),
contentScriptWhen: "ready",
onMessage: function(data){
console.log("msg from panel: " + data.toSource());
}
});
tabs.on('activate', function(tab){
view.postMessage(tab.url);
});
// --- PANEL.JS ---
onMessage = function onMessage(msg){
console.log("msg from main.js: " + msg.toSource());
postMessage("thanks, we got the url: " + msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment