Backbone/Underscore uniqueId() Odd Numbers

筅森魡賤 提交于 2019-12-05 14:30:29

if you look in the backbone.js source code you'll notice that _.uniqueId is used to set a model's cid: https://github.com/documentcloud/backbone/blob/master/backbone.js#L194

that means that every time you create a model instance, _.uniqueId() is invoked. that's what causing it to increment twice.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!