Javascript APIEventsYou can bind your own callbacks to any blurts events, like this:
var myCallback = function(e, callback_params) {
// event handler code goes here
};
where:
callback_params is callback_params passed to blurts.bind function e is blurts' event object: e.event - event name e.params - event parameters (may be empty) Event names can be passed to blurts.bind or blurts.unbind as strings or as blurts' constants.
blurts.bind(blurts.EV_ALL, function(e){
if(e.event == blurts.EV_RECORD_BTN_CLICK)
;// do something
else if(e.event == 'playerLoadError')
console.error("Failed to load blurt with token", e.params.token);
});
blurts.bind( event, callback [,callback_params] )Bind callback to specified blurts 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
blurts.bind('recorderWillAppear', myHandler);
// bind callback to multiple events
blurts.bind('recorderWillAppear recorderWillDisappear', myHandler);
// same as previous
blurts.bind([ 'recorderWillAppear', 'recorderWillDisappear' ], myHandler);
// same as previous
blurts.bind([ blurts.EV_RECORDER_WILL_APPEAR,
blurts.EV_RECORDER_WILL_DISAPPEAR ], myHandler);
// bind callback to all events
blurts.bind(blurts.EV_ALL, myHandler);
// bind callback to all events with callback_params
blurts.bind(blurts.EV_ALL, myHandler, [4,8,15,16,23,42]);
blurts.unbind( event [,callback] )Unbind callback from specified blurts 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
blurts.unbind('recorderWillAppear');
// unbind callback from multiple events
blurts.unbind('recorderWillAppear recorderWillDisappear', myEventCallback);
// unbind all callback from all events
blurts.unbind(blurts.EV_ALL);
Event typesEV_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 blurt editor is about to be shown.
e.params.token assigned to blurt token EV_EDITOR_DID_APPEAR ('editorDidAppear')Notifies that the blurt editor was shown.
e.params.token assigned to blurt token EV_EDITOR_WILL_DISAPPEAR ('editorWillDisappear')Notifies that record player is about to be hidden.
e.params.token assigned to blurt token e.params.blurtWillRemove tell if blurt will removed EV_EDITOR_DID_DISAPPEAR ('editorDidDisappear')Notifies that editor was hidden.
e.params.token assigned to blurt token e.params.blurtDidRemove tell if blurt did removed EV_PLAYER_WILL_APPEAR ('playerWillAppear')Notifies that the inline player is about to be shown.
e.params.token assigned to blurt 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 blurt token e.params.player points to player EV_PLAYER_LOAD_ERROR ('playerLoadError')Notifies that the inline player could not load blurt.
e.params.token assigned to blurt token e.params.target points to empty player (so you can hide/remove it) EV_ALL ('all')All blurts events
|
API DocumentationJavascript API
CSS API |