native-fn 1.1.9 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +488 -146
- package/dist/index.d.ts +138 -119
- package/dist/native.cjs +661 -565
- package/dist/native.min.cjs +1 -1
- package/dist/native.min.mjs +1 -1
- package/dist/native.mjs +661 -565
- package/dist/native.umd.js +661 -565
- package/dist/native.umd.min.js +1 -1
- package/dist/plugin/appearance/index.cjs +8 -3
- package/dist/plugin/appearance/index.mjs +8 -3
- package/dist/plugin/appearance/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/appearance/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/appearance/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/appearance/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/appearance/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/appearance/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/appearance/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/appearance/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/appearance/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/badge/index.cjs +2 -2
- package/dist/plugin/badge/index.d.ts +1 -1
- package/dist/plugin/badge/index.mjs +2 -2
- package/dist/plugin/badge/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/badge/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/badge/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/badge/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/badge/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/badge/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/badge/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/badge/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/badge/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/battery/index.cjs +3 -3
- package/dist/plugin/battery/index.d.ts +1 -1
- package/dist/plugin/battery/index.mjs +3 -3
- package/dist/plugin/battery/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/battery/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/battery/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/battery/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/battery/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/battery/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/battery/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/battery/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/battery/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/clipboard/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/clipboard/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/clipboard/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/clipboard/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/clipboard/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/clipboard/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/clipboard/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/clipboard/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/clipboard/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/dimension/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/dimension/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/dimension/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/dimension/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/dimension/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/dimension/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/dimension/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/dimension/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/dimension/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/fullscreen/index.cjs +539 -266
- package/dist/plugin/fullscreen/index.d.ts +20 -10
- package/dist/plugin/fullscreen/index.mjs +539 -266
- package/dist/plugin/fullscreen/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/fullscreen/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/fullscreen/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/fullscreen/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/fullscreen/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/fullscreen/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/fullscreen/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/fullscreen/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/fullscreen/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/geolocation/index.cjs +6 -0
- package/dist/plugin/geolocation/index.d.ts +1 -1
- package/dist/plugin/geolocation/index.mjs +6 -0
- package/dist/plugin/geolocation/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/geolocation/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/geolocation/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/geolocation/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/geolocation/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/geolocation/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/geolocation/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/geolocation/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/geolocation/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/notification/index.cjs +6 -0
- package/dist/plugin/notification/index.mjs +6 -0
- package/dist/plugin/notification/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/notification/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/notification/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/notification/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/notification/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/notification/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/notification/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/notification/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/notification/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/open/index.cjs +128 -123
- package/dist/plugin/open/index.d.ts +35 -35
- package/dist/plugin/open/index.mjs +128 -123
- package/dist/plugin/open/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/open/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/open/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/open/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/open/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/open/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/open/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/open/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/open/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/open/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/open/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/open/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/permission/index.cjs +6 -0
- package/dist/plugin/permission/index.d.ts +1 -0
- package/dist/plugin/permission/index.mjs +6 -0
- package/dist/plugin/permission/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/permission/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/permission/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/permission/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/permission/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/permission/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/permission/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/permission/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/permission/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/pip/index.cjs +651 -268
- package/dist/plugin/pip/index.d.ts +22 -12
- package/dist/plugin/pip/index.mjs +651 -268
- package/dist/plugin/pip/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/pip/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/pip/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/pip/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/pip/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/pip/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/pip/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/pip/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/pip/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/platform/index.cjs +8 -3
- package/dist/plugin/platform/index.d.ts +5 -5
- package/dist/plugin/platform/index.mjs +8 -3
- package/dist/plugin/platform/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/platform/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/platform/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/platform/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/platform/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/platform/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/platform/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/platform/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/platform/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/theme/index.cjs +8 -3
- package/dist/plugin/theme/index.mjs +8 -3
- package/dist/plugin/theme/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/theme/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/theme/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/theme/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/theme/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/theme/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/theme/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/theme/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/theme/src/types/subscription-manager.d.ts +1 -1
- package/dist/plugin/vibration/index.cjs +5 -5
- package/dist/plugin/vibration/index.d.ts +1 -1
- package/dist/plugin/vibration/index.mjs +5 -5
- package/dist/plugin/vibration/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/plugin/vibration/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/plugin/vibration/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/plugin/vibration/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/open/types/open.d.ts +1 -1
- package/dist/plugin/vibration/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/plugin/vibration/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/plugin/vibration/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/plugin/vibration/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/plugin/vibration/src/types/subscription-manager.d.ts +1 -1
- package/dist/src/errors/invalid-state-error.d.ts +2 -0
- package/dist/src/plugin/badge/types/badge.d.ts +1 -1
- package/dist/src/plugin/battery/types/battery.d.ts +1 -1
- package/dist/src/plugin/fullscreen/cores/index.d.ts +3 -3
- package/dist/src/plugin/fullscreen/types/fullscreen.d.ts +15 -6
- package/dist/src/plugin/geolocation/types/geolocation.d.ts +1 -1
- package/dist/src/plugin/open/types/open.d.ts +1 -1
- package/dist/src/plugin/permission/types/permission.d.ts +1 -0
- package/dist/src/plugin/pip/cores/index.d.ts +6 -6
- package/dist/src/plugin/pip/types/pip.d.ts +14 -5
- package/dist/src/plugin/vibration/types/vibration.d.ts +1 -1
- package/dist/src/types/subscription-manager.d.ts +1 -1
- package/package.json +21 -13
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# native-fn API Reference
|
|
2
|
-
|
|
2
|
+
<a href="https://www.npmjs.com/package/native-fn"></a><br/>
|
|
3
3
|
<a href="https://www.npmjs.com/package/native-fn"></a>
|
|
4
4
|
<a href="https://www.npmjs.com/package/native-fn"></a>
|
|
5
|
-
<a href="https://github.com/pjy0509/native-fn
|
|
5
|
+
<a href="https://github.com/pjy0509/native-fn"></a>
|
|
6
6
|
<br/>
|
|
7
|
-
<a href="https://www.jsdelivr.com/package/npm/native-fn" target="_blank"><img alt="jsDelivr" src="
|
|
8
|
-
<a href="https://www.npmjs.com/package/native-fn" target="_blank"><img alt="npm" src="
|
|
9
|
-
<a href="https://github.com/pjy0509/native-fn
|
|
7
|
+
<a href="https://www.jsdelivr.com/package/npm/native-fn" target="_blank"><img alt="jsDelivr" src="https://www.google.com/s2/favicons?sz=16&domain=www.jsdelivr.com/"></a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/native-fn" target="_blank"><img alt="npm" src="https://www.google.com/s2/favicons?sz=16&domain=www.npmjs.com/"></a>
|
|
9
|
+
<a href="https://github.com/pjy0509/native-fn" target="_blank"><img alt="repository" src="https://www.google.com/s2/favicons?sz=16&domain=https://github.com/pjy0509/native-fn.git/"></a>
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
**npm**
|
|
@@ -21,7 +21,7 @@ npm i native-fn
|
|
|
21
21
|
yarn add native-fn
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
**
|
|
24
|
+
**unpkg**
|
|
25
25
|
|
|
26
26
|
```html
|
|
27
27
|
<script src="https://unpkg.com/native-fn"></script>
|
|
@@ -39,9 +39,11 @@ yarn add native-fn
|
|
|
39
39
|
- [value](#appearance-value)
|
|
40
40
|
- [onChange](#appearance-onchange)
|
|
41
41
|
- **[badge](#badge)**
|
|
42
|
+
- [supported](#badge-supported)
|
|
42
43
|
- [set](#badge-set)
|
|
43
44
|
- [clear](#badge-clear)
|
|
44
45
|
- **[battery](#battery)**
|
|
46
|
+
- [supported](#battery-supported)
|
|
45
47
|
- [value](#battery-value)
|
|
46
48
|
- [onChange](#battery-onchange)
|
|
47
49
|
- **[clipboard](#clipboard)**
|
|
@@ -52,15 +54,19 @@ yarn add native-fn
|
|
|
52
54
|
- [environment](#dimension-environment)
|
|
53
55
|
- [onChange](#dimension-onchange)
|
|
54
56
|
- **[fullscreen](#fullscreen)**
|
|
57
|
+
- [supported](#fullscreen-supported)
|
|
58
|
+
- [element](#fullscreen-element)
|
|
59
|
+
- [isActive](#fullscreen-isActive)
|
|
55
60
|
- [request](#fullscreen-request)
|
|
56
61
|
- [exit](#fullscreen-exit)
|
|
57
|
-
- [toggle](#fullscreen-toggle)
|
|
58
62
|
- [onChange](#fullscreen-onchange)
|
|
59
63
|
- [onError](#fullscreen-onerror)
|
|
60
64
|
- **[geolocation](#geolocation)**
|
|
65
|
+
- [supported](#geolocation-supported)
|
|
61
66
|
- [value](#geolocation-value)
|
|
62
67
|
- [onChange](#geolocation-onchange)
|
|
63
68
|
- **[notification](#notification)**
|
|
69
|
+
- [supported](#notification-supported)
|
|
64
70
|
- [send](#notification-send)
|
|
65
71
|
- **[open](#open)**
|
|
66
72
|
- [app](#open-app)
|
|
@@ -75,12 +81,15 @@ yarn add native-fn
|
|
|
75
81
|
- [share](#open-share)
|
|
76
82
|
- [calendar](#open-calendar)
|
|
77
83
|
- **[permission](#permission)**
|
|
84
|
+
- [supported](#permission-supported)
|
|
78
85
|
- [request](#permission-request)
|
|
79
86
|
- [check](#permission-check)
|
|
80
87
|
- **[pip](#pip)**
|
|
88
|
+
- [supported](#pip-supported)
|
|
89
|
+
- [element](#pip-element)
|
|
90
|
+
- [isActive](#pip-isActive)
|
|
81
91
|
- [request](#pip-request)
|
|
82
92
|
- [exit](#pip-exit)
|
|
83
|
-
- [toggle](#pip-toggle)
|
|
84
93
|
- [onChange](#pip-onchange)
|
|
85
94
|
- [onError](#pip-onerror)
|
|
86
95
|
- **[platform](#platform)**
|
|
@@ -98,6 +107,7 @@ yarn add native-fn
|
|
|
98
107
|
- **[theme](#theme)**
|
|
99
108
|
- [value](#theme-value)
|
|
100
109
|
- **[vibration](#vibration)**
|
|
110
|
+
- [supported](#vibration-supported)
|
|
101
111
|
- [run](#vibration-run)
|
|
102
112
|
- [stop](#vibration-stop)
|
|
103
113
|
|
|
@@ -174,7 +184,39 @@ unsubscribe();
|
|
|
174
184
|
|
|
175
185
|
## badge
|
|
176
186
|
|
|
177
|
-
[`set`](#badge-set) · [`clear`](#badge-clear)
|
|
187
|
+
[`supported`](#badge-supported) · [`set`](#badge-set) · [`clear`](#badge-clear)
|
|
188
|
+
|
|
189
|
+
<h3 id="badge-supported"><code>badge.supported</code></h3>
|
|
190
|
+
|
|
191
|
+
**Signature**
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
get supported(): boolean
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Returns whether badge is supported in the current environment.
|
|
198
|
+
|
|
199
|
+
**Example**
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
if (Native.badge.supported) {
|
|
203
|
+
await Native.badge.set(5);
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Returns**
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
boolean
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
// true — badge API support,
|
|
216
|
+
// false — no badge support
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
178
220
|
|
|
179
221
|
<h3 id="badge-set"><code>badge.set</code></h3>
|
|
180
222
|
|
|
@@ -240,7 +282,41 @@ throw new NotSupportedError // navigator.setAppBadge unavailable
|
|
|
240
282
|
|
|
241
283
|
## battery
|
|
242
284
|
|
|
243
|
-
[`value`](#battery-value) · [`onChange`](#battery-onchange)
|
|
285
|
+
[`supported`](#battery-supported) · [`value`](#battery-value) · [`onChange`](#battery-onchange)
|
|
286
|
+
|
|
287
|
+
<h3 id="battery-supported"><code>battery.supported</code></h3>
|
|
288
|
+
|
|
289
|
+
**Signature**
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
get supported(): boolean
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Returns whether battery is supported in the current environment.
|
|
296
|
+
|
|
297
|
+
**Example**
|
|
298
|
+
|
|
299
|
+
```ts
|
|
300
|
+
if (Native.battery.supported) {
|
|
301
|
+
const battery = await Native.battery.value;
|
|
302
|
+
|
|
303
|
+
console.log(battery.level); // 0.0 – 1.0
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
**Returns**
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
boolean
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
// true — battery API support,
|
|
316
|
+
// false — no battery support
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
244
320
|
|
|
245
321
|
<h3 id="battery-value"><code>battery.value</code></h3>
|
|
246
322
|
|
|
@@ -577,7 +653,99 @@ unsubscribe();
|
|
|
577
653
|
|
|
578
654
|
## fullscreen
|
|
579
655
|
|
|
580
|
-
[`
|
|
656
|
+
[`supported`](#fullscreen-supported) · [`element`](#fullscreen-element) · [`isActive`](#fullscreen-isActive) · [`request`](#fullscreen-request) · [`exit`](#fullscreen-exit) · [`onChange`](#fullscreen-onchange) · [`onError`](#fullscreen-onerror)
|
|
657
|
+
|
|
658
|
+
<h3 id="fullscreen-supported"><code>fullscreen.supported</code></h3>
|
|
659
|
+
|
|
660
|
+
**Signature**
|
|
661
|
+
|
|
662
|
+
```ts
|
|
663
|
+
get supported(): boolean
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
Returns whether fullscreen is supported in the current environment.
|
|
667
|
+
|
|
668
|
+
**Example**
|
|
669
|
+
|
|
670
|
+
```ts
|
|
671
|
+
if (Native.fullscreen.supported) {
|
|
672
|
+
await Native.fullscreen.request();
|
|
673
|
+
}
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
**Returns**
|
|
677
|
+
|
|
678
|
+
```ts
|
|
679
|
+
boolean
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
```ts
|
|
684
|
+
// true — standard or vendor-prefixed fullscreen API detected,
|
|
685
|
+
// or iOS video with webkitSupportsFullscreen
|
|
686
|
+
// false — no fullscreen support
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
<h3 id="fullscreen-element"><code>fullscreen.element</code></h3>
|
|
692
|
+
|
|
693
|
+
**Signature**
|
|
694
|
+
|
|
695
|
+
```ts
|
|
696
|
+
get element(): Element | null
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Returns the element currently displayed in fullscreen, or null if not in fullscreen.
|
|
700
|
+
|
|
701
|
+
**Example**
|
|
702
|
+
|
|
703
|
+
```ts
|
|
704
|
+
const el = Native.fullscreen.element;
|
|
705
|
+
|
|
706
|
+
if (el !== null) {
|
|
707
|
+
console.log(el.tagName); // e.g. 'VIDEO', 'DIV'
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
**Returns**
|
|
712
|
+
|
|
713
|
+
```ts
|
|
714
|
+
Element | null
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
```ts
|
|
719
|
+
// Element — the current fullscreen element
|
|
720
|
+
// null — not in fullscreen
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
<h3 id="fullscreen-isActive"><code>fullscreen.isActive</code></h3>
|
|
726
|
+
|
|
727
|
+
**Signature**
|
|
728
|
+
|
|
729
|
+
```ts
|
|
730
|
+
get isActive(): boolean
|
|
731
|
+
```
|
|
732
|
+
|
|
733
|
+
Returns whether fullscreen is currently active.
|
|
734
|
+
|
|
735
|
+
**Example**
|
|
736
|
+
|
|
737
|
+
```ts
|
|
738
|
+
console.log(Native.fullscreen.isActive); // true | false
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
**Returns**
|
|
742
|
+
|
|
743
|
+
```ts
|
|
744
|
+
boolean
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
---
|
|
581
749
|
|
|
582
750
|
<h3 id="fullscreen-request"><code>fullscreen.request</code></h3>
|
|
583
751
|
|
|
@@ -587,29 +755,27 @@ unsubscribe();
|
|
|
587
755
|
request(target?: Element, options?: FullscreenOptions): Promise<void>
|
|
588
756
|
```
|
|
589
757
|
|
|
590
|
-
Requests fullscreen for an element.
|
|
758
|
+
Requests fullscreen for an element.
|
|
591
759
|
|
|
592
760
|
**Flowchart**
|
|
593
761
|
|
|
594
762
|
```mermaid
|
|
595
763
|
flowchart TD
|
|
596
|
-
A([Fullscreen.request called]) --> B
|
|
597
|
-
B
|
|
598
|
-
|
|
599
|
-
C
|
|
600
|
-
D
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
G
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
L -->|no| N([Throw NotSupportedError])
|
|
612
|
-
D --> O[drainPendingOperation on settle]
|
|
764
|
+
A([Fullscreen.request called]) --> B{target defined?}
|
|
765
|
+
B -->|no| C[getDefaultTarget]
|
|
766
|
+
B -->|yes| D{api available?}
|
|
767
|
+
C --> D
|
|
768
|
+
D -->|yes| E[Call element api.request]
|
|
769
|
+
D -->|no| F[fallbackToIOSVideo]
|
|
770
|
+
E --> G{Promise returned?}
|
|
771
|
+
G -->|yes| H{Resolved?}
|
|
772
|
+
H -->|yes| I([resolve])
|
|
773
|
+
H -->|no| F
|
|
774
|
+
G -->|no| I
|
|
775
|
+
F --> J{iOS + VIDEO + webkitSupportsFullscreen?}
|
|
776
|
+
J -->|yes| K[video.webkitEnterFullscreen]
|
|
777
|
+
K --> I
|
|
778
|
+
J -->|no| L([Throw NotSupportedError])
|
|
613
779
|
```
|
|
614
780
|
|
|
615
781
|
**Example**
|
|
@@ -623,10 +789,6 @@ await Native.fullscreen.request(document.getElementById('player'));
|
|
|
623
789
|
|
|
624
790
|
// With options
|
|
625
791
|
await Native.fullscreen.request(element, { navigationUI: 'hide' });
|
|
626
|
-
|
|
627
|
-
// Concurrent calls — safely queued, not dropped
|
|
628
|
-
Native.fullscreen.request(document.querySelector('video#a'));
|
|
629
|
-
Native.fullscreen.request(document.querySelector('video#b'));
|
|
630
792
|
```
|
|
631
793
|
|
|
632
794
|
**Returns**
|
|
@@ -644,6 +806,9 @@ throw new NotSupportedError // element does not support fullscreen
|
|
|
644
806
|
```ts
|
|
645
807
|
throw new NotSupportedError // iOS video lacks webkitEnterFullscreen
|
|
646
808
|
```
|
|
809
|
+
```ts
|
|
810
|
+
throw new InvalidStateError // iOS video not yet played
|
|
811
|
+
```
|
|
647
812
|
|
|
648
813
|
---
|
|
649
814
|
|
|
@@ -655,28 +820,26 @@ throw new NotSupportedError // iOS video lacks webkitEnterFullscreen
|
|
|
655
820
|
exit(): Promise<void>
|
|
656
821
|
```
|
|
657
822
|
|
|
658
|
-
Exits fullscreen.
|
|
823
|
+
Exits fullscreen.
|
|
659
824
|
|
|
660
825
|
**Flowchart**
|
|
661
826
|
|
|
662
827
|
```mermaid
|
|
663
828
|
flowchart TD
|
|
664
|
-
A([Fullscreen.exit called]) --> B
|
|
665
|
-
B
|
|
666
|
-
|
|
667
|
-
C
|
|
668
|
-
|
|
669
|
-
F -->|yes|
|
|
670
|
-
F -->|no|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
H
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
M --> K
|
|
679
|
-
L -->|no| N([Throw NotSupportedError])
|
|
829
|
+
A([Fullscreen.exit called]) --> B{api available?}
|
|
830
|
+
B -->|yes| C[Call document api.exit]
|
|
831
|
+
B -->|no| D[fallbackToIOSVideo]
|
|
832
|
+
C --> E{Promise returned?}
|
|
833
|
+
E -->|yes| F{Resolved?}
|
|
834
|
+
F -->|yes| G([resolve])
|
|
835
|
+
F -->|no| D
|
|
836
|
+
E -->|no| G
|
|
837
|
+
D --> H{iOS + displaying fullscreen video found?}
|
|
838
|
+
H -->|yes| I[webkitExitFullscreen]
|
|
839
|
+
I --> G
|
|
840
|
+
H -->|no| J{getElement null?}
|
|
841
|
+
J -->|yes| G
|
|
842
|
+
J -->|no| K([Throw NotSupportedError])
|
|
680
843
|
```
|
|
681
844
|
|
|
682
845
|
**Example**
|
|
@@ -700,59 +863,59 @@ throw new NotSupportedError // failed to exit fullscreen
|
|
|
700
863
|
|
|
701
864
|
---
|
|
702
865
|
|
|
703
|
-
<h3 id="fullscreen-
|
|
866
|
+
<h3 id="fullscreen-onchange"><code>fullscreen.onChange</code></h3>
|
|
704
867
|
|
|
705
868
|
**Signature**
|
|
706
869
|
|
|
707
870
|
```ts
|
|
708
|
-
|
|
871
|
+
onChange(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void
|
|
709
872
|
```
|
|
710
873
|
|
|
711
|
-
|
|
874
|
+
Subscribes to fullscreen state changes.
|
|
712
875
|
|
|
713
876
|
**Example**
|
|
714
877
|
|
|
715
878
|
```ts
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
//
|
|
720
|
-
btn.addEventListener('click', () => {
|
|
721
|
-
Native.fullscreen.toggle(document.getElementById('player'));
|
|
879
|
+
const unsubscribe = Native.fullscreen.onChange((payload) => {
|
|
880
|
+
console.log(payload.isActive); // true | false
|
|
881
|
+
console.log(payload.element); // Element
|
|
882
|
+
console.log(payload.nativeEvent); // Event
|
|
722
883
|
});
|
|
884
|
+
|
|
885
|
+
unsubscribe();
|
|
723
886
|
```
|
|
724
887
|
|
|
725
888
|
**Returns**
|
|
726
889
|
|
|
727
890
|
```ts
|
|
728
|
-
|
|
891
|
+
() => void
|
|
729
892
|
```
|
|
730
893
|
|
|
731
894
|
|
|
732
|
-
**Throws**
|
|
733
|
-
|
|
734
895
|
```ts
|
|
735
|
-
|
|
896
|
+
// call to remove the listener
|
|
897
|
+
unsubscribe();
|
|
736
898
|
```
|
|
737
899
|
|
|
738
900
|
---
|
|
739
901
|
|
|
740
|
-
<h3 id="fullscreen-
|
|
902
|
+
<h3 id="fullscreen-onerror"><code>fullscreen.onError</code></h3>
|
|
741
903
|
|
|
742
904
|
**Signature**
|
|
743
905
|
|
|
744
906
|
```ts
|
|
745
|
-
|
|
907
|
+
onError(listener: (payload: FullscreenEventPayload) => void, options?: AddEventListenerOptions): () => void
|
|
746
908
|
```
|
|
747
909
|
|
|
748
|
-
Subscribes to fullscreen
|
|
910
|
+
Subscribes to fullscreen errors.
|
|
749
911
|
|
|
750
912
|
**Example**
|
|
751
913
|
|
|
752
914
|
```ts
|
|
753
|
-
const unsubscribe = Native.fullscreen.
|
|
754
|
-
console.log(
|
|
755
|
-
console.log(
|
|
915
|
+
const unsubscribe = Native.fullscreen.onError((payload) => {
|
|
916
|
+
console.log(payload.isActive); // boolean
|
|
917
|
+
console.log(payload.element); // Element
|
|
918
|
+
console.log(payload.nativeEvent); // Event
|
|
756
919
|
});
|
|
757
920
|
|
|
758
921
|
unsubscribe();
|
|
@@ -772,44 +935,44 @@ unsubscribe();
|
|
|
772
935
|
|
|
773
936
|
---
|
|
774
937
|
|
|
775
|
-
|
|
938
|
+
## geolocation
|
|
939
|
+
|
|
940
|
+
[`supported`](#geolocation-supported) · [`value`](#geolocation-value) · [`onChange`](#geolocation-onchange)
|
|
941
|
+
|
|
942
|
+
<h3 id="geolocation-supported"><code>geolocation.supported</code></h3>
|
|
776
943
|
|
|
777
944
|
**Signature**
|
|
778
945
|
|
|
779
946
|
```ts
|
|
780
|
-
|
|
947
|
+
get supported(): boolean
|
|
781
948
|
```
|
|
782
949
|
|
|
783
|
-
|
|
950
|
+
Returns whether geolocation is supported in the current environment.
|
|
784
951
|
|
|
785
952
|
**Example**
|
|
786
953
|
|
|
787
954
|
```ts
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
});
|
|
955
|
+
if (Native.geolocation.supported) {
|
|
956
|
+
const coords = await Native.geolocation.value;
|
|
791
957
|
|
|
792
|
-
|
|
958
|
+
console.log(coords.latitude, coords.longitude);
|
|
959
|
+
}
|
|
793
960
|
```
|
|
794
961
|
|
|
795
962
|
**Returns**
|
|
796
963
|
|
|
797
964
|
```ts
|
|
798
|
-
|
|
965
|
+
boolean
|
|
799
966
|
```
|
|
800
967
|
|
|
801
968
|
|
|
802
969
|
```ts
|
|
803
|
-
//
|
|
804
|
-
|
|
970
|
+
// true — geolocation API support,
|
|
971
|
+
// false — no geolocation support
|
|
805
972
|
```
|
|
806
973
|
|
|
807
974
|
---
|
|
808
975
|
|
|
809
|
-
## geolocation
|
|
810
|
-
|
|
811
|
-
[`value`](#geolocation-value) · [`onChange`](#geolocation-onchange)
|
|
812
|
-
|
|
813
976
|
<h3 id="geolocation-value"><code>geolocation.value</code></h3>
|
|
814
977
|
|
|
815
978
|
**Signature**
|
|
@@ -914,7 +1077,43 @@ unsubscribe();
|
|
|
914
1077
|
|
|
915
1078
|
## notification
|
|
916
1079
|
|
|
917
|
-
[`send`](#notification-send)
|
|
1080
|
+
[`supported`](#notification-supported) · [`send`](#notification-send)
|
|
1081
|
+
|
|
1082
|
+
<h3 id="notification-supported"><code>notification.supported</code></h3>
|
|
1083
|
+
|
|
1084
|
+
**Signature**
|
|
1085
|
+
|
|
1086
|
+
```ts
|
|
1087
|
+
get supported(): boolean
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
Returns whether notification is supported in the current environment.
|
|
1091
|
+
|
|
1092
|
+
**Example**
|
|
1093
|
+
|
|
1094
|
+
```ts
|
|
1095
|
+
if (Native.notification.supported) {
|
|
1096
|
+
await Native.notification.send({
|
|
1097
|
+
title: 'Hello',
|
|
1098
|
+
body: 'You have a new message.',
|
|
1099
|
+
icon: '/icon.png',
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1104
|
+
**Returns**
|
|
1105
|
+
|
|
1106
|
+
```ts
|
|
1107
|
+
boolean
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
```ts
|
|
1112
|
+
// true — notification API support,
|
|
1113
|
+
// false — no notification support
|
|
1114
|
+
```
|
|
1115
|
+
|
|
1116
|
+
---
|
|
918
1117
|
|
|
919
1118
|
<h3 id="notification-send"><code>notification.send</code></h3>
|
|
920
1119
|
|
|
@@ -1538,7 +1737,39 @@ void
|
|
|
1538
1737
|
|
|
1539
1738
|
## permission
|
|
1540
1739
|
|
|
1541
|
-
[`request`](#permission-request) · [`check`](#permission-check)
|
|
1740
|
+
[`supported`](#permission-supported) · [`request`](#permission-request) · [`check`](#permission-check)
|
|
1741
|
+
|
|
1742
|
+
<h3 id="permission-supported"><code>permission.supported</code></h3>
|
|
1743
|
+
|
|
1744
|
+
**Signature**
|
|
1745
|
+
|
|
1746
|
+
```ts
|
|
1747
|
+
get supported(): boolean
|
|
1748
|
+
```
|
|
1749
|
+
|
|
1750
|
+
Returns whether permission is supported in the current environment.
|
|
1751
|
+
|
|
1752
|
+
**Example**
|
|
1753
|
+
|
|
1754
|
+
```ts
|
|
1755
|
+
if (Native.permission.supported) {
|
|
1756
|
+
const state = await Native.permission.check(PermissionType.Geolocation);
|
|
1757
|
+
}
|
|
1758
|
+
```
|
|
1759
|
+
|
|
1760
|
+
**Returns**
|
|
1761
|
+
|
|
1762
|
+
```ts
|
|
1763
|
+
boolean
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
```ts
|
|
1768
|
+
// true — permission API support,
|
|
1769
|
+
// false — no permission support
|
|
1770
|
+
```
|
|
1771
|
+
|
|
1772
|
+
---
|
|
1542
1773
|
|
|
1543
1774
|
<h3 id="permission-request"><code>permission.request</code></h3>
|
|
1544
1775
|
|
|
@@ -1654,90 +1885,141 @@ enum PermissionState {
|
|
|
1654
1885
|
|
|
1655
1886
|
## pip
|
|
1656
1887
|
|
|
1657
|
-
[`
|
|
1888
|
+
[`supported`](#pip-supported) · [`element`](#pip-element) · [`isActive`](#pip-isActive) · [`request`](#pip-request) · [`exit`](#pip-exit) · [`onChange`](#pip-onchange) · [`onError`](#pip-onerror)
|
|
1658
1889
|
|
|
1659
|
-
<h3 id="pip-
|
|
1890
|
+
<h3 id="pip-supported"><code>pip.supported</code></h3>
|
|
1660
1891
|
|
|
1661
1892
|
**Signature**
|
|
1662
1893
|
|
|
1663
1894
|
```ts
|
|
1664
|
-
|
|
1895
|
+
get supported(): boolean
|
|
1665
1896
|
```
|
|
1666
1897
|
|
|
1667
|
-
|
|
1898
|
+
Returns whether Picture-in-Picture is supported in the current environment.
|
|
1668
1899
|
|
|
1669
|
-
**
|
|
1900
|
+
**Example**
|
|
1670
1901
|
|
|
1671
|
-
```
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
C -->|no| D[requestImmediately]
|
|
1676
|
-
C -->|yes| E[Push to pendingQueue]
|
|
1677
|
-
D --> F{target is video element?}
|
|
1678
|
-
F -->|no| Z([Throw NotSupportedError])
|
|
1679
|
-
F -->|yes| G{requestPictureInPicture available?}
|
|
1680
|
-
G -->|yes| H[Call video.requestPictureInPicture]
|
|
1681
|
-
G -->|no| I[fallbackToWebkitVideo]
|
|
1682
|
-
H --> J{Resolved?}
|
|
1683
|
-
J -->|yes| K([resolve])
|
|
1684
|
-
J -->|no| I
|
|
1685
|
-
I --> L{webkitSupportsPresentationMode PIP?}
|
|
1686
|
-
L -->|yes| M[webkitSetPresentationMode picture-in-picture]
|
|
1687
|
-
M --> K
|
|
1688
|
-
L -->|no| N([Throw NotSupportedError])
|
|
1689
|
-
D --> O[drainPendingOperation on settle]
|
|
1902
|
+
```ts
|
|
1903
|
+
if (Native.pip.supported) {
|
|
1904
|
+
await Native.pip.request();
|
|
1905
|
+
}
|
|
1690
1906
|
```
|
|
1691
1907
|
|
|
1692
|
-
**
|
|
1908
|
+
**Returns**
|
|
1693
1909
|
|
|
1694
1910
|
```ts
|
|
1695
|
-
|
|
1696
|
-
|
|
1911
|
+
boolean
|
|
1912
|
+
```
|
|
1697
1913
|
|
|
1698
|
-
// Specific video element
|
|
1699
|
-
await Native.pip.request(document.querySelector('video#player'));
|
|
1700
1914
|
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1915
|
+
```ts
|
|
1916
|
+
// true — document.pictureInPictureEnabled is true,
|
|
1917
|
+
// or a video with webkitSupportsPresentationMode('picture-in-picture') exists
|
|
1918
|
+
// false — no PiP support
|
|
1919
|
+
```
|
|
1920
|
+
|
|
1921
|
+
---
|
|
1922
|
+
|
|
1923
|
+
<h3 id="pip-element"><code>pip.element</code></h3>
|
|
1924
|
+
|
|
1925
|
+
**Signature**
|
|
1926
|
+
|
|
1927
|
+
```ts
|
|
1928
|
+
get element(): HTMLVideoElement | null
|
|
1929
|
+
```
|
|
1930
|
+
|
|
1931
|
+
Returns the video element currently in Picture-in-Picture, or null if not active.
|
|
1932
|
+
|
|
1933
|
+
**Example**
|
|
1934
|
+
|
|
1935
|
+
```ts
|
|
1936
|
+
const el = Native.pip.element;
|
|
1937
|
+
|
|
1938
|
+
if (el !== null) {
|
|
1939
|
+
console.log(el.src); // currently PiP video source
|
|
1940
|
+
}
|
|
1704
1941
|
```
|
|
1705
1942
|
|
|
1706
1943
|
**Returns**
|
|
1707
1944
|
|
|
1708
1945
|
```ts
|
|
1709
|
-
|
|
1946
|
+
HTMLVideoElement | null
|
|
1710
1947
|
```
|
|
1711
1948
|
|
|
1712
1949
|
|
|
1713
|
-
|
|
1950
|
+
```ts
|
|
1951
|
+
// HTMLVideoElement — the current PiP video
|
|
1952
|
+
// null — not in PiP
|
|
1953
|
+
```
|
|
1954
|
+
|
|
1955
|
+
---
|
|
1956
|
+
|
|
1957
|
+
<h3 id="pip-isActive"><code>pip.isActive</code></h3>
|
|
1958
|
+
|
|
1959
|
+
**Signature**
|
|
1714
1960
|
|
|
1715
1961
|
```ts
|
|
1716
|
-
|
|
1962
|
+
get isActive(): boolean
|
|
1717
1963
|
```
|
|
1964
|
+
|
|
1965
|
+
Returns whether Picture-in-Picture is currently active.
|
|
1966
|
+
|
|
1967
|
+
**Example**
|
|
1968
|
+
|
|
1718
1969
|
```ts
|
|
1719
|
-
|
|
1970
|
+
console.log(Native.pip.isActive); // true | false
|
|
1720
1971
|
```
|
|
1972
|
+
|
|
1973
|
+
**Returns**
|
|
1974
|
+
|
|
1721
1975
|
```ts
|
|
1722
|
-
|
|
1976
|
+
boolean
|
|
1723
1977
|
```
|
|
1724
1978
|
|
|
1979
|
+
|
|
1725
1980
|
---
|
|
1726
1981
|
|
|
1727
|
-
<h3 id="pip-
|
|
1982
|
+
<h3 id="pip-request"><code>pip.request</code></h3>
|
|
1728
1983
|
|
|
1729
1984
|
**Signature**
|
|
1730
1985
|
|
|
1731
1986
|
```ts
|
|
1732
|
-
|
|
1987
|
+
request(target?: HTMLVideoElement): Promise<void>
|
|
1733
1988
|
```
|
|
1734
1989
|
|
|
1735
|
-
|
|
1990
|
+
Requests Picture-in-Picture for a video element.
|
|
1991
|
+
|
|
1992
|
+
**Flowchart**
|
|
1993
|
+
|
|
1994
|
+
```mermaid
|
|
1995
|
+
flowchart TD
|
|
1996
|
+
A([Pip.request called]) --> B{target defined?}
|
|
1997
|
+
B -->|no| C[getDefaultTarget]
|
|
1998
|
+
B -->|yes| D{target is video element?}
|
|
1999
|
+
C --> D
|
|
2000
|
+
D -->|no| Z([Throw NotSupportedError])
|
|
2001
|
+
D -->|yes| E{requestPictureInPicture available?}
|
|
2002
|
+
E -->|yes| F[Call video.requestPictureInPicture]
|
|
2003
|
+
E -->|no| G[fallbackToWebkit]
|
|
2004
|
+
F --> H{Promise returned?}
|
|
2005
|
+
H -->|yes| I{Resolved?}
|
|
2006
|
+
I -->|yes| J([resolve])
|
|
2007
|
+
I -->|no| G
|
|
2008
|
+
H -->|no| J
|
|
2009
|
+
G --> K{webkitSupportsPresentationMode PIP?}
|
|
2010
|
+
K -->|yes| L[webkitSetPresentationMode picture-in-picture]
|
|
2011
|
+
L --> J
|
|
2012
|
+
K -->|no| M([Throw NotSupportedError])
|
|
2013
|
+
```
|
|
1736
2014
|
|
|
1737
2015
|
**Example**
|
|
1738
2016
|
|
|
1739
2017
|
```ts
|
|
1740
|
-
|
|
2018
|
+
// Default: first video element
|
|
2019
|
+
await Native.pip.request();
|
|
2020
|
+
|
|
2021
|
+
// Specific video element
|
|
2022
|
+
await Native.pip.request(document.querySelector('video#player'));
|
|
1741
2023
|
```
|
|
1742
2024
|
|
|
1743
2025
|
**Returns**
|
|
@@ -1750,31 +2032,56 @@ Promise<void>
|
|
|
1750
2032
|
**Throws**
|
|
1751
2033
|
|
|
1752
2034
|
```ts
|
|
1753
|
-
throw new NotSupportedError //
|
|
2035
|
+
throw new NotSupportedError // target is not a video element
|
|
2036
|
+
```
|
|
2037
|
+
```ts
|
|
2038
|
+
throw new NotSupportedError // PiP disabled on this element (disablePictureInPicture)
|
|
2039
|
+
```
|
|
2040
|
+
```ts
|
|
2041
|
+
throw new NotSupportedError // requestPictureInPicture and webkitSetPresentationMode both unavailable
|
|
2042
|
+
```
|
|
2043
|
+
```ts
|
|
2044
|
+
throw new InvalidStateError // PiP transition already in progress
|
|
1754
2045
|
```
|
|
1755
2046
|
|
|
1756
2047
|
---
|
|
1757
2048
|
|
|
1758
|
-
<h3 id="pip-
|
|
2049
|
+
<h3 id="pip-exit"><code>pip.exit</code></h3>
|
|
1759
2050
|
|
|
1760
2051
|
**Signature**
|
|
1761
2052
|
|
|
1762
2053
|
```ts
|
|
1763
|
-
|
|
2054
|
+
exit(): Promise<void>
|
|
1764
2055
|
```
|
|
1765
2056
|
|
|
1766
|
-
|
|
2057
|
+
Exits Picture-in-Picture.
|
|
2058
|
+
|
|
2059
|
+
**Flowchart**
|
|
2060
|
+
|
|
2061
|
+
```mermaid
|
|
2062
|
+
flowchart TD
|
|
2063
|
+
A([Pip.exit called]) --> B{exitPictureInPicture available?}
|
|
2064
|
+
B -->|yes| C[Call document.exitPictureInPicture]
|
|
2065
|
+
B -->|no| D[fallbackToWebkit]
|
|
2066
|
+
C --> E{Promise returned?}
|
|
2067
|
+
E -->|yes| F{Resolved?}
|
|
2068
|
+
F -->|yes| G([resolve])
|
|
2069
|
+
F -->|no| D
|
|
2070
|
+
E -->|no| G
|
|
2071
|
+
D --> H{webkit PiP video found?}
|
|
2072
|
+
H -->|yes| I[webkitSetPresentationMode inline]
|
|
2073
|
+
I --> G
|
|
2074
|
+
H -->|no| J{any video in PIP mode found?}
|
|
2075
|
+
J -->|yes| I
|
|
2076
|
+
J -->|no| K{pictureInPictureElement null?}
|
|
2077
|
+
K -->|yes| G
|
|
2078
|
+
K -->|no| L([Throw NotSupportedError])
|
|
2079
|
+
```
|
|
1767
2080
|
|
|
1768
2081
|
**Example**
|
|
1769
2082
|
|
|
1770
2083
|
```ts
|
|
1771
|
-
|
|
1772
|
-
btn.addEventListener('click', () => Native.pip.toggle());
|
|
1773
|
-
|
|
1774
|
-
// Toggle a specific video element
|
|
1775
|
-
btn.addEventListener('click', () => {
|
|
1776
|
-
Native.pip.toggle(document.querySelector('video#player'));
|
|
1777
|
-
});
|
|
2084
|
+
await Native.pip.exit();
|
|
1778
2085
|
```
|
|
1779
2086
|
|
|
1780
2087
|
**Returns**
|
|
@@ -1787,7 +2094,7 @@ Promise<void>
|
|
|
1787
2094
|
**Throws**
|
|
1788
2095
|
|
|
1789
2096
|
```ts
|
|
1790
|
-
throw new NotSupportedError //
|
|
2097
|
+
throw new NotSupportedError // failed to exit PiP
|
|
1791
2098
|
```
|
|
1792
2099
|
|
|
1793
2100
|
---
|
|
@@ -1797,7 +2104,7 @@ throw new NotSupportedError // propagated from request() or exit()
|
|
|
1797
2104
|
**Signature**
|
|
1798
2105
|
|
|
1799
2106
|
```ts
|
|
1800
|
-
onChange(listener: (
|
|
2107
|
+
onChange(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void
|
|
1801
2108
|
```
|
|
1802
2109
|
|
|
1803
2110
|
Subscribes to Picture-in-Picture state changes.
|
|
@@ -1805,9 +2112,10 @@ Subscribes to Picture-in-Picture state changes.
|
|
|
1805
2112
|
**Example**
|
|
1806
2113
|
|
|
1807
2114
|
```ts
|
|
1808
|
-
const unsubscribe = Native.pip.onChange(() => {
|
|
1809
|
-
console.log(
|
|
1810
|
-
console.log(
|
|
2115
|
+
const unsubscribe = Native.pip.onChange((payload) => {
|
|
2116
|
+
console.log(payload.isActive); // true | false
|
|
2117
|
+
console.log(payload.element); // HTMLVideoElement
|
|
2118
|
+
console.log(payload.nativeEvent); // Event
|
|
1811
2119
|
});
|
|
1812
2120
|
|
|
1813
2121
|
unsubscribe();
|
|
@@ -1832,7 +2140,7 @@ unsubscribe();
|
|
|
1832
2140
|
**Signature**
|
|
1833
2141
|
|
|
1834
2142
|
```ts
|
|
1835
|
-
onError(listener: (
|
|
2143
|
+
onError(listener: (payload: PipEventPayload) => void, options?: AddEventListenerOptions): () => void
|
|
1836
2144
|
```
|
|
1837
2145
|
|
|
1838
2146
|
Subscribes to Picture-in-Picture errors.
|
|
@@ -1840,8 +2148,10 @@ Subscribes to Picture-in-Picture errors.
|
|
|
1840
2148
|
**Example**
|
|
1841
2149
|
|
|
1842
2150
|
```ts
|
|
1843
|
-
const unsubscribe = Native.pip.onError((
|
|
1844
|
-
console.
|
|
2151
|
+
const unsubscribe = Native.pip.onError((payload) => {
|
|
2152
|
+
console.log(payload.isActive); // boolean
|
|
2153
|
+
console.log(payload.element); // HTMLVideoElement
|
|
2154
|
+
console.log(payload.nativeEvent); // Event
|
|
1845
2155
|
});
|
|
1846
2156
|
|
|
1847
2157
|
unsubscribe();
|
|
@@ -2301,7 +2611,39 @@ string | undefined
|
|
|
2301
2611
|
|
|
2302
2612
|
## vibration
|
|
2303
2613
|
|
|
2304
|
-
[`run`](#vibration-run) · [`stop`](#vibration-stop)
|
|
2614
|
+
[`supported`](#vibration-supported) · [`run`](#vibration-run) · [`stop`](#vibration-stop)
|
|
2615
|
+
|
|
2616
|
+
<h3 id="vibration-supported"><code>vibration.supported</code></h3>
|
|
2617
|
+
|
|
2618
|
+
**Signature**
|
|
2619
|
+
|
|
2620
|
+
```ts
|
|
2621
|
+
get supported(): boolean
|
|
2622
|
+
```
|
|
2623
|
+
|
|
2624
|
+
Returns whether vibration is supported in the current environment.
|
|
2625
|
+
|
|
2626
|
+
**Example**
|
|
2627
|
+
|
|
2628
|
+
```ts
|
|
2629
|
+
if (Native.vibration.supported) {
|
|
2630
|
+
Native.vibration.run([100, 50, 200]);
|
|
2631
|
+
}
|
|
2632
|
+
```
|
|
2633
|
+
|
|
2634
|
+
**Returns**
|
|
2635
|
+
|
|
2636
|
+
```ts
|
|
2637
|
+
boolean
|
|
2638
|
+
```
|
|
2639
|
+
|
|
2640
|
+
|
|
2641
|
+
```ts
|
|
2642
|
+
// true — vibration API support,
|
|
2643
|
+
// false — no vibration support
|
|
2644
|
+
```
|
|
2645
|
+
|
|
2646
|
+
---
|
|
2305
2647
|
|
|
2306
2648
|
<h3 id="vibration-run"><code>vibration.run</code></h3>
|
|
2307
2649
|
|