Closed typhonrt closed 7 years ago
Hi @typhonrt, thanks for this, however I'm going to close it in favour of #207
Oh no worries.. Sounds good. At the time I didn't know what I do now. Back then I just rewrote local storage in ES6; I see #207 does this... Now I just use babel-plugin-add-module-exports with my ES6 modules especially everything released on NPM.
This subtle change takes into account how ES6 modules export default named modules and how they are consumed in the UMD loading code of Backbone.localStorage. backbone-es6 (https://github.com/typhonjs/backbone-es6) is a fork of Backbone using ES6. The ES6 module output
export default backbone;
found in ModuleRuntime.js (https://github.com/typhonjs/backbone-es6/blob/master/src/ModuleRuntime.js#L39) puts the actual reference under a default named key in the ES5 UMD loading code.A complete TODOs demo using Backbone-ES6 and Backbone.localStorage can be found here: http://js.demos.typhonrt.org/backbone-es6-localstorage-todos/
and repo of the demo: https://github.com/typhonjs-demos/backbone-es6-localstorage-todos
The change in this PR adds a check for the existence of
Backbone.default
in the resolution of callingfactory
in the Backbone.localStorage UMD wrapper.