WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Library Imports

A Javascript script may import other scripts as libraries.

To import a Script

The contextloader global variable is provided to a script. It will load and initialize a script resource.


loadLibrary() takes a String which is the ROC resource identifier of the script to load.


Say you have a script library with ROC identifier res:/javascript/libs/test.js

function test()
{   return "Hello World";

You can import this function in your script like so...


//Call imported function

Library loading is recursive - an imported library may also import libraries.

All library resource identifiers must be fully qualified - relative addressing is not meaningful.

Implementation Notes

The contextloader is implemented on top of the INKFRequestContext - it will SOURCE the requested identifier as a compiled javascript Script. It then invokes the script in the loading scripts execution context.


See JSON section for example of using the well known json2.js library.