[lively-kernel] Loading JS files into world

Marco Monteiro marco at neniu.org
Tue Jan 13 11:50:02 CET 2015


Hello!

I've recently started playing with Lively and I have a couple of questions.

I have some helper JS methods that I want to use in different worlds.
Currently I install the methods in the world morph and use $world.<method>
in my code. I would like to extract these methods into a JS library file
and import it into different worlds. By reading other posts in the mailing
list, I found that, for example,
http://lively-web.org/users/larswassermann/relax.html, loads the
http://lively-web.org/users/larswassermann/relax.js file. I want to do the
same thing in my worlds. How can I do that?

I've been exploring and found the Preferences window. In that, I see a
bootstrap group, which seems could be something that would allow me to add
files JS files to the bootstrap, but when I try to edit the bootstrapFiles
property, I get '["core/lively/Migration.js","core/liv...' in the editor,
instead of the entire array.

Also, how can I load a generic JS library (for example
https://sdk.amazonaws.com/js/aws-sdk-2.1.5.min.js) into the world and have
AWS (defined as a global variable in the library) be a global variable in
my world?

I think I read in the mailing list an answer to this:

module(<my-module>).requires().requiresLib({
    url: "https://sdk.amazonaws.com/js/aws-sdk-2.1.5.min.js", loadTest:
function() { return !!window.AWS; }
}).toRun(function() {

});

if I can load my own library (earlier question).

Is there any documentation or other resources for this kind of (lower
level) stuff? For example, how the bootstrap process works, etc.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hpi.uni-potsdam.de/archive/lively-kernel/attachments/20150113/2e139d8f/attachment.html>


More information about the lively-kernel mailing list