Skip to content

Instantly share code, notes, and snippets.

@darkowlzz
Last active August 29, 2015 14:00
Show Gist options
  • Save darkowlzz/2e3b3a9a941afc9776e2 to your computer and use it in GitHub Desktop.
Save darkowlzz/2e3b3a9a941afc9776e2 to your computer and use it in GitHub Desktop.
Snippet of BADviewPanel.js
// ViewPanel class
function ViewPanel(content, script) {
this.panel = Panel({
width: sp.prefs['width'],
height: sp.prefs['height'],
contentURL: data.url(content),
contentScriptFile: data.url(script)
});
// listeners on the prefs change
sp.on('width', function() { this.onWidthChange(); });
sp.on('height', function() { this.onHeightChange(); });
}
ViewPanel.prototype.getWidth = () {
return this.panel.width;
}
ViewPanel.prototype.getHeight = () {
return this.panel.height;
}
ViewPanel.prototype.setWidth = (width) => {
this.panel.width = width;
}
ViewPanel.prototype.setHeight = (height) => {
this.panel.height = height;
}
ViewPanel.prototype.getPanel = () => {
return this.panel;
}
ViewPanel.prototype.onWidthChange = () => {
this.panel.width = sp.prefs['width'];
}
ViewPane.prototype.onHeightChange = () => {
this.panel.height = sp.prefs['height'];
}
exports.ViewPanel = ViewPanel;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment