Created
July 8, 2014 16:45
-
-
Save karlwestin/a3a26d3a100f58cf4c5e to your computer and use it in GitHub Desktop.
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
define("models/accounts2", [ | |
"lib/local-backbone", | |
"lib/local-underscore", | |
"models/accountProgress" | |
], function( | |
Backbone, | |
_, | |
progressModel | |
) { | |
var FlatAccounts = Backbone.Collection.extend({ | |
initialize: function(options) { | |
// SETUP FOR ERROR: | |
// populate the 'planned' attr from account-progress | |
var updatePlanned = _.debounce(this.updatePlans); | |
this.on("add remove change:attributes.active", updatePlanned, this); | |
progressModel.on("change", updatePlanned, this); | |
}, | |
updatePlans: function() { | |
// | |
// HERE COMES THE ERROR: | |
// this.each throws 'undefined is not a function' (sometimes) | |
this.each(function(model) { | |
// do something | |
}, this); | |
} | |
}); | |
return FlatAccounts; | |
}); |
yeah that has helped in other places, just stumped on where the issue is coming from: underscore or our code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And
_.debounce(_.bind(this.updatePlans, this))
doesn't help?Didn't digged into because I'm just on my phone. :)