Report an issue
Class

CKEDITOR.tools.promise

class since 4.12.0

An alias for the Promise object representing an asynchronous operation.

It uses the native Promise browser implementation if it is available. For older browsers with lack of Promise support, the ES6-Promise polyfill is used. See the Promise Browser Compatibility table to learn more.

Refer to MDN Using Promises guide for more details on how to work with promises.

NOTE: catch and finally are reserved keywords in IE<9 browsers. Use bracket notation instead:

promise[ 'catch' ]( function( err ) {
        // ...
} );

promise[ 'finally' ]( function() {
    // ...
} );

Filtering

Methods

  • constructor( resolver ) → promise

    Creates a new Promise instance.

    new CKEDITOR.tools.promise( function( resolve, reject ) {
        setTimeout( function() {
            var timestamp;
            try {
                timestamp = ( new Date() ).getTime();
            } catch ( e ) {
                reject( e );
            }
            resolve( timestamp );
        }, 5000 );
    } );
    

    Parameters

    resolver : Function

    Returns

    promise