chaplinjs / chaplin

HTML5 application architecture using Backbone.js
http://chaplinjs.org
Other
2.85k stars 232 forks source link

Support for Exoskeleton, but without jQuery and Underscore #842

Open PMK opened 9 years ago

PMK commented 9 years ago

Both jQuery and Underscore are now fully optional in Exoskeleton, see https://github.com/paulmillr/exoskeleton/issues/102. If you use Exoskeleton instead of Backbone with Chaplin, and you're not using jQuery and Underscore, Chaplin calls Backbone.View, but should call Backbone.NativeView. An error will be triggered, see https://github.com/paulmillr/exoskeleton/commit/b8e5dc9b6f88f5767459d02c20b2bfc49903c1c2.

Can you implement the option to use Chaplin with Exoskeleton, but without jQuery and Underscore?

akre54 commented 9 years ago

Right so in this case you'd need to either set Backbone.View = Backbone.NativeView before loading Chaplin, or _.extend(Backbone.View.prototype, Backbone.NativeViewMixin) before calling any view methods.

I made a branch of Chaplin a few months ago to support Backbone.NativeView but got sidetracked. I'll push it up and maybe try to work on it if I get support.

Apophenian commented 9 years ago

I'm having trouble getting this working in a exoskeleton/lodash/chaplin environment with requirejs.

If I call _.extend(Backbone.View.prototype, Backbone.NativeViewMixin) it seems to go into an infinite loop in chaplin's utils.getPrototypeChain, and I'm not sure of the best place to put

Backbone.View = Backbone.NativeView

Any help would be much appreciated

Apophenian commented 9 years ago

I've figured it out :)