oampo / Audiolet

A JavaScript library for real-time audio synthesis and composition from within the browser
http://oampo.github.com/Audiolet/
Apache License 2.0
893 stars 118 forks source link

amd compatibility #35

Open kn0ll opened 12 years ago

kn0ll commented 12 years ago

hi,

amd / requirejs support would be super. dependency clarity, module packaging, and lazy loading would be a nice addition.

assuming you'd like the library to continue to work without requirejs, though, will mean the implementation requires a little thought.

your thoughts?

oampo commented 12 years ago

I think you can put me in the "not sure" camp on this one.

I like the simplicity of Juicer. I think it's pretty clear which files depend on which others, and I'd say the code organization is about as straightforward as it can be. Also it means that the code is 100% 'normal' JavaScript, with no external dependencies and as little JS funkiness as I can get away with. On the minus side it does need an external tool for building, lazy loading is difficult, and we probably chuck too much stuff into the global namespace.

On balance I'm not sure that the benefits outweigh the costs, but I'm happy to be persuaded if there are real advantages which I've not understood, or if other people feel strongly about this.

kn0ll commented 12 years ago

i agree with everything you said. as much as like requirejs, this is the first time i'd suggest a library include it.

my hunch, and i may be wrong, is any non-trivial app using Audiolet will benefit from requirejs. the pros you listed become much more important in large scale. things like lazy loading and namespace management are bigger problems there, and difficult to handle at the moment. on the other hand, smaller apps, one off synths, etc, will benefit from the simplicity of including a single file.

if you agree with that sentiment, and think it would be worth addressing, we could dig deeper into the pros/cons...

somewhat aside, if it helps ease your concerns, i believe you could build the project in a way that a developer would have the option to use individual modules with requirejs, or include a single file utilizing the global namespace (with no external dependency).