jeromegn/Backbone.localStorage — pull request #30 by juhovh (2012-05-08 08:43:41+00:00)
Title: Support for RequireJS loading

Hi,

I tried to use Backbone.localStorage with RequireJS by loading it after Backbone using the RequireJS order plugin. Everything worked fine otherwise, but Backbone.localStorage uses the global "Backbone" object from inside the functions. When I use RequireJS that reference is not available after loading.

I fixed this by simply holding a reference to the Backbone object inside the closure. I didn't write tests, since they would depend on RequireJS, jQuery, Underscore AND Backbone.js, but if you wish I could do that as well just as an example.

Hope this is useful.