Sign in


Dynamically loads and executes an external Javascript file.


neon.load(string url [, function callback])
neon.load(Array urls [, function callback])


The URL (or an Array of one or more URLs) for the script to load.


A callback function to be called immediately after the script has loaded.

Return value

This method has no return value. It was decided not to make this method chainable to prevent potential confusion, since the method accepts a function that is not executed immediately.


This method loads an external Javascript file and executes it. It can be used as a way of dynamically including other Javascript that was not pre-loaded when the page first loaded.

Because the Javascript is loaded asynchronously, it will not delay either the loading of the page or the execution of other Javascript. This method accepts an optional callback parameter, allowing you to delay execution of some further commands until the requested script has loaded.

It is safe to call this method multiple times with the same URLs. If a URL is specified which has already been loaded from a previous call, the callback will be executed immediately. If a URL is specified which is still pending from a previous call and hasn't loaded yet, a new request won't be sent and the callback function will be queued with the existing request.

Please note that when calling this method multiple times for the same Javascript file, the text of the URL as stated in the parameter should be exactly the same, not just equivalent to the same URL when expanded.