public
Last active — forked from wbamberg/gist:1045274

some panel code example from Bamberg.

  • Download Gist
panel.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
const widgets = require("widget");
const data = require("self").data;
const panel = require("panel");
 
var panelScript = "on('message', function(message) {" +
" console.log('receiving ' + message);" +
" }); "
 
var wid = widgets.Widget({
id: "some_menu",
label: "My Widget Label",
contentURL: data.url("icon.png"),
contentScriptWhen: "ready",
panel: panel.Panel({
// onMessage: function(message) {
// console.log(message);
// },
contentScript: panelScript,
allow: true,
width: 170,
height: 250,
contentScriptWhen: "ready"
}),
onClick : function() {
console.log("sending the message");
wid.panel.postMessage("the message");
wid.panel.show();
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.