@firebolt-js/core-client 1.0.0-next.5
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/CHANGELOG.md +0 -0
- package/CONTRIBUTING.md +4 -0
- package/LICENSE +202 -0
- package/NOTICE +24 -0
- package/README.md +26 -0
- package/dist/docs/Accessibility/index.md +384 -0
- package/dist/docs/Accessibility/schemas/index.md +52 -0
- package/dist/docs/Advertising/index.md +120 -0
- package/dist/docs/Device/index.md +297 -0
- package/dist/docs/Discovery/index.md +128 -0
- package/dist/docs/Display/index.md +87 -0
- package/dist/docs/Internal/index.md +68 -0
- package/dist/docs/Lifecycle2/index.md +160 -0
- package/dist/docs/Localization/index.md +314 -0
- package/dist/docs/Localization/schemas/index.md +41 -0
- package/dist/docs/Metrics/index.md +987 -0
- package/dist/docs/Network/index.md +128 -0
- package/dist/docs/Policies/schemas/index.md +25 -0
- package/dist/docs/Presentation/index.md +53 -0
- package/dist/docs/Stats/index.md +63 -0
- package/dist/docs/TextToSpeech/index.md +524 -0
- package/dist/docs/Types/schemas/index.md +37 -0
- package/dist/firebolt-core-app-open-rpc.json +1082 -0
- package/dist/firebolt-core-open-rpc.json +3773 -0
- package/dist/lib/Accessibility/defaults.mjs +61 -0
- package/dist/lib/Accessibility/index.mjs +148 -0
- package/dist/lib/Advertising/defaults.mjs +26 -0
- package/dist/lib/Advertising/index.mjs +31 -0
- package/dist/lib/Device/defaults.mjs +34 -0
- package/dist/lib/Device/index.mjs +84 -0
- package/dist/lib/Discovery/defaults.mjs +22 -0
- package/dist/lib/Discovery/index.mjs +34 -0
- package/dist/lib/Events/index.mjs +345 -0
- package/dist/lib/Gateway/AppApi.mjs +125 -0
- package/dist/lib/Gateway/Bidirectional.mjs +113 -0
- package/dist/lib/Gateway/PlatformApi.mjs +130 -0
- package/dist/lib/Gateway/index.mjs +48 -0
- package/dist/lib/Localization/defaults.mjs +44 -0
- package/dist/lib/Localization/index.mjs +123 -0
- package/dist/lib/Log/index.mjs +57 -0
- package/dist/lib/Metrics/defaults.mjs +40 -0
- package/dist/lib/Metrics/index.mjs +206 -0
- package/dist/lib/Network/defaults.mjs +24 -0
- package/dist/lib/Network/index.mjs +70 -0
- package/dist/lib/Platform/defaults.mjs +27 -0
- package/dist/lib/Platform/index.mjs +28 -0
- package/dist/lib/Prop/MockProps.mjs +28 -0
- package/dist/lib/Prop/Router.mjs +25 -0
- package/dist/lib/Prop/index.mjs +60 -0
- package/dist/lib/Settings/index.mjs +86 -0
- package/dist/lib/Transport/MockTransport.mjs +191 -0
- package/dist/lib/Transport/WebsocketTransport.mjs +55 -0
- package/dist/lib/Transport/index.mjs +81 -0
- package/dist/lib/firebolt.d.ts +795 -0
- package/dist/lib/firebolt.mjs +51 -0
- package/firebolt-js-core-client-1.0.0-next.5.tgz +0 -0
- package/package.json +54 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Lifecycle2
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Lifecycle2 Module
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Version Lifecycle2 1.0.0-next.5
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Table of Contents](#table-of-contents)
|
|
14
|
+
- [Overview](#overview)
|
|
15
|
+
- [Methods](#methods)
|
|
16
|
+
- [close](#close)
|
|
17
|
+
- [state](#state)
|
|
18
|
+
- [Events](#events)
|
|
19
|
+
- [onStateChanged](#onstatechanged)
|
|
20
|
+
- [Types](#types)
|
|
21
|
+
- [CloseType](#closetype)
|
|
22
|
+
- [LifecycleState](#lifecyclestate)
|
|
23
|
+
- [StateChange](#statechange)
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
Methods and events for responding to Lifecycle changes in your app.
|
|
28
|
+
|
|
29
|
+
## Methods
|
|
30
|
+
|
|
31
|
+
### close
|
|
32
|
+
|
|
33
|
+
_This is a private RPC method._
|
|
34
|
+
|
|
35
|
+
Request the platform to deactivate the app, and possibly take further action.
|
|
36
|
+
|
|
37
|
+
Parameters:
|
|
38
|
+
|
|
39
|
+
| Param | Type | Required | Description |
|
|
40
|
+
| ------ | ------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
41
|
+
| `type` | [`CloseType`](#closetype) | true | The type of the close app is requesting <br/>values: `'deactivate' \| 'unload' \| 'killReload' \| 'killReactivate'` |
|
|
42
|
+
|
|
43
|
+
Result:
|
|
44
|
+
|
|
45
|
+
Capabilities:
|
|
46
|
+
|
|
47
|
+
| Role | Capability |
|
|
48
|
+
| ---- | ------------------------------------------ |
|
|
49
|
+
| uses | xrn:firebolt:capability:lifecycle2:general |
|
|
50
|
+
|
|
51
|
+
#### Examples
|
|
52
|
+
|
|
53
|
+
Close the app when the user presses back on the app home screen
|
|
54
|
+
|
|
55
|
+
Close the app when the user selects an exit menu item
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### state
|
|
60
|
+
|
|
61
|
+
_This is a private RPC method._
|
|
62
|
+
|
|
63
|
+
Get the current lifecycle state of the app.
|
|
64
|
+
|
|
65
|
+
Result:
|
|
66
|
+
|
|
67
|
+
[LifecycleState](#lifecyclestate)
|
|
68
|
+
|
|
69
|
+
Capabilities:
|
|
70
|
+
|
|
71
|
+
| Role | Capability |
|
|
72
|
+
| ---- | ------------------------------------------ |
|
|
73
|
+
| uses | xrn:firebolt:capability:lifecycle2:general |
|
|
74
|
+
|
|
75
|
+
#### Examples
|
|
76
|
+
|
|
77
|
+
Default Example
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Events
|
|
82
|
+
|
|
83
|
+
### onStateChanged
|
|
84
|
+
|
|
85
|
+
_This is a private RPC method._
|
|
86
|
+
|
|
87
|
+
Notification of lifecycle state change, raised after the platform has transitioned the app/runtime to the new lifecycle state
|
|
88
|
+
|
|
89
|
+
Parameters:
|
|
90
|
+
|
|
91
|
+
| Param | Type | Required | Description |
|
|
92
|
+
| -------- | --------- | -------- | ----------- |
|
|
93
|
+
| `listen` | `boolean` | false | |
|
|
94
|
+
|
|
95
|
+
Result:
|
|
96
|
+
|
|
97
|
+
Capabilities:
|
|
98
|
+
|
|
99
|
+
| Role | Capability |
|
|
100
|
+
| ---- | ------------------------------------------ |
|
|
101
|
+
| uses | xrn:firebolt:capability:lifecycle2:general |
|
|
102
|
+
|
|
103
|
+
#### Examples
|
|
104
|
+
|
|
105
|
+
App is active after being initialized
|
|
106
|
+
|
|
107
|
+
Single transition to paused state
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Types
|
|
112
|
+
|
|
113
|
+
### CloseType
|
|
114
|
+
|
|
115
|
+
The application close type
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
CloseType: {
|
|
119
|
+
DEACTIVATE: 'deactivate',
|
|
120
|
+
UNLOAD: 'unload',
|
|
121
|
+
KILL_RELOAD: 'killReload',
|
|
122
|
+
KILL_REACTIVATE: 'killReactivate',
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### LifecycleState
|
|
130
|
+
|
|
131
|
+
The application Lifecycle state
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
LifecycleState: {
|
|
135
|
+
INITIALIZING: 'initializing',
|
|
136
|
+
ACTIVE: 'active',
|
|
137
|
+
PAUSED: 'paused',
|
|
138
|
+
SUSPENDED: 'suspended',
|
|
139
|
+
HIBERNATED: 'hibernated',
|
|
140
|
+
TERMINATING: 'terminating',
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### StateChange
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
type StateChange = {
|
|
151
|
+
newState?: LifecycleState // The application Lifecycle state
|
|
152
|
+
oldState?: LifecycleState // The application Lifecycle state
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
See also:
|
|
157
|
+
|
|
158
|
+
[LifecycleState](#lifecyclestate)
|
|
159
|
+
|
|
160
|
+
---
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Localization
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Localization Module
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Version Localization 1.0.0-next.5
|
|
10
|
+
|
|
11
|
+
## Table of Contents
|
|
12
|
+
|
|
13
|
+
- [Table of Contents](#table-of-contents)
|
|
14
|
+
- [Usage](#usage)
|
|
15
|
+
- [Overview](#overview)
|
|
16
|
+
- [Methods](#methods)
|
|
17
|
+
- [country](#country)
|
|
18
|
+
- [preferredAudioLanguages](#preferredaudiolanguages)
|
|
19
|
+
- [presentationLanguage](#presentationlanguage)
|
|
20
|
+
- [Events](#events)
|
|
21
|
+
- [onCountryChanged](#oncountrychanged)
|
|
22
|
+
- [onPreferredAudioLanguagesChanged](#onpreferredaudiolanguageschanged)
|
|
23
|
+
- [onPresentationLanguageChanged](#onpresentationlanguagechanged)
|
|
24
|
+
- [Types](#types)
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
To use the Localization module, you can import it into your project from the Firebolt SDK:
|
|
29
|
+
|
|
30
|
+
```javascript
|
|
31
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
Methods for accessing location and language preferences.
|
|
37
|
+
|
|
38
|
+
## Methods
|
|
39
|
+
|
|
40
|
+
### country
|
|
41
|
+
|
|
42
|
+
Returns the ISO 3166-1 alpha-2 code for the country device is located in.
|
|
43
|
+
|
|
44
|
+
To get the value of `country` call the method like this:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
function country(): Promise<string>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Promise resolution:
|
|
51
|
+
|
|
52
|
+
Capabilities:
|
|
53
|
+
|
|
54
|
+
| Role | Capability |
|
|
55
|
+
| ---- | ------------------------------------------------- |
|
|
56
|
+
| uses | xrn:firebolt:capability:localization:country-code |
|
|
57
|
+
|
|
58
|
+
#### Examples
|
|
59
|
+
|
|
60
|
+
Default example
|
|
61
|
+
|
|
62
|
+
JavaScript:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
66
|
+
|
|
67
|
+
let code = await Localization.country()
|
|
68
|
+
console.log(code)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Value of `code`:
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
'US'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Another example
|
|
78
|
+
|
|
79
|
+
JavaScript:
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
83
|
+
|
|
84
|
+
let code = await Localization.country()
|
|
85
|
+
console.log(code)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Value of `code`:
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
'US'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
To subscribe to notifications when the value changes, call the method like this:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
function country(callback: (code) => string): Promise<number>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Param | Type | Required | Description |
|
|
103
|
+
| ------ | -------- | -------- | ------------------------------------------------- |
|
|
104
|
+
| `code` | `string` | false | The device country code. <br/>pattern: ^[A-Z]{2}$ |
|
|
105
|
+
|
|
106
|
+
Promise resolution:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
number
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Examples
|
|
113
|
+
|
|
114
|
+
Default example
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
118
|
+
|
|
119
|
+
let listenerId = await country((result) => {
|
|
120
|
+
console.log(result)
|
|
121
|
+
})
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Value of `result`:
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
'US'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Another example
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
134
|
+
|
|
135
|
+
let listenerId = await country((result) => {
|
|
136
|
+
console.log(result)
|
|
137
|
+
})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Value of `result`:
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
'US'
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### preferredAudioLanguages
|
|
149
|
+
|
|
150
|
+
Returns a list of ISO 639-2/B codes for the preferred audio languages on this device.
|
|
151
|
+
|
|
152
|
+
To get the value of `preferredAudioLanguages` call the method like this:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
function preferredAudioLanguages(): Promise<string[]>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Promise resolution:
|
|
159
|
+
|
|
160
|
+
Capabilities:
|
|
161
|
+
|
|
162
|
+
| Role | Capability |
|
|
163
|
+
| ---- | -------------------------------------------------------------- |
|
|
164
|
+
| uses | xrn:firebolt:capability:localization:preferred-audio-languages |
|
|
165
|
+
|
|
166
|
+
#### Examples
|
|
167
|
+
|
|
168
|
+
Default example
|
|
169
|
+
|
|
170
|
+
JavaScript:
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
174
|
+
|
|
175
|
+
let languages = await Localization.preferredAudioLanguages()
|
|
176
|
+
console.log(languages)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Value of `languages`:
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
;['spa', 'eng']
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
To subscribe to notifications when the value changes, call the method like this:
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
function preferredAudioLanguages(
|
|
191
|
+
callback: (languages) => string[],
|
|
192
|
+
): Promise<number>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
| Param | Type | Required | Description |
|
|
196
|
+
| ----------- | ---------- | -------- | ------------------------------------------------------- |
|
|
197
|
+
| `languages` | `string[]` | false | The preferred audio languages. <br/>pattern: ^[a-z]{3}$ |
|
|
198
|
+
|
|
199
|
+
Promise resolution:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
number
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### Examples
|
|
206
|
+
|
|
207
|
+
Default example
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
211
|
+
|
|
212
|
+
let listenerId = await preferredAudioLanguages((result) => {
|
|
213
|
+
console.log(result)
|
|
214
|
+
})
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Value of `result`:
|
|
218
|
+
|
|
219
|
+
```javascript
|
|
220
|
+
;['spa', 'eng']
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### presentationLanguage
|
|
226
|
+
|
|
227
|
+
Get the _full_ BCP 47 code, including script, region, variant, etc., for the preferred locale
|
|
228
|
+
|
|
229
|
+
To get the value of `presentationLanguage` call the method like this:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
function presentationLanguage(): Promise<string>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Promise resolution:
|
|
236
|
+
|
|
237
|
+
Capabilities:
|
|
238
|
+
|
|
239
|
+
| Role | Capability |
|
|
240
|
+
| ---- | ------------------------------------------- |
|
|
241
|
+
| uses | xrn:firebolt:capability:localization:locale |
|
|
242
|
+
|
|
243
|
+
#### Examples
|
|
244
|
+
|
|
245
|
+
Default example
|
|
246
|
+
|
|
247
|
+
JavaScript:
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
251
|
+
|
|
252
|
+
let locale = await Localization.presentationLanguage()
|
|
253
|
+
console.log(locale)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Value of `locale`:
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
'en-US'
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
To subscribe to notifications when the value changes, call the method like this:
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
function presentationLanguage(callback: (locale) => string): Promise<number>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
| Param | Type | Required | Description |
|
|
271
|
+
| -------- | -------- | -------- | ------------------------------------------------------------- |
|
|
272
|
+
| `locale` | `string` | false | The device locale. <br/>pattern: ^[a-zA-Z]+([a-zA-Z0-9\-]\*)$ |
|
|
273
|
+
|
|
274
|
+
Promise resolution:
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
number
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Examples
|
|
281
|
+
|
|
282
|
+
Default example
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
import { Localization } from '@firebolt-js/core-client'
|
|
286
|
+
|
|
287
|
+
let listenerId = await presentationLanguage((result) => {
|
|
288
|
+
console.log(result)
|
|
289
|
+
})
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Value of `result`:
|
|
293
|
+
|
|
294
|
+
```javascript
|
|
295
|
+
'en-US'
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Events
|
|
301
|
+
|
|
302
|
+
### onCountryChanged
|
|
303
|
+
|
|
304
|
+
See: [country](#country)
|
|
305
|
+
|
|
306
|
+
### onPreferredAudioLanguagesChanged
|
|
307
|
+
|
|
308
|
+
See: [preferredAudioLanguages](#preferredaudiolanguages)
|
|
309
|
+
|
|
310
|
+
### onPresentationLanguageChanged
|
|
311
|
+
|
|
312
|
+
See: [presentationLanguage](#presentationlanguage)
|
|
313
|
+
|
|
314
|
+
## Types
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Localization
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Localization
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Table of Contents](#table-of-contents)
|
|
12
|
+
- [Types](#types)
|
|
13
|
+
- [ISO639_2Language](#isolanguage)
|
|
14
|
+
- [CountryCode](#countrycode)
|
|
15
|
+
- [Locale](#locale)
|
|
16
|
+
|
|
17
|
+
## Types
|
|
18
|
+
|
|
19
|
+
### ISO639_2Language
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
type ISO639_2Language = string
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
### CountryCode
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
type CountryCode = string
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
### Locale
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
type Locale = string
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|