Events for Component Users
Registering Listeners
Implementers can register listeners for events using the component creator function options parameter. A listeners object should be included in the options object defining the listener function(s) for the desired event, for example:
var opts = {
listeners: {
afterFileQueued: myQueueListenerFunc,
afterUploadComplete: function (args) {
...
},
onFileProgress: [listener1, listener2]
}
};
var myUploader = fluid.uploader(myContainer, opts);
Listeners may also be added and removed dynamically at any point in the component's lifecycle after it has been constructed, by accessing the event firers which are created under the top-level that, under the name events. For example, to achieve the same effect as the first member of the options block above, one could instead write
myUploader.events.afterFileQueued.addListener(myQueueListenerFunc);
Note that it is usually easier and more reliable for component users to register listeners in the options block as shown above. More advanced information on the event system, mostly suitable for component developers, can be found at Events for Component Developers.
Note that the arguments supported by each event are defined by the component itself. Implementors must consult the documentation for the component.
Event Types
By default, most Fluid component events are multi-cast (that is, the event is fired to all registered listeners), but some events may be one of the following two special types:
The individual component API pages document which events are of these types.