Makes the library loadable as CommonJS module/package. This adds support for npm/browserify and their require() functions.
I had to add palava = @palava to the top of most files and $ = @$ to the top of most files because we were depending on this being the global namespace (as a result of the way sprockets implements #= require).
Additionally there is now module.coffee which tries to load JQuery and EventEmitter with require() if they are not in the global namespace and exports the palava namespace.
Comment by janlelisWednesday Oct 08, 2014 at 13:36 GMT
thank you! looks good to me. some related things i've noticed:
bower.json is missing jquery
we should provide a bundle with all dependencies... should this even be in the .min. ("production") version so you can just drop it into your code and it works?
Comment by thammiSaturday Oct 11, 2014 at 15:57 GMT
Bundling the dependencies without a mechanism like require()/AMD/... would pollute the namespace of the user and might cause version conflicts if the user manually includes the libraries.
Issue by thammi Thursday Sep 04, 2014 at 20:02 GMT Originally opened as https://github.com/palavatv/palava-client/pull/10
Makes the library loadable as CommonJS module/package. This adds support for npm/browserify and their
require()
functions.I had to add
palava = @palava
to the top of most files and$ = @$
to the top of most files because we were depending onthis
being the global namespace (as a result of the way sprockets implements#= require
).Additionally there is now
module.coffee
which tries to load JQuery and EventEmitter withrequire()
if they are not in the global namespace and exports thepalava
namespace.thammi included the following code: https://github.com/palavatv/palava-client/pull/10/commits