[Pkg-javascript-commits] [backbone] 08/34: Slightly shallower namespaced export for CommonJS.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.2
in repository backbone.

commit 7c901e2245f26f8c14bfe35df7ca333ae6874f02
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Thu Oct 14 13:15:25 2010 -0400

    Slightly shallower namespaced export for CommonJS.
---
 backbone.js | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/backbone.js b/backbone.js
index cb407ea..4d1a6c4 100644
--- a/backbone.js
+++ b/backbone.js
@@ -8,21 +8,24 @@
   // Initial Setup
   // -------------
 
-  // The top-level namespace.
-  var Backbone = {};
-
-  // Keep the version here in sync with `package.json`.
+  // The top-level namespace. All public Backbone classes and modules will
+  // be attached to this. Exported for both CommonJS and the browser.
+  var Backbone;
+  if (typeof exports !== 'undefined') {
+    Backbone = exports;
+  } else {
+    Backbone = this.Backbone = {};
+  }
+
+  // Current version of the library. Keep in sync with `package.json`.
   Backbone.VERSION = '0.1.1';
 
-  // Export for both CommonJS and the browser.
-  (typeof exports !== 'undefined' ? exports : this).Backbone = Backbone;
-
   // Require Underscore, if we're on the server, and it's not already present.
   var _ = this._;
   if (!_ && (typeof require !== 'undefined')) _ = require("underscore")._;
 
   // For Backbone's purposes, jQuery owns the `$` variable.
-  var $ = this.$;
+  var $ = this.jQuery;
 
   // Helper function to correctly set up the prototype chain, for subclasses.
   // Similar to `goog.inherits`, but uses a hash of prototype properties and

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list