CKEditor 4 Documentation

CKEDITOR.plugins.notificationAggregator.task

Mixins

Files

Overview

This type represents a single task in the aggregator, and exposes methods to manipulate its state.

Weights

Task progess is based on its weight.

As you create a task, you need to declare its weight. As you want the update to inform about the progress, you will need to update the task, telling how much of this weight is done.

For example, if you declare that your task has a weight that equals 50 and then call update with 10, you will end up with telling that the task is done in 20%.

Example Usage of Weights

Let us say that you use tasks for file uploading.

A single task is associated with a single file upload. You can use the file size in bytes as a weight, and then as the file upload progresses you just call the update method with the number of bytes actually downloaded.

Available since: 4.5

Defined By

Properties

CKEDITOR.plugins.notificationAggregator.task
view source
: Numberprivate
Done weight of the task. ...

Done weight of the task.

Defaults to: 0

CKEDITOR.plugins.notificationAggregator.task
view source
: Booleanprivate
Indicates when the task is canceled. ...

Indicates when the task is canceled.

Defaults to: false

CKEDITOR.plugins.notificationAggregator.task
view source
: Numberprivate

Total weight of the task.

Total weight of the task.

Defined By

Methods

Creates a task instance for notification aggregator. ...

Creates a task instance for notification aggregator.

Parameters

  • weight : Number (optional)

    Defaults to: 1

Returns

Overrides: CKEDITOR.event.constructor

CKEDITOR.plugins.notificationAggregator.task
view source
( )
Cancels the task (the task will be removed from the aggregator). ...

Cancels the task (the task will be removed from the aggregator).

Register event handler under the capturing stage on supported target. ...

Register event handler under the capturing stage on supported target.

Predefine some intrinsic properties on a specific event name. ...

Predefine some intrinsic properties on a specific event name.

Parameters

  • name : String

    The event name

  • meta : Object
    • errorProof : (optional)

      Whether the event firing should catch error thrown from a per listener call.

      Defaults to: false

CKEDITOR.plugins.notificationAggregator.task
view source
( )
Marks the task as done. ...

Marks the task as done.

( eventName, [data], [editor] ) : Boolean/Object
Fires an specific event in the object. ...

Fires an specific event in the object. All registered listeners are called at this point.

someObject.on( 'someEvent', function() { ... } );
someObject.on( 'someEvent', function() { ... } );
someObject.fire( 'someEvent' );             // Both listeners are called.

someObject.on( 'someEvent', function( event ) {
    alert( event.data );                    // 'Example'
} );
someObject.fire( 'someEvent', 'Example' );

Parameters

Returns

  • Boolean/Object

    A boolean indicating that the event is to be canceled, or data returned by one of the listeners.

( eventName, [data], [editor] ) : Boolean/Object
Fires an specific event in the object, releasing all listeners registered to that event. ...

Fires an specific event in the object, releasing all listeners registered to that event. The same listeners are not called again on successive calls of it or of fire.

someObject.on( 'someEvent', function() { ... } );
someObject.fire( 'someEvent' );         // Above listener called.
someObject.fireOnce( 'someEvent' );     // Above listener called.
someObject.fire( 'someEvent' );         // No listeners called.

Parameters

Returns

  • Boolean/Object

    A booloan indicating that the event is to be canceled, or data returned by one of the listeners.

Checks if there is any listener registered to a given event. ...

Checks if there is any listener registered to a given event.

var myListener = function() { ... };
someObject.on( 'someEvent', myListener );
alert( someObject.hasListeners( 'someEvent' ) );    // true
alert( someObject.hasListeners( 'noEvent' ) );      // false

Parameters

  • eventName : String

    The event name.

Returns

  • Boolean
CKEDITOR.plugins.notificationAggregator.task
view source
( ) : Boolean
Checks if the task is canceled. ...

Checks if the task is canceled.

Returns

  • Boolean
CKEDITOR.plugins.notificationAggregator.task
view source
( ) : Boolean
Checks if the task is done. ...

Checks if the task is done.

Returns

  • Boolean
( eventName, listenerFunction, [scopeObj], [listenerData], [priority] ) : Object
Registers a listener to a specific event in the current object. ...

Registers a listener to a specific event in the current object.

someObject.on( 'someEvent', function() {
    alert( this == someObject );        // true
} );

someObject.on( 'someEvent', function() {
    alert( this == anotherObject );     // true
}, anotherObject );

someObject.on( 'someEvent', function( event ) {
    alert( event.listenerData );        // 'Example'
}, null, 'Example' );

someObject.on( 'someEvent', function() { ... } );                       // 2nd called
someObject.on( 'someEvent', function() { ... }, null, null, 100 );      // 3rd called
someObject.on( 'someEvent', function() { ... }, null, null, 1 );        // 1st called

Parameters

  • eventName : String

    The event name to which listen.

  • listenerFunction : Function

    The function listening to the event. A single CKEDITOR.eventInfo object instanced is passed to this function containing all the event data.

  • scopeObj : Object (optional)

    The object used to scope the listener call (the this object). If omitted, the current object is used.

  • listenerData : Object (optional)

    Data to be sent as the CKEDITOR.eventInfo.listenerData when calling the listener.

  • priority : Number (optional)

    The listener priority. Lower priority listeners are called first. Listeners with the same priority value are called in registration order.

    Defaults to: 10

Returns

  • Object

    An object containing the removeListener function, which can be used to remove the listener at any time.

Similiar with on but the listener will be called only once upon the next event firing. ...

Similiar with on but the listener will be called only once upon the next event firing.

CKEDITOR.event.on

Remove all existing listeners on this object, for cleanup purpose. ...

Remove all existing listeners on this object, for cleanup purpose.

( eventName, listenerFunction )
Unregisters a listener function from being called at the specified event. ...

Unregisters a listener function from being called at the specified event. No errors are thrown if the listener has not been registered previously.

var myListener = function() { ... };
someObject.on( 'someEvent', myListener );
someObject.fire( 'someEvent' );                 // myListener called.
someObject.removeListener( 'someEvent', myListener );
someObject.fire( 'someEvent' );                 // myListener not called.

Parameters

  • eventName : String

    The event name.

  • listenerFunction : Function

    The listener function to unregister.

CKEDITOR.plugins.notificationAggregator.task
view source
( weight )
Updates the done weight of a task. ...

Updates the done weight of a task.

Parameters

  • weight : Number

    Number indicating how much of the total task _weight is done.

Defined By

Events

CKEDITOR.plugins.notificationAggregator.task
view source
( evt )
Fired when the task is canceled. ...

Fired when the task is canceled.

Parameters

CKEDITOR.plugins.notificationAggregator.task
view source
( evt )
Fired when the task is done. ...

Fired when the task is done.

Parameters

CKEDITOR.plugins.notificationAggregator.task
view source
( evt )
Fired upon each weight update of the task. ...

Fired upon each weight update of the task.

var myTask = new Task( 100 );
myTask.update( 30 );
// Fires updated event with evt.data = 30.
myTask.update( 40 );
// Fires updated event with evt.data = 10.
myTask.update( 20 );
// Fires updated event with evt.data = -20.

Parameters

  • evt : CKEDITOR.eventInfo
    • data : Number

      The difference between the new weight and the previous one.