QWiPS Javascript Library, v1

This version of QWiPS Javascript Library is deprecated and not supported anymore. Most likely, it is broken or will break in the nearest future. Please consider switching to the new version.

Events

You can bind your own callbacks to any Qwips events, like this:

var myCallback = function(e, callback_params) {
  // event handler code goes here
};
where:
callback_params is callback_params passed to qwips.bind function
e is qwips' event object:
  e.event - event name
  e.params - event parameters (may be empty)

Event names can be passed to qwips.bind or qwips.unbind as strings or as qwips' constants.

qwips.bind(qwips.EV_ALL, function(e){
  if(e.event == qwips.EV_RECORD_BTN_CLICK)
    ;// do something
  else if(e.event == 'playerLoadError')
    console.error("Failed to load qwip with token", e.params.token);
});

qwips.bind( event, callback [,callback_params] )

Bind callback to specified qwips event(s).

event can be string or array
callback should be a valid callback
callback_params is optional and specify additional parameters to send to the callback
// bind callback to single event
qwips.bind('recorderWillAppear', myHandler);

// bind callback to multiple events
qwips.bind('recorderWillAppear recorderWillDisappear', myHandler);
// same as previous
qwips.bind([ 'recorderWillAppear', 'recorderWillDisappear' ], myHandler);
// same as previous
qwips.bind([ qwips.EV_RECORDER_WILL_APPEAR,
	qwips.EV_RECORDER_WILL_DISAPPEAR ], myHandler);

// bind callback to all events
qwips.bind(qwips.EV_ALL, myHandler);
// bind callback to all events with callback_params
qwips.bind(qwips.EV_ALL, myHandler, [4,8,15,16,23,42]);

qwips.unbind( event [,callback] )

Unbind callback from specified qwips event(s). If callback is omitted all callbacks will be unbinded from event(s).

event can be string or array
callback should be a valid callback (if present)
// unbind all callbacks from single event
qwips.unbind('recorderWillAppear');

// unbind callback from multiple events
qwips.unbind('recorderWillAppear recorderWillDisappear', myEventCallback);

// unbind all callback from all events
qwips.unbind(qwips.EV_ALL);

Event types

EV_RECORD_BTN_CLICK ('recordBtnClick')

Notifies that the record button was clicked.
e.params.companion points to companion.

EV_RECORDER_WILL_APPEAR ('recorderWillAppear')

Notifies that the recorder is about to be become visible.
e.params.companion points to companion.

EV_RECORDER_DID_APPEAR ('recorderDidAppear')

Notifies that the recorder was shown.
e.params.companion points to companion.

EV_RECORDER_WILL_DISAPPEAR ('recorderWillDisappear')

Notifies that the recorder is about to be become hidden.
e.params.companion points to companion.

EV_RECORDER_DID_DISAPPEAR ('recorderDidDisappear')

Notifies that the recorder was hidden.
e.params.companion points to companion.

EV_RECORD_WILL_START ('recordWillStart')

Notifies that the recording is about to be started

EV_RECORD_DID_START ('recordDidStart')

Notifies that recording was started

EV_RECORD_WILL_STOP ('recordWillStop')

Notifies that recording is about to be stopped

EV_RECORD_DID_STOP ('recordDidStop')

Notifies that recording was stopped

EV_RECORD_WILL_CANCEL ('recordWillCancel')

Notifies that recording is about to be cancelled

EV_RECORD_DID_CANCEL ('recordDidCancel')

Notifies that recording was cancelled

EV_EDITOR_WILL_APPEAR ('editorWillAppear')

Notifies that the Qwip editor is about to be shown.
e.params.token assigned to Qwip token

EV_EDITOR_DID_APPEAR ('editorDidAppear')

Notifies that the Qwip editor was shown.
e.params.token assigned to Qwip token

EV_EDITOR_WILL_DISAPPEAR ('editorWillDisappear')

Notifies that record player is about to be hidden.
e.params.token assigned to Qwip token
e.params.qwipWillRemove tell if Qwip will removed

EV_EDITOR_DID_DISAPPEAR ('editorDidDisappear')

Notifies that editor was hidden.
e.params.token assigned to Qwip token
e.params.qwipDidRemove tell if Qwip did removed

EV_PLAYER_WILL_APPEAR ('playerWillAppear')

Notifies that the inline player is about to be shown.
e.params.token assigned to Qwip token
e.params.target points to parsed element

EV_PLAYER_DID_APPEAR ('playerDidAppear')

Notifies that the inline player was shown.
e.params.token assigned to Qwip token
e.params.player points to player

EV_PLAYER_LOAD_ERROR ('playerLoadError')

Notifies that the inline player could not load Qwip.
e.params.token assigned to Qwip token
e.params.target points to empty player (so you can hide/remove it)

EV_ALL ('all')

All Qwips events