[lively-kernel] adding a JS library to my world
Lars
lars.wassermann at googlemail.com
Fri Aug 15 23:32:00 CEST 2014
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.
On 15 August 2014 12:38, <carlos.crosetti at afilha.com.ar> wrote:
> 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
> lively-kernel at hpi.uni-potsdam.de
> http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20140815/c7911b85/attachment.html>
More information about the lively-kernel
mailing list