Auto defining a custom JS Library in BackboneJS
问题 I've created an JS library to handle all my API calls. Is there a way to automatically include this in all my views as api without needing to define it at the top of each view? I've tried adding it to the main js file, but that doesn't seem to carry into the views. 回答1: Each Backbone model should handle its API endpoint communications and each module should only require the models it depends on. Otherwise, it goes against the point of making your code more modular. That being said, if you