Skip to content
This repository has been archived by the owner on Dec 23, 2019. It is now read-only.
Sean Dunn edited this page Jul 31, 2013 · 4 revisions

Events are not used very widely in the extraction pipeline.

There are two different event mechanisms. One relies on the DOM event, the busyBox, the other on pure jQuery events, pubSub.

busyBox

busyBox is used to show a pending operation. It simply encapsulate a given DOM element inside a div, make is passive, and add on top of it an arguably nice spinning wheel.

the busyBox has to be be initialise, but only once. This is done in the App:addEventHandlers() method.

To mark a DOM element as 'busy', make it trigger an event of this form:

    $(source).trigger('s2.busybox.start_process');

To unmark a div element as 'busy', make it trigger an event of this form:

    $(source).trigger('s2.busybox.end_process');

It is also possible to use the following form:

    $(source).trigger('s2.busybox.process_in_progress', bool);

where bool indicates whether the source element is busy or not.

pubsub

The pubsub library is simply an lightweight implementation of the pub/sub pattern. It is made in such way that the inclusion via 'require' provides a shared object. There is no need to instantiate it.

It is used to allow the communication between controllers. On the long run, it should be used to replace all the 'childDone' calls.

PubSub.publish('s2.status.message', controller, {message:'Kit details validated/saved'});

Note: Only the controllers should uses the pubsub library. Indeed, the model should only communicate to its presenter via promises, or to S2, via the Mapper.

Clone this wiki locally