MobileUI API

 MobileUI API is mainly composed of the following elements:

  • deviceReady
  • Object mui
  • Class ViewPort

deviceReady 

deviceReady

Is invoked once the app, Cordova / Phonegap and MobileUI are ready.

mui Object

mui.screen

Returns the "mui-screen" viewport.

mui.viewport

Returns the "mui.viewport" viewport.

mui.getViewport()

Returns a viewport from its name.

mui.createViewport()

Creates a viewport and registers it.

mui.registerViewport()

Registers a viewport already created.

mui.removeViewport

Removes a viewport.

mui.getAllViewports

Returns an array with all the register viewports.

mui.version

Returns MobileUI version.

mui.isMobileDevice

Indicates if the application is running on a mobile device and on which platform.

mui.isPortrait()

Indicates if the device is in a vertical position.

mui.isLandscape()

Indicates if the device is in a horizontal position.

mui.isTablet()

Indicates if the device is a tablet.

mui.isPhone()

Indicates if the device is a Smartphone.

mui.cordovaAvailable()

Indicates if Cordova / Phonegap is available. Useful to determine whether is an App or WebApp.

mui.cordova()

Returns the corresponding Cordova or Phonegap object.

mui.alert()

Displays an alert box with a personalized message.

mui.toast()

Displays a message, not intrusive, that automatically disappear.

mui.confirm()

Displays a custom dialog box confirmation.

mui.prompt()

Presents a dialog box, native and personalized, requesting information.

mui.busy()

Presents a busy indicator on the screen blocking the interaction.

mui.beep()

Emits a beep.

mui.vibrate()

Vibrates the device.

mui.dialNumber()

Mark a certain number to initiate a call.

mui.sendSms()

Send a text message.

mui.localStorage

Provides a set of methods for storing data locally on the device in plain text or JSON.

mui.connectionAvailable()

Indicates whether the device is connected to the network or not.

mui.getConnectionType()

Returns the connection type to the network.

mui.history()

Provides a set of methods to access the browsing history.

mui.util()

Provides a set of utility methods.

mui.ajax()

Performs an asynchronous HTTP request (Ajax) to obtain data from a server.

Viewport Class

 Methods

showPage()

Presents a new page with specific transition effect.

showPanel()

Presents a panel with a specific transition effect.

panelIsOpen()

Indicates if there is an open panel.

closePanel()

Closes the open panel.

refreshScroll()

Refreshes the scroll to a specific page or the entire viewport.

installScroll()

Install the scroll on the viewport

removeScroll()

Uninstall the scroll of all viewport elements or one in particular.

putCoverShield()

Put a shield on the viewport to avoid any interaction.

removeCoverShield()

Remove the shield on the viewport.

blur()

Produces a blurring effect on the current page of the viewport.

unblur()

Eliminates blur effect established with blur ().

getCurrentPageId()

Returns the id of the current page viewport.

getCurrentPanelId()

Returns the id of the panel being displayed on the viewport.

centerElement()

Center an element on the viewport.

 Events

resize

Triggers an event 

on showpage

Triggers an event each time a new page is displayed

on preshowpage

Triggers an event when it will show a page

on swipe

Triggers an event

on swipeleft

Triggers an event

on swiperight

Triggers an event

on swipeup

Triggers an event

on swipedown

Triggers an event

on swipeleftdiscover

Triggers an event

on swiperightdiscover

Triggers an event

Transition of page and panels

Introduction to MobileUI