Created
July 1, 2012 10:05
-
-
Save Paratron/3027785 to your computer and use it in GitHub Desktop.
Suggestion for basic AppJS structure.
This file contains 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
//Previously, you first required appjs, then called appjs.init(), which returns an app object. We can merge that into just one step. | |
var app = require('appjs'); | |
//This is the basic way to call a window. You pass either a string with the URL of the window content, or you pass a full object, if you want to set more options. | |
var main_window = app.createWindow({ | |
url: 'http://appjs/main.html', | |
width: 640, | |
height: 480, | |
maximizable: false | |
}); | |
//Window specific events will be emitted by the window object itself, instead of the app object. | |
main_window.on('ready', function(){ | |
main_window.show(); | |
}); | |
//Main window closed - terminate the application | |
main_window.on('close', function(){ | |
app.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment