adding a JS library to my world

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

adding a JS library to my world

ccrosetti

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
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel
Reply | Threaded
Open this post in threaded view
|

Re: adding a JS library to my world

Lars Wassermann
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, <[hidden email]> 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
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel



_______________________________________________
lively-kernel mailing list
[hidden email]
http://lists.hpi.uni-potsdam.de/listinfo/lively-kernel