@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.
Files changed (57) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/CONTRIBUTING.md +4 -0
  3. package/LICENSE +202 -0
  4. package/NOTICE +24 -0
  5. package/README.md +26 -0
  6. package/dist/docs/Accessibility/index.md +384 -0
  7. package/dist/docs/Accessibility/schemas/index.md +52 -0
  8. package/dist/docs/Advertising/index.md +120 -0
  9. package/dist/docs/Device/index.md +297 -0
  10. package/dist/docs/Discovery/index.md +128 -0
  11. package/dist/docs/Display/index.md +87 -0
  12. package/dist/docs/Internal/index.md +68 -0
  13. package/dist/docs/Lifecycle2/index.md +160 -0
  14. package/dist/docs/Localization/index.md +314 -0
  15. package/dist/docs/Localization/schemas/index.md +41 -0
  16. package/dist/docs/Metrics/index.md +987 -0
  17. package/dist/docs/Network/index.md +128 -0
  18. package/dist/docs/Policies/schemas/index.md +25 -0
  19. package/dist/docs/Presentation/index.md +53 -0
  20. package/dist/docs/Stats/index.md +63 -0
  21. package/dist/docs/TextToSpeech/index.md +524 -0
  22. package/dist/docs/Types/schemas/index.md +37 -0
  23. package/dist/firebolt-core-app-open-rpc.json +1082 -0
  24. package/dist/firebolt-core-open-rpc.json +3773 -0
  25. package/dist/lib/Accessibility/defaults.mjs +61 -0
  26. package/dist/lib/Accessibility/index.mjs +148 -0
  27. package/dist/lib/Advertising/defaults.mjs +26 -0
  28. package/dist/lib/Advertising/index.mjs +31 -0
  29. package/dist/lib/Device/defaults.mjs +34 -0
  30. package/dist/lib/Device/index.mjs +84 -0
  31. package/dist/lib/Discovery/defaults.mjs +22 -0
  32. package/dist/lib/Discovery/index.mjs +34 -0
  33. package/dist/lib/Events/index.mjs +345 -0
  34. package/dist/lib/Gateway/AppApi.mjs +125 -0
  35. package/dist/lib/Gateway/Bidirectional.mjs +113 -0
  36. package/dist/lib/Gateway/PlatformApi.mjs +130 -0
  37. package/dist/lib/Gateway/index.mjs +48 -0
  38. package/dist/lib/Localization/defaults.mjs +44 -0
  39. package/dist/lib/Localization/index.mjs +123 -0
  40. package/dist/lib/Log/index.mjs +57 -0
  41. package/dist/lib/Metrics/defaults.mjs +40 -0
  42. package/dist/lib/Metrics/index.mjs +206 -0
  43. package/dist/lib/Network/defaults.mjs +24 -0
  44. package/dist/lib/Network/index.mjs +70 -0
  45. package/dist/lib/Platform/defaults.mjs +27 -0
  46. package/dist/lib/Platform/index.mjs +28 -0
  47. package/dist/lib/Prop/MockProps.mjs +28 -0
  48. package/dist/lib/Prop/Router.mjs +25 -0
  49. package/dist/lib/Prop/index.mjs +60 -0
  50. package/dist/lib/Settings/index.mjs +86 -0
  51. package/dist/lib/Transport/MockTransport.mjs +191 -0
  52. package/dist/lib/Transport/WebsocketTransport.mjs +55 -0
  53. package/dist/lib/Transport/index.mjs +81 -0
  54. package/dist/lib/firebolt.d.ts +795 -0
  55. package/dist/lib/firebolt.mjs +51 -0
  56. package/firebolt-js-core-client-1.0.0-next.5.tgz +0 -0
  57. package/package.json +54 -0
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ function removeNullOptionalParams(params, numOfOptionalParams) {
20
+ // Iterate over all params starting backwrods and if the param is null remove it from the params object.
21
+ // If it is undefined that means the param is not provided, which is Ok.
22
+ // We should not get a call with numOfOptionalParams === 0, but if we do, just return the params as are.
23
+ const keys = Object.keys(params)
24
+ let paramsIndex = keys.length - 1
25
+ while (paramsIndex >= 0 && numOfOptionalParams > 0) {
26
+ const key = keys[paramsIndex]
27
+ if (params[key] === null) {
28
+ delete params[key]
29
+ console.warn(
30
+ 'WARNING: null values for optional params will be disallowed in a future Firebolt version. Parameter: ' +
31
+ key,
32
+ )
33
+ } else if (params[key] === undefined) {
34
+ // undefined means the param is not provided, we should continue.
35
+ } else {
36
+ // if an optional param is provided we should stop removing params as if we continue we will change the order of the params
37
+ break
38
+ }
39
+ paramsIndex--
40
+ numOfOptionalParams--
41
+ }
42
+ return params
43
+ }
44
+
45
+ import Bidirectional from './Bidirectional.mjs'
46
+ Bidirectional.removeNullOptionalParams = removeNullOptionalParams
47
+ // Export the Bidirectional class as the default export
48
+ export default Bidirectional
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+ import MockProps from '../Prop/MockProps.mjs'
19
+
20
+ export default {
21
+ country: function (params) {
22
+ return MockProps.mock('Localization', 'country', params, undefined, 0, 'US')
23
+ },
24
+ preferredAudioLanguages: function (params) {
25
+ return MockProps.mock(
26
+ 'Localization',
27
+ 'preferredAudioLanguages',
28
+ params,
29
+ undefined,
30
+ 0,
31
+ ['spa', 'eng'],
32
+ )
33
+ },
34
+ presentationLanguage: function (params) {
35
+ return MockProps.mock(
36
+ 'Localization',
37
+ 'presentationLanguage',
38
+ params,
39
+ undefined,
40
+ 0,
41
+ 'en-US',
42
+ )
43
+ },
44
+ }
@@ -0,0 +1,123 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ import Gateway from '../Gateway/index.mjs'
20
+ import Events from '../Events/index.mjs'
21
+ import { registerEvents } from '../Events/index.mjs'
22
+ import Prop from '../Prop/index.mjs'
23
+
24
+ registerEvents('Localization', [
25
+ 'onCountryChanged',
26
+ 'onPreferredAudioLanguagesChanged',
27
+ 'onPresentationLanguageChanged',
28
+ ])
29
+
30
+ // onCountryChanged is accessed via listen('onCountryChanged, ...)
31
+
32
+ // onPreferredAudioLanguagesChanged is accessed via listen('onPreferredAudioLanguagesChanged, ...)
33
+
34
+ // onPresentationLanguageChanged is accessed via listen('onPresentationLanguageChanged, ...)
35
+
36
+ // Methods
37
+ function clear(...args) {
38
+ return Events.clear('Localization', ...args)
39
+ }
40
+
41
+ function country() {
42
+ let callbackOrValue = arguments[0]
43
+ let params = {}
44
+
45
+ // If there is only one parameter, it must be the callback.
46
+ if (arguments.length === 1 && typeof arguments[0] === 'function') {
47
+ callbackOrValue = arguments[0]
48
+ params = {}
49
+ }
50
+
51
+ return Prop.prop(
52
+ 'Localization',
53
+ 'country',
54
+ params,
55
+ callbackOrValue,
56
+ false,
57
+ true,
58
+ 0,
59
+ )
60
+ }
61
+ function listen(...args) {
62
+ return Events.listen('Localization', ...args)
63
+ }
64
+
65
+ function once(...args) {
66
+ return Events.once('Localization', ...args)
67
+ }
68
+
69
+ function preferredAudioLanguages() {
70
+ let callbackOrValue = arguments[0]
71
+ let params = {}
72
+
73
+ // If there is only one parameter, it must be the callback.
74
+ if (arguments.length === 1 && typeof arguments[0] === 'function') {
75
+ callbackOrValue = arguments[0]
76
+ params = {}
77
+ }
78
+
79
+ return Prop.prop(
80
+ 'Localization',
81
+ 'preferredAudioLanguages',
82
+ params,
83
+ callbackOrValue,
84
+ false,
85
+ true,
86
+ 0,
87
+ )
88
+ }
89
+ function presentationLanguage() {
90
+ let callbackOrValue = arguments[0]
91
+ let params = {}
92
+
93
+ // If there is only one parameter, it must be the callback.
94
+ if (arguments.length === 1 && typeof arguments[0] === 'function') {
95
+ callbackOrValue = arguments[0]
96
+ params = {}
97
+ }
98
+
99
+ return Prop.prop(
100
+ 'Localization',
101
+ 'presentationLanguage',
102
+ params,
103
+ callbackOrValue,
104
+ false,
105
+ true,
106
+ 0,
107
+ )
108
+ }
109
+
110
+ export default {
111
+ Events: {
112
+ ON_COUNTRY_CHANGED: 'onCountryChanged',
113
+ ON_PREFERRED_AUDIO_LANGUAGES_CHANGED: 'onPreferredAudioLanguagesChanged',
114
+ ON_PRESENTATION_LANGUAGE_CHANGED: 'onPresentationLanguageChanged',
115
+ },
116
+
117
+ clear,
118
+ country,
119
+ listen,
120
+ once,
121
+ preferredAudioLanguages,
122
+ presentationLanguage,
123
+ }
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ import Settings from '../Settings/index.mjs'
20
+
21
+ const prepLog = (type, args) => {
22
+ const colors = {
23
+ Info: 'green',
24
+ Debug: 'gray',
25
+ Warn: 'orange',
26
+ Error: 'red',
27
+ }
28
+
29
+ args = Array.from(args)
30
+ return [
31
+ '%c' +
32
+ (args.length > 1 && typeof args[0] === 'string' ? args.shift() : type),
33
+ 'background-color: ' +
34
+ colors[type] +
35
+ '; color: white; padding: 2px 4px; border-radius: 2px',
36
+ args,
37
+ ]
38
+ }
39
+
40
+ export default {
41
+ info() {
42
+ Settings.get('platform', 'log') &&
43
+ console.log.apply(console, prepLog('Info', arguments))
44
+ },
45
+ debug() {
46
+ Settings.get('platform', 'log') &&
47
+ console.debug.apply(console, prepLog('Debug', arguments))
48
+ },
49
+ error() {
50
+ Settings.get('platform', 'log') &&
51
+ console.error.apply(console, prepLog('Error', arguments))
52
+ },
53
+ warn() {
54
+ Settings.get('platform', 'log') &&
55
+ console.warn.apply(console, prepLog('Warn', arguments))
56
+ },
57
+ }
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+ import MockProps from '../Prop/MockProps.mjs'
19
+
20
+ export default {
21
+ ready: true,
22
+ signIn: true,
23
+ signOut: true,
24
+ startContent: true,
25
+ stopContent: true,
26
+ page: true,
27
+ error: true,
28
+ mediaLoadStart: true,
29
+ mediaPlay: true,
30
+ mediaPlaying: true,
31
+ mediaPause: true,
32
+ mediaWaiting: true,
33
+ mediaSeeking: true,
34
+ mediaSeeked: true,
35
+ mediaRateChanged: true,
36
+ mediaRenditionChanged: true,
37
+ mediaEnded: true,
38
+ event: true,
39
+ appInfo: null,
40
+ }
@@ -0,0 +1,206 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ import Gateway from '../Gateway/index.mjs'
20
+
21
+ // Methods
22
+
23
+ function appInfo(build) {
24
+ let params = { build }
25
+
26
+ return Gateway.request('Metrics.appInfo', params)
27
+ }
28
+
29
+ function error(type, code, description, visible, parameters, agePolicy) {
30
+ let params = { type, code, description, visible, parameters, agePolicy }
31
+
32
+ // remove the null params if they are optional
33
+ params = Gateway.removeNullOptionalParams(params, 2)
34
+
35
+ return Gateway.request('Metrics.error', params)
36
+ }
37
+
38
+ function event(schema, data, agePolicy) {
39
+ let params = { schema, data, agePolicy }
40
+
41
+ // remove the null params if they are optional
42
+ params = Gateway.removeNullOptionalParams(params, 1)
43
+
44
+ return Gateway.request('Metrics.event', params)
45
+ }
46
+
47
+ function mediaEnded(entityId, agePolicy) {
48
+ let params = { entityId, agePolicy }
49
+
50
+ // remove the null params if they are optional
51
+ params = Gateway.removeNullOptionalParams(params, 1)
52
+
53
+ return Gateway.request('Metrics.mediaEnded', params)
54
+ }
55
+
56
+ function mediaLoadStart(entityId, agePolicy) {
57
+ let params = { entityId, agePolicy }
58
+
59
+ // remove the null params if they are optional
60
+ params = Gateway.removeNullOptionalParams(params, 1)
61
+
62
+ return Gateway.request('Metrics.mediaLoadStart', params)
63
+ }
64
+
65
+ function mediaPause(entityId, agePolicy) {
66
+ let params = { entityId, agePolicy }
67
+
68
+ // remove the null params if they are optional
69
+ params = Gateway.removeNullOptionalParams(params, 1)
70
+
71
+ return Gateway.request('Metrics.mediaPause', params)
72
+ }
73
+
74
+ function mediaPlay(entityId, agePolicy) {
75
+ let params = { entityId, agePolicy }
76
+
77
+ // remove the null params if they are optional
78
+ params = Gateway.removeNullOptionalParams(params, 1)
79
+
80
+ return Gateway.request('Metrics.mediaPlay', params)
81
+ }
82
+
83
+ function mediaPlaying(entityId, agePolicy) {
84
+ let params = { entityId, agePolicy }
85
+
86
+ // remove the null params if they are optional
87
+ params = Gateway.removeNullOptionalParams(params, 1)
88
+
89
+ return Gateway.request('Metrics.mediaPlaying', params)
90
+ }
91
+
92
+ function mediaRateChanged(entityId, rate, agePolicy) {
93
+ let params = { entityId, rate, agePolicy }
94
+
95
+ // remove the null params if they are optional
96
+ params = Gateway.removeNullOptionalParams(params, 1)
97
+
98
+ return Gateway.request('Metrics.mediaRateChanged', params)
99
+ }
100
+
101
+ function mediaRenditionChanged(
102
+ entityId,
103
+ bitrate,
104
+ width,
105
+ height,
106
+ profile,
107
+ agePolicy,
108
+ ) {
109
+ let params = { entityId, bitrate, width, height, profile, agePolicy }
110
+
111
+ // remove the null params if they are optional
112
+ params = Gateway.removeNullOptionalParams(params, 2)
113
+
114
+ return Gateway.request('Metrics.mediaRenditionChanged', params)
115
+ }
116
+
117
+ function mediaSeeked(entityId, position, agePolicy) {
118
+ let params = { entityId, position, agePolicy }
119
+
120
+ // remove the null params if they are optional
121
+ params = Gateway.removeNullOptionalParams(params, 1)
122
+
123
+ return Gateway.request('Metrics.mediaSeeked', params)
124
+ }
125
+
126
+ function mediaSeeking(entityId, target, agePolicy) {
127
+ let params = { entityId, target, agePolicy }
128
+
129
+ // remove the null params if they are optional
130
+ params = Gateway.removeNullOptionalParams(params, 1)
131
+
132
+ return Gateway.request('Metrics.mediaSeeking', params)
133
+ }
134
+
135
+ function mediaWaiting(entityId, agePolicy) {
136
+ let params = { entityId, agePolicy }
137
+
138
+ // remove the null params if they are optional
139
+ params = Gateway.removeNullOptionalParams(params, 1)
140
+
141
+ return Gateway.request('Metrics.mediaWaiting', params)
142
+ }
143
+
144
+ function page(pageId, agePolicy) {
145
+ let params = { pageId, agePolicy }
146
+
147
+ // remove the null params if they are optional
148
+ params = Gateway.removeNullOptionalParams(params, 1)
149
+
150
+ return Gateway.request('Metrics.page', params)
151
+ }
152
+
153
+ function ready() {
154
+ let params = {}
155
+
156
+ return Gateway.request('Metrics.ready', params)
157
+ }
158
+
159
+ function startContent(entityId, agePolicy) {
160
+ let params = { entityId, agePolicy }
161
+
162
+ // remove the null params if they are optional
163
+ params = Gateway.removeNullOptionalParams(params, 2)
164
+
165
+ return Gateway.request('Metrics.startContent', params)
166
+ }
167
+
168
+ function stopContent(entityId, agePolicy) {
169
+ let params = { entityId, agePolicy }
170
+
171
+ // remove the null params if they are optional
172
+ params = Gateway.removeNullOptionalParams(params, 2)
173
+
174
+ return Gateway.request('Metrics.stopContent', params)
175
+ }
176
+
177
+ export default {
178
+ /**
179
+ *
180
+ */
181
+ ErrorType: {
182
+ NETWORK: 'network',
183
+ MEDIA: 'media',
184
+ RESTRICTION: 'restriction',
185
+ ENTITLEMENT: 'entitlement',
186
+ OTHER: 'other',
187
+ },
188
+
189
+ appInfo,
190
+ error,
191
+ event,
192
+ mediaEnded,
193
+ mediaLoadStart,
194
+ mediaPause,
195
+ mediaPlay,
196
+ mediaPlaying,
197
+ mediaRateChanged,
198
+ mediaRenditionChanged,
199
+ mediaSeeked,
200
+ mediaSeeking,
201
+ mediaWaiting,
202
+ page,
203
+ ready,
204
+ startContent,
205
+ stopContent,
206
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+ import MockProps from '../Prop/MockProps.mjs'
19
+
20
+ export default {
21
+ connected: function (params) {
22
+ return MockProps.mock('Network', 'connected', params, undefined, 0, true)
23
+ },
24
+ }
@@ -0,0 +1,70 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ import Gateway from '../Gateway/index.mjs'
20
+ import Events from '../Events/index.mjs'
21
+ import { registerEvents } from '../Events/index.mjs'
22
+ import Prop from '../Prop/index.mjs'
23
+
24
+ registerEvents('Network', ['onConnectedChanged'])
25
+
26
+ // onConnectedChanged is accessed via listen('onConnectedChanged, ...)
27
+
28
+ // Methods
29
+ function clear(...args) {
30
+ return Events.clear('Network', ...args)
31
+ }
32
+
33
+ function connected() {
34
+ let callbackOrValue = arguments[0]
35
+ let params = {}
36
+
37
+ // If there is only one parameter, it must be the callback.
38
+ if (arguments.length === 1 && typeof arguments[0] === 'function') {
39
+ callbackOrValue = arguments[0]
40
+ params = {}
41
+ }
42
+
43
+ return Prop.prop(
44
+ 'Network',
45
+ 'connected',
46
+ params,
47
+ callbackOrValue,
48
+ false,
49
+ true,
50
+ 0,
51
+ )
52
+ }
53
+ function listen(...args) {
54
+ return Events.listen('Network', ...args)
55
+ }
56
+
57
+ function once(...args) {
58
+ return Events.once('Network', ...args)
59
+ }
60
+
61
+ export default {
62
+ Events: {
63
+ ON_CONNECTED_CHANGED: 'onConnectedChanged',
64
+ },
65
+
66
+ clear,
67
+ connected,
68
+ listen,
69
+ once,
70
+ }
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ import accessibility from '../Accessibility/defaults.mjs'
20
+ import device from '../Device/defaults.mjs'
21
+ import localization from '../Localization/defaults.mjs'
22
+
23
+ export default {
24
+ localization: localization,
25
+ device: device,
26
+ accessibility: accessibility,
27
+ }
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright 2021 Comcast Cable Communications Management, LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ *
16
+ * SPDX-License-Identifier: Apache-2.0
17
+ */
18
+
19
+ import accessibility from '../Accessibility/index.mjs'
20
+ import device from '../Device/index.mjs'
21
+ import localization from '../Localization/index.mjs'
22
+
23
+ // public API
24
+ export default {
25
+ Localization: localization,
26
+ Device: device,
27
+ Accessibility: accessibility,
28
+ }
@@ -0,0 +1,28 @@
1
+ import router from './Router.mjs'
2
+
3
+ const mocks = {}
4
+
5
+ function mock(module, method, params, value, contextParameterCount, def) {
6
+ const type = router(params, value, contextParameterCount)
7
+ const hash = contextParameterCount
8
+ ? '.' +
9
+ Object.keys(params)
10
+ .filter((key) => key !== 'value')
11
+ .map((key) => params[key])
12
+ .join('.')
13
+ : ''
14
+ const key = `${module}.${method}${hash}`
15
+
16
+ if (type === 'getter') {
17
+ const value = mocks.hasOwnProperty(key) ? mocks[key] : def
18
+ return value
19
+ } else if (type === 'subscriber') {
20
+ } else if (type === 'setter') {
21
+ mocks[key] = value
22
+ return null
23
+ }
24
+ }
25
+
26
+ export default {
27
+ mock: mock,
28
+ }