TinyMCE:API/tinymce.dom.ScriptLoader

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Class: 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.

Constructor

ScriptLoader
Constructs a new script loaded instance.

Methods

add
Adds a specific script to the load queue of the script loader.
eval
Evaluates the specified string inside the global namespace/window scope.
load
Loads a specific script directly without adding it to the load queue.
loadQueue
Starts the loading of the queue.
loadScripts
Loads the specified queue of files and executes the callback ones they are loaded.
markDone
Marks a specific script to be loaded.

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.');
});
Personal tools