[Pkg-javascript-commits] [backbone] 07/19: Calling 'initialize', if it is defined.

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


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

js pushed a commit to tag 0.1.1
in repository backbone.

commit 63085b6ccd12953d210adcaef5b607b5fa21a5b6
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Wed Oct 13 17:30:12 2010 -0400

    Calling 'initialize', if it is defined.
---
 backbone.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/backbone.js b/backbone.js
index eeddab2..f5e0b25 100644
--- a/backbone.js
+++ b/backbone.js
@@ -121,6 +121,7 @@
     this.cid = _.uniqueId('c');
     this.set(attributes || {}, {silent : true});
     this._previousAttributes = _.clone(this.attributes);
+    if (this.initialize) this.initialize(attributes);
   };
 
   // Attach all inheritable methods to the Model prototype.
@@ -306,7 +307,8 @@
     }
     this._boundOnModelEvent = _.bind(this._onModelEvent, this);
     this._reset();
-    if (models) this.refresh(models,true);
+    if (models) this.refresh(models, {silent: true});
+    if (this.initialize) this.initialize(models, options);
   };
 
   // Define the Collection's inheritable methods.
@@ -492,7 +494,7 @@
       if (this.className) attrs.className = this.className;
       this.el = this.make(this.tagName, attrs);
     }
-    return this;
+    if (this.initialize) this.initialize(options);
   };
 
   // jQuery lookup, scoped to DOM elements within the current view.

-- 
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