Skip to content

Commit

Permalink
lib/flatiron.js: Replace deprecated __defineGetter/__defineSetter__
Browse files Browse the repository at this point in the history
  • Loading branch information
Southern committed Sep 7, 2012
1 parent 3a65e39 commit 5c0dc53
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions lib/flatiron.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,31 @@ flatiron.plugins = broadway.common.mixin(
broadway.common.requireDirLazy(path.join(__dirname, 'flatiron', 'plugins'))
);

//
// ### getter @app {flatiron.App}
// Gets the default top-level Application for `flatiron`
//
flatiron.__defineGetter__('app', function () {
if (!_app) {
_app = new flatiron.App();

Object.defineProperty(flatiron, 'app', {

// Don't allow another `.defineProperty` on 'app'
configurable: false,

//
// ### getter @app {flatiron.App}
// Gets the default top-level Application for `flatiron`
//
get: function() {
return _app = _app || flatiron.createApp();
},

//
// #### setter @app {flatiron.App}
// Options for the application to create or the application to set
//
set: function(value) {
if (value instanceof flatiron.App) return _app = value;
return _app = flatiron.createApp(value);
}

return _app;
});

//
// ### setter @app {flatiron.App}
// Sets the default top-level Application for `flatiron`
//
flatiron.__defineSetter__('app', function (value) {
_app = value;
});

//
// ### function createApp (options)
Expand Down

0 comments on commit 5c0dc53

Please sign in to comment.