Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

lib/flatiron.js: Replace deprecated __defineGetter/__defineSetter__

  • Loading branch information...
commit 5c0dc5322ee7566c93d0c0205ed50bdd06c1abde 1 parent 3a65e39
@Southern Southern authored
Showing with 21 additions and 15 deletions.
  1. +21 −15 lib/flatiron.js
View
36 lib/flatiron.js
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.