Log In

Action Object

All action callbacks return the Action Object with the same format. The available action names can be found in

{
  "detail": {
    "action_name": "action_message"
  }
}

Handle Custom Action

//
// Method invoked when a custom action is invoked.
//
MOCA.addCustomActionListener (function (e) {
	e.detail.customAction; // string with custom action
});

Handle Simple Message Action

//
// Method invoked when a message action is invoked.
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No message will be shown)
//
MOCA.addDisplayAlertListener (false, function (e) {
	e.detail.displayAlert // String with Message to show
});

Handle Open URL Action

//
// Method invoked when an "open url" action is invoked.
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No webview will be shown)
//
MOCA.addOpenUrlListener (false, function (e) {
	e.detail.openUrl // String with URL
});
//

Handle Show HTML Action

//
// Method invoked when an embedded html action is invoked.
//
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No webview will be shown)
//
MOCA.addShowEmbeddedHtmlListener (false, function (e) {
	e.detail.showEmbeddedHtml // String with embedded HTML
});

Handle Video Action

//
// Method invoked when a video action is invoked.
//
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No video will be played)
//
MOCA.addPlayVideoListener (false, function (e) {
	e.detail.playVideo // String with video URL
});

Handle Image Action

//
// Method invoked when a image action is invoked.
//
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No image will be shown)
//
MOCA.addShowImageListener (false, function (e) {
	e.detail.showImage // String with Image URL
});

Handle Passbook Action

//
// Method invoked when a passbook action is invoked.
//
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No passbook will be shown)
//
MOCA.addAddPassbookListener (false, function (e) {
	e.detail.addPassbook // String with Passbook URL
});

Handle Tag Action

//
// Method invoked when a tag action is invoked.
//
MOCA.addAddTagListener (function (e) {
	e.detail.addTag // JSONObject with tagName and tagValue
});

Handle Sound Action

//
// Method invoked when a sound action is invoked.
//
//
// args: (false, callback) to allow MOCA to show the experience.
//       (true, callback) to prevent MOCA from showing the experience. (No sound will be played)
//
MOCA.addPlaySoundListener (false, function (e) {
	e.detail.playSound // String with sound path
});