Last active
August 29, 2015 14:00
-
-
Save darkowlzz/2e3b3a9a941afc9776e2 to your computer and use it in GitHub Desktop.
Snippet of BADviewPanel.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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