-
-
Save dmitry/1256695 to your computer and use it in GitHub Desktop.
Revisions
-
wesen revised this gist
Aug 22, 2011 . No changes.There are no files selected for viewing
-
wesen renamed this gist
Aug 21, 2011 . 1 changed file with 6 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ /** * ## Merging mixin views in backbone.js ## * * really just more a test for tumblr gistr */ /** * Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. @@ -14,5 +14,4 @@ function mergeMixin(view, mixin) { var oldInitialize = view.prototype.initialize; view.prototype.initialize = function () { mixin.initialize.apply(this); oldInitialize.apply(this); }; } } -
wesen revised this gist
Aug 21, 2011 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,8 @@ ## Merging mixin views in backbone.js ## really just more a test for tumblr gistr ```js /** * Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. @@ -11,3 +15,4 @@ function mergeMixin(view, mixin) { view.prototype.initialize = function () { mixin.initialize.apply(this); oldInitialize.apply(this); }; } } ``` -
wesen created this gist
Aug 21, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ /* really just more a test for tumblr gistr */ /** * Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. **/ function mergeMixin(view, mixin) { _.defaults(view.prototype, mixin); _.defaults(view.prototype.events, mixin.events); if (mixin.initialize !== undefined) { var oldInitialize = view.prototype.initialize; view.prototype.initialize = function () { mixin.initialize.apply(this); oldInitialize.apply(this); }; } }