0 results found

tinymce.util.Dispatcher

Contribute to this page
Namespacetinymce.util
ClassDispatcher

This class is used to dispatch event to observers/listeners. All internal events inside TinyMCE uses this class.

Example

Public Methods

MethodDefined By
Dispatcher(scope:Object) : Constructs a new event dispatcher object.Dispatcher
add(callback:function, s:Object):function : Add an observer function to be executed when a dispatch call is done.Dispatcher
addToTop(callback:function, scope:Object):function : Add an observer function to be executed to the top of the list of observers.Dispatcher
dispatch(..:Object):Object : Dispatches an event to all observers/listeners.Dispatcher
remove(callback:function):function : Removes an observer function.Dispatcher

Method details

Dispatcher

public function Dispatcher(scope:Object)
Constructs a new event dispatcher object.

Parameters

ParamDetail
scope:ObjectOptional default execution scope for all observer functions.

add

public function add(callback:function, s:Object):function
Add an observer function to be executed when a dispatch call is done.

Parameters

ParamDetail
callback:functionCallback function to execute when a dispatch event occurs.
s:ObjectOptional execution scope, defaults to the one specified in the class constructor.

Returns
function - Returns the same function as the one passed on.

addToTop

public function addToTop(callback:function, scope:Object):function
Add an observer function to be executed to the top of the list of observers.

Parameters

ParamDetail
callback:functionCallback function to execute when a dispatch event occurs.
scope:ObjectOptional execution scope, defaults to the one specified in the class constructor.

Returns
function - Returns the same function as the one passed on.

dispatch

public function dispatch(..:Object):Object
Dispatches an event to all observers/listeners.

Parameters

ParamDetail
..:ObjectAny number of arguments to dispatch.

Returns
Object - Last observer functions return value.

remove

public function remove(callback:function):function
Removes an observer function.

Parameters

ParamDetail
callback:functionObserver function to remove.

Returns
function - The same function that got passed in or null if it wasn't found.

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.