Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
169 lines (110 sloc) 4.88 KB

JavaScript API

The JavaScript module axemas.js permits interaction with the native code of the application:

  • goto
  • gotoFromSidebar
  • call
  • alert
  • dialog
  • showProgressHUD
  • hideProgressHUD
  • getPlatform
  • platformDetails
  • storeData
  • fetchData
  • removeData
  • log


Pushes new section on the navigation stack. It is the equivalent of the iOS [NavigationSectionsManager goto] and Android's NavigationSectionsManager.goTo(). All three functions accept a dictionary as payload which defines the extra actions the goto call must execute:

    "stackMaintainedElements": 0,
    "stackPopElements": 0}

The payload structure is shared between JavaScript, Objective C and Java, and accepts the following parameters:

  • url contains the local or remote address from which the WebView must load the content
  • title (optional) is the tile show in the application's ViewController / Action Bar.
  • toggleSidebarIcon (optional) is the sidebar's icon to be displayed and if missing a button to open the sidebar will not be created
  • actionbarRightIcon (optional) icon to display as a button on the right of the actionbar inside the target section, pressing the button triggers the navigationbarRightButtonAction event on section controllers.
  • stackMaintainedElements (optional) instructs the navigation stack to pop all views and maintain the last X sections indicated on the bottom of the stack; it is ill advised to use in conjunction with stackPopElements
  • stackPopElements (optional) instructs the navigation stack to pop the first X sections; it is ill advised to use in conjunction with stackMaintainedElements
  • animation (optional) only supported on iOS platform, can be used to change the default push/pop animation in one of "fade" or "slidein" values


Same as goto but closes the sidebar and must be used only inside the sidebar section. Refer to goto:

    "stackMaintainedElements": 0,
    "stackPopElements": 0}


The call enables JavaScript to execute a native registered handler inside a SectionController:'openNativeController');'execute-and-return', '{"payload": "something"}', function(result) {


Creates a native dismissible alert dialog with a title and a message:

axemas.alert('Alert title', "Alert message");


Generates a native dialog with a title, a message and a maximum of three buttons. When pressing a button a callback returns the button's value as integer, range [0-3]:

axemas.dialog('Dialog title', 'Dialog display message', ['Cancel', 'Ok'],function(data) {
    axemas.alert('Pressed button', data.button);


Locks interface interaction by displaying a spinner on the screen. The same spinner is always displayed when lading the contents of a page inside a section:



Used to dismiss a previously displayed progressHUD:



Uses the navigator.userAgent object to determine if the current platform. Returns Android, iOS or unsupported:

if (axemas.getPlatform() == 'your_platform') {
    //do something


Getting information about device: model, systemName and systemVersion.

For example:

axemas.platformDetails(function(device_info) {

// Example of the device_infor

//iOS Device
{model: "iPhone", systemVersion: "9.3", systemName: "iPhone OS"}

//Android Device
{model: "Nexus 5", systemName: "Android", systemVersion: "6.0.1"}


Uses the Native/WebView's localSotrage for key/value storing. Data stored will be available next time the application is launched:



Returns a previously stored value providing a key:

var value = axemas.fetchData("key");


Permanently removes the previously saved data from the locationStorage:



Utility for use native and javascript log system:

axemas.log("Hello World");


axemas.log({'tag': 'CustomTAG', 'message': "Hello World"});
  • tag is the tag for Android, default is AXEMAS_LOG
  • message is the message of the log as String