Report an issue
Class

CKEDITOR.scriptLoader

class singleton

Load scripts asynchronously.

Filtering

Methods

  • load( scriptUrl, [ callback ], [ scope ], [ showBusy ] )

    Loads one or more external scripts checking if it has not been loaded previously by this function.

    CKEDITOR.scriptLoader.load( '/myscript.js' );
    
    CKEDITOR.scriptLoader.load( '/myscript.js', function( success ) {
        // Alerts true if the script has been properly loaded.
        // HTTP error 404 should return false.
        alert( success );
    } );
    
    CKEDITOR.scriptLoader.load( [ '/myscript1.js', '/myscript2.js' ], function( completed, failed ) {
        alert( 'Number of scripts loaded: ' + completed.length );
        alert( 'Number of failures: ' + failed.length );
    } );
    

    Parameters

    scriptUrl : String | Array

    One or more URLs pointing to the scripts to be loaded.

    [ callback ] : Function

    A function to be called when the script is loaded and executed. If a string is passed to scriptUrl, a Boolean parameter is passed to the callback, indicating the success of the load. If an array is passed instead, two array parameters are passed to the callback: the first contains the URLs that have been properly loaded and the second the failed ones.

    [ scope ] : Object

    The scope (this reference) to be used for the callback call. Defaults to CKEDITOR.

    [ showBusy ] : Boolean

    Changes the cursor of the document while the script is loaded.

  • since 4.1.2

    queue( scriptUrl, [ callback ] )

    Loads a script in a queue, so only one is loaded at the same time.

    Parameters

    scriptUrl : String

    The URL pointing to the script to be loaded.

    [ callback ] : Function

    A function to be called when the script is loaded and executed. A Boolean parameter is passed to the callback, indicating the success of the load.

    CKEDITOR.scriptLoader.load