Discussion:
[lively-kernel] adding a JS library to my world
c***@afilha.com.ar
2014-08-15 19:38:13 UTC
Permalink
Hi, it is possible to add a JavaScript library at my world level, thus
not affecting other LK users working on the same LK server?

Thanks, Carlos
Lars
2014-08-15 21:32:00 UTC
Permalink
Hi Carlos,

a way would be to add an empty module which requires the library and add
that to world requirements. The code for requiring an external library by a
lively module is:

module(<<name>>).requires().requiresLib({
url: Config.codeBase + <<pathToLibFileWithFileEnding, relative to
core>>, loadTest: function() { return !!Global.<<YourLibrary>>; }
}).toRun(function() { /* ... */ }

The loadTest has to be correct, otherwise the JSLoader might assume the
library is loaded and not load your URL, or load your module although the
lib is missing. We keep all our libs in /core/lib/, and that worked fine so
far.

Does that help you?
Lars

P.S.: On lively web you can see that pattern in
users/larswassermann/relax.js or in some of the acorn files for ast parsing.
Post by c***@afilha.com.ar
Hi, it is possible to add a JavaScript library at my world level, thus
not affecting other LK users working on the same LK server?
Thanks, Carlos
_______________________________________________
lively-kernel mailing list
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Loading...