Closed wheresrhys closed 9 years ago
Shouldn't you be able to alias exoskeleton as Backbone in your module loader?
I'm happy to take a PR that drops all Backbone dependencies if you can think of a better way of exporting the library object.
So what's the real issue you're trying to solve here?
Exoskeleton works fine with this library as-is. You should only need to point your module loader to the right path and it'll work as expected.
That's what I've been doing using browserify-shim, but I think the principle of being able to do bower/npm install Backbone.NativeView
and it just works without any specific config is a good one to aim for.
I'll see if I can drop the backbone dependency in a way that works in node or browser.
I'm not sure this is the best way to handle that pattern though. Lets have a think on this and see if there's a better solution.
Even though I work on Exoskeleton, I think it's actually a good idea to be explicit about changing dependencies. If we can get away with not requiring Backbone at all here, that might be the best solution.
How about changing the module to be a function that expects Backbone/exoskeleton to be passed to it? If nothing is passed it defaults to using this.Backbone/window.Backbone
On Monday, December 1, 2014, Adam Krebs notifications@github.com wrote:
I'm not sure this is the best way to handle that pattern though. Lets have a think on this and see if there's a better solution.
Even though I work on Exoskeleton, I think it's actually a good idea to be explicit about changing dependencies. If we can get away with not requiring Backbone at all here, that might be the best solution.
— Reply to this email directly or view it on GitHub https://github.com/akre54/Backbone.NativeView/pull/9#issuecomment-65096995 .
Well it's meant to be used as a mixin.
In order to support the var MyView = Backbone.NativeView.extend({ ... })
and Backbone.View = Backbone.NativeView
forms, we need a reference to the Backbone.View constructor.
If we abandoned those in favor of only supporting extending the prototype, we'd need users to set the _domEvents
array themselves in their initialize method (because it's instance-specific). Not especially a killer, but definitely not a particularly easy experience.
This means exoskeleton can more easily be used with this module in commonjs/amd.
I'll add tests, docs and do the same for Backbone.NativeAjax if this seems sound.