Created
December 18, 2012 00:35
-
-
Save pwmckenna/4323827 to your computer and use it in GitHub Desktop.
liveOnce extension to backbrace.js's live function
This file contains 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 characters
(function() { | |
var liveOnceExtension = { | |
liveOnce: function(selectors, callback, context) { | |
var _this = this; | |
var wrapper = function() { | |
_this.die(selectors, wrapper, context); | |
callback.apply(this, arguments); | |
} | |
this.live(selectors, wrapper, context); | |
} | |
}; | |
_.extend(Backbone.Model.prototype, liveOnceExtension); | |
_.extend(Backbone.Collection.prototype, liveOnceExtension); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment