[Pkg-javascript-commits] [backbone] 10/34: Moving all helper functions down to the bottom.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 16:58:44 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 2ae60985eee091504c9bd23d209229805e78ce13
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Thu Oct 14 13:34:00 2010 -0400
Moving all helper functions down to the bottom.
---
backbone.js | 56 +++++++++++++++++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 25 deletions(-)
diff --git a/backbone.js b/backbone.js
index 064b497..e999935 100644
--- a/backbone.js
+++ b/backbone.js
@@ -27,31 +27,6 @@
// For Backbone's purposes, jQuery owns the `$` variable.
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
- // class properties to be extended.
- var inherits = function(parent, protoProps, classProps) {
- var child;
- if (protoProps.hasOwnProperty('constructor')) {
- child = protoProps.constructor;
- } else {
- child = function(){ return parent.apply(this, arguments); };
- }
- var ctor = function(){};
- ctor.prototype = parent.prototype;
- child.prototype = new ctor();
- _.extend(child.prototype, protoProps);
- if (classProps) _.extend(child, classProps);
- child.prototype.constructor = child;
- return child;
- };
-
- // Helper function to get a URL from a Model or Collection as a property
- // or as a function.
- var getUrl = function(object) {
- return _.isFunction(object.url) ? object.url() : object.url;
- };
-
// Backbone.Events
// -----------------
@@ -616,6 +591,9 @@
'read' : 'GET'
};
+ // Backbone.sync
+ // -------------
+
// Override this function to change the manner in which Backbone persists
// models to the server. You will be passed the type of request, and the
// model in question. By default, uses jQuery to make a RESTful Ajax request
@@ -636,4 +614,32 @@
});
};
+ // Helpers
+ // -------
+
+ // Helper function to correctly set up the prototype chain, for subclasses.
+ // Similar to `goog.inherits`, but uses a hash of prototype properties and
+ // class properties to be extended.
+ var inherits = function(parent, protoProps, classProps) {
+ var child;
+ if (protoProps.hasOwnProperty('constructor')) {
+ child = protoProps.constructor;
+ } else {
+ child = function(){ return parent.apply(this, arguments); };
+ }
+ var ctor = function(){};
+ ctor.prototype = parent.prototype;
+ child.prototype = new ctor();
+ _.extend(child.prototype, protoProps);
+ if (classProps) _.extend(child, classProps);
+ child.prototype.constructor = child;
+ return child;
+ };
+
+ // Helper function to get a URL from a Model or Collection as a property
+ // or as a function.
+ var getUrl = function(object) {
+ return _.isFunction(object.url) ? object.url() : object.url;
+ };
+
})();
--
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