gs-mobile-cordova-plugin-jslib
Version:
GS Mobile JSLib
312 lines (96 loc) • 3.29 kB
Markdown
# Untitled Project
### gs_mobile_jslib.js
#### Utility()
This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
phone, etc.
##### Returns
- `Void`
#### Utility.getInfo(successCallback, errorCallback)
取得行動裝置資訊
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| successCallback | `Function` | The function to call when the heading data is available | |
| errorCallback | `Function` | The function to call when there is an error getting the heading data. (OPTIONAL) | |
##### Returns
- `Void`
#### Utility.leftPad(value, length)
leftPad(1,3)
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| value | `int` | 傳入值 | |
| length | `int` | n位數 | |
##### Returns
- `String` str 001
#### Utility.formatNumber(number, point)
formatNumber(1234.123, 2)
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| number | `String` | 傳入值 | |
| point | `String` | 固定小數n位 | |
##### Returns
- `String` num 1,234.12
#### Utility.yyyy2yyy()
yyyy2yyy('2020年01月02日')
##### Returns
- `String` 109年01月02日
#### Utility.yyy2yyyy()
yyyy2yyy('107年01月02日')
##### Returns
- `String` 2020年01月02日
#### Utility.getCurrentDate()
##### Returns
- `String` 109年01月02日
#### Utility.getCurrentDateDiff(diff)
getCurrentDateDiff(2) 假設當下是2020/01/03
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| diff | `String` | 欲減掉的天數 | |
##### Returns
- `String` 傳回就是2020/01/01
#### Utility.getCurrentTime()
##### Returns
- `String` 18時10分
#### Utility.getLastMonthCurrentDate(num)
假設當天是109/01/02
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| num | `String` | 往前n個月 | |
##### Returns
- `String` 回傳108/12/02
#### Utility.getNextMonthCurrentDate(num)
假設當天是109/01/02
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| num | `String` | 往後n個月 | |
##### Returns
- `String` 回傳109/02/02
#### Utility.getParameterByName(name, num)
假設網址(url)是https://a.b.c/xxx.aspx?x=val1&y=val2, getParameterByName(y,url)
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| name | `String` | 欲取得的參數名稱 | |
| num | `String` | 完整的網址 | |
##### Returns
- `String` 回傳y的值是val2
#### Utility.twd97_to_latlng($x, $y)
##### Parameters
| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| $x | `float` | TWD97 x坐標 | |
| $y | `float` | TWD97 y坐標 | |
##### Returns
- `array` 回傳WGS84坐標陣列
#### String.trim()
##### Returns
- `String`
#### Math.Round()
##### Returns
- `float`
*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*