tinymce.dom.ScriptLoader

This class handles asynchronous/synchronous loading of JavaScript files it will execute callbacks when various items gets loaded. This class is useful to load external JavaScript files.

Examples

// Load a script from a specific URL using the global script loader
tinymce.ScriptLoader.load('somescript.js');

// Load a script using a unique instance of the script loader
var scriptLoader = new tinymce.dom.ScriptLoader();

scriptLoader.load('somescript.js');

// Load multiple scripts
var scriptLoader = new tinymce.dom.ScriptLoader();

scriptLoader.add('somescript1.js');
scriptLoader.add('somescript2.js');
scriptLoader.add('somescript3.js');

scriptLoader.loadQueue(function() {
   alert('All scripts are now loaded.');
});

Methods

name summary defined by
add() Adds a specific script to the load queue of the script loader. tinymce.dom.ScriptLoader
isDone() Returns true/false if a script has been loaded or not. tinymce.dom.ScriptLoader
load() Loads a specific script directly without adding it to the load queue. tinymce.dom.ScriptLoader
loadQueue() Starts the loading of the queue. tinymce.dom.ScriptLoader
loadScripts() Loads the specified queue of files and executes the callback ones they are loaded. This method is generally not used outside this class but it might be useful in some scenarios. tinymce.dom.ScriptLoader
markDone() Marks a specific script to be loaded. This can be useful if a script got loaded outside the script loader or to skip it from loading some script. tinymce.dom.ScriptLoader

Methods

add

add(url:String, success:function, scope:Object, failure:function)

Adds a specific script to the load queue of the script loader.

Parameters

isDone

isDone(url:String):Boolean

Returns true/false if a script has been loaded or not.

Parameters
Return value

load

load(url:String, callback:function, callback:function)

Loads a specific script directly without adding it to the load queue.

Parameters

loadQueue

loadQueue(success:function, failure:function, scope:Object)

Starts the loading of the queue.

Parameters

loadScripts

loadScripts(scripts:Array, callback:function, scope:Object, callback:function)

Loads the specified queue of files and executes the callback ones they are loaded. This method is generally not used outside this class but it might be useful in some scenarios.

Parameters

markDone

markDone(url:string)

Marks a specific script to be loaded. This can be useful if a script got loaded outside the script loader or to skip it from loading some script.

Parameters

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.