Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

ionic platform


May 22, 2021 ionic


Table of contents


ionic platform


$ionicPlatform

$ionicPlatform is used to detect current platforms, as well as, for example, overlaying android back buttons in a PhoneGap/Cordova.

Method

onHardwareBackButton(callback)

A platform with a hardware back button that you can bind to in this way.

Parameters Type Details
callback function

When the event occurs, the callback function is triggered.

offHardwareBackButton(callback)

Remove the listening event for the back button.

Parameters Type Details
callback function

The monitor function that was originally bound.

registerBackButtonAction(callback, priority, [actionId])

Register the hardware back button action. When a button is clicked, only one action is performed, so the method determines that the registered back button action has the highest priority.

For example, if a pull-up menu is already displayed, the back button should close the pull-up menu instead of returning a page view or closing an open model.

Parameters Type Details
callback function

Triggered when the return button is clicked if the monitor has the highest priority.

priority number

Only the highest priority is executed.

actionId
(Optional)
*

The id specifies this action. Default: A random and unique id.

Return value: The function, a triggered function, will log off backButtonAction.

ready([callback])

When the device is ready, a callback function is triggered.

Parameters Type Details
callback
(Optional)
function=

The function that was triggered.

Return: The promise object, which is resolved after it has been constructed successfully.