Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #165 from DanBUK/expose_appsettings

add createApp as function to allow AppSettings paramteters to be passed.
  • Loading branch information...
commit 497f871c5ddcb45e60112ff38246c2298485b8cc 2 parents 376246a + 3b6c537
Brandon Benvie Benvie authored
2  README.md
View
@@ -38,7 +38,7 @@ Help us gain traction by [starring this chromium issue](http://code.google.com/p
## One Minute Usage Overview
```javascript
-var app = module.exports = require('appjs');
+var app = module.exports = require('appjs').init();
app.serveFilesFrom(__dirname + '/content');
2  examples/hello-world/app.js
View
@@ -1,4 +1,4 @@
-var app = module.exports = require('appjs');
+var app = module.exports = require('appjs').init();
app.serveFilesFrom(__dirname + '/content');
2  examples/octosocial/index.js
View
@@ -1,4 +1,4 @@
-var app = require('appjs'),
+var app = require('appjs').init(),
github = new (require('github'))({ version: '3.0.0' }),
KEY_F12 = process.platform === 'darwin' ? 63247 : 123;
41 lib/index.js
View
@@ -11,7 +11,7 @@ var Router = require('./router').Router,
WindowSettings = require('./settings').WindowSettings,
AppSettings = require('./settings').AppSettings;
-var init = require('./bindings').init,
+var cefinit = require('./bindings').init,
decorate = require('./utils').decorate,
isObject = require('./utils').isObject,
staticRouter = require('./router').staticRouter;
@@ -84,21 +84,28 @@ decorate(App.prototype, [
}
]);
-
-var app = init(new AppSettings);
-
-decorate(app, {
- screenWidth: App.screenWidth,
- screenHeight: App.screenHeight,
- windows: {},
- router: new Router(app)
-});
-
-app.on('exit',function(){
- app.exit();
- process.nextTick(function(){
- process.kill(process.pid);
+var init = function init (cef_opts) {
+ var settings = {};
+ if (isObject(cef_opts)) {
+ for(var k in cef_opts) {
+ settings[k] = cef_opts[k];
+ }
+ }
+ var app_settings = new AppSettings(settings);
+ var app = cefinit(app_settings);
+ decorate(app, {
+ screenWidth: App.screenWidth,
+ screenHeight: App.screenHeight,
+ windows: {},
+ router: new Router(app)
+ });
+ app.on('exit',function(){
+ app.exit();
+ process.nextTick(function(){
+ process.kill(process.pid);
+ });
});
-});
+ return app;
+}
-module.exports = app;
+module.exports.init = init;
Please sign in to comment.
Something went wrong with that request. Please try again.