DracoBlue / jsb

A very extendable Toolkit to inject Javascript Behaviour into rendered HTML without Inline Javascript. (jsb was formerly known as JsBehaviourToolkit)
http://dracoblue.net
Other
52 stars 8 forks source link

lazy loading for behaviours #6

Closed DracoBlue closed 11 years ago

DracoBlue commented 12 years ago

it would be cool to load the behaviours on demand, as soon as a handler is triggered.

ghost commented 12 years ago

Ok, then we need a mechanism to tell jsb where the file is located.

Maybe change the signature of registerHandler to function(name, url) (with fallback to the "old" way) and have the behvaviour export the behaviour object as a module?

DracoBlue commented 12 years ago

Naming to be decided, but to register the lazy loaders:

jsb.registerTHINGS({
     "game_session": "static/js/GameSession.js"
});

jsb.whenFired('JSB::HANDLER_REGISTERED', {'name': "game_session"}, function()
{
});
DracoBlue commented 11 years ago

fixed with ceac2bb7eb0bddbee020ee33c698619b414692e9 and requirejs