Utils
A collection of general purpose utility functions which can be used independently from Mobiscroll component instances.
1. Platform
mobiscroll.platform
Description
Information about the current platform.
Name | Type | Description |
---|---|---|
name | String |
Possible values:
|
majorVersion | Number | The major version of the platform |
minorVersion | Number | The minor version of the platform |
2. Format Date
mobiscroll.util.datetime.formatDate(format, date[, settings = {}])
Description
Format a date into a string value with a specified format.
// Produces '2015-02-19'
mobiscroll.util.datetime.formatDate('yy-mm-dd', new Date(2015, 1, 19));
Parameters
3. Parse Date
mobiscroll.util.datetime.parseDate(format, value[, settings = {}])
Description
Extract a date from a string value with a specified format.
mobiscroll.util.datetime.parseDate('yy-mm-dd', '2015-02-19'));
Parameters
4. Vibrate
mobiscroll.util.vibrate([time = 50])
Description
Vibrates the device with the specified duration. It checks if the browser/device supports the vibration API, so no additional check is needed.
// Vibrates 200 milliseconds
mobiscroll.util.vibrate(200);
Parameters
Name | Type | Default | Description |
---|---|---|---|
time | Number | 50 | Number of milliseconds to vibrate. |