subscribable-things 2.0.6 → 2.0.7
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 +102 -17
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -122,70 +122,155 @@ const element = h`<div>is matching: ${mediaQueryMatch('(max-width:600px)')}</div
|
|
|
122
122
|
document.body.appendChild(element);
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
### animationFrame()
|
|
125
|
+
### animationFrame()
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
function animationFrame(): SubscribableThing<number>;
|
|
129
|
+
```
|
|
126
130
|
|
|
127
131
|
This function wraps the [`requestAnimationFrame()`](https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-animationframeprovider-requestanimationframe) method. It emits the current timestamp of each animation frame.
|
|
128
132
|
|
|
129
|
-
### geolocation(options
|
|
133
|
+
### geolocation([options])
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
function geolocation(options?: PositionOptions): SubscribableThing<GeolocationPosition>;
|
|
137
|
+
```
|
|
130
138
|
|
|
131
139
|
This is a wrapper for the [Geolocation API](https://w3c.github.io/geolocation-api/). It uses [`watchPosition()`](https://w3c.github.io/geolocation-api/#watchposition-method) to gather the most recent [`GeolocationPosition`](https://w3c.github.io/geolocation-api/#dfn-a-new-geolocationposition) whenever it changes.
|
|
132
140
|
|
|
133
|
-
### intersections(htmlElement
|
|
141
|
+
### intersections(htmlElement, [options])
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
function intersections(
|
|
145
|
+
htmlElement: HTMLElement,
|
|
146
|
+
options?: IntersectionObserverInit
|
|
147
|
+
): SubscribableThing<IntersectionObserverEntry[]>;
|
|
148
|
+
```
|
|
134
149
|
|
|
135
150
|
This function is a wrapper for the [`IntersectionObserver`](https://developer.mozilla.org/docs/Web/API/IntersectionObserver).
|
|
136
151
|
|
|
137
|
-
### mediaDevices()
|
|
152
|
+
### mediaDevices()
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
function mediaDevices(): SubscribableThing<MediaDeviceInfo[]>;
|
|
156
|
+
```
|
|
138
157
|
|
|
139
158
|
This function is a wrapper for the [`enumerateDevices()`](https://developer.mozilla.org/docs/Web/API/MediaDevices/enumerateDevices) method of the [Media Capture and Streams specification](https://w3c.github.io/mediacapture-main). It will also listen for the [`devicechange` event](https://developer.mozilla.org/docs/Web/API/MediaDevices/devicechange_event) to emit a fresh list of devices whenever they change.
|
|
140
159
|
|
|
141
|
-
### mediaQueryMatch(mediaQueryString
|
|
160
|
+
### mediaQueryMatch(mediaQueryString)
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
function mediaQueryMatch(mediaQueryString: string): SubscribableThing<boolean>;
|
|
164
|
+
```
|
|
142
165
|
|
|
143
166
|
This function is a wrapper for the [`matchMedia()`](https://developer.mozilla.org/docs/Web/API/Window/matchMedia) method. It will emit a new value whenever the result of `matchMedia()` changes.
|
|
144
167
|
|
|
145
|
-
### midiInputs(midiAccess
|
|
168
|
+
### midiInputs(midiAccess)
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
function midiInputs(midiAccess: IMidiAccess): SubscribableThing<IMidiInput[]>;
|
|
172
|
+
```
|
|
146
173
|
|
|
147
174
|
This function returns the currently available MIDI input devices. It accepts a [`MIDIAccess`](https://developer.mozilla.org/docs/Web/API/MIDIAccess) object of the [Web MIDI API](https://webaudio.github.io/web-midi-api).
|
|
148
175
|
|
|
149
|
-
### midiOutputs(midiAccess
|
|
176
|
+
### midiOutputs(midiAccess)
|
|
177
|
+
|
|
178
|
+
```ts
|
|
179
|
+
function midiOutputs(midiAccess: IMidiAccess): SubscribableThing<IMidiOutput[]>;
|
|
180
|
+
```
|
|
150
181
|
|
|
151
182
|
This function returns the currently available MIDI output devices. It accepts a [`MIDIAccess`](https://developer.mozilla.org/docs/Web/API/MIDIAccess) object of the [Web MIDI API](https://webaudio.github.io/web-midi-api).
|
|
152
183
|
|
|
153
|
-
### metrics(options
|
|
184
|
+
### metrics(options)
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
function metrics(options: PerformanceObserverInit): SubscribableThing<PerformanceEntry[]>;
|
|
188
|
+
```
|
|
154
189
|
|
|
155
190
|
This function is a wrapper for the [`PerformanceObserver`](https://developer.mozilla.org/docs/Web/API/PerformanceObserver) as defined by the [Performance Timeline Level 2 specification](https://w3c.github.io/performance-timeline).
|
|
156
191
|
|
|
157
|
-
### mutations(htmlElement
|
|
192
|
+
### mutations(htmlElement, options)
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
function mutations(
|
|
196
|
+
htmlElement: HTMLElement,
|
|
197
|
+
options: MutationObserverInit
|
|
198
|
+
): SubscribableThing<MutationRecord[]>;
|
|
199
|
+
```
|
|
158
200
|
|
|
159
201
|
This function is a wrapper for the [`MutationObserver`](https://developer.mozilla.org/docs/Web/API/MutationObserver).
|
|
160
202
|
|
|
161
|
-
### on(target
|
|
203
|
+
### on(target, type, [options])
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
function on(
|
|
207
|
+
target: EventTarget,
|
|
208
|
+
type: string,
|
|
209
|
+
options?: boolean | AddEventListenerOptions
|
|
210
|
+
): SubscribableThing<Event>;
|
|
211
|
+
```
|
|
162
212
|
|
|
163
213
|
This function can be used to subscribe to events of a certain type dispatched from an [`EventTarget`](https://dom.spec.whatwg.org/#interface-eventtarget).
|
|
164
214
|
|
|
165
|
-
### online()
|
|
215
|
+
### online()
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
function online(): SubscribableThing<boolean>;
|
|
219
|
+
```
|
|
166
220
|
|
|
167
221
|
This function wraps the [`onLine`](https://developer.mozilla.org/docs/Web/API/NavigatorOnLine/onLine) property of the [`Navigator`](https://developer.mozilla.org/docs/Web/API/Navigator) and listens for the corresponding [`'online'`](https://developer.mozilla.org/docs/Web/API/Window/online_event) and [`'offline'`](https://developer.mozilla.org/docs/Web/API/Window/offline_event) events on the [`Window`](https://developer.mozilla.org/docs/Web/API/Window) to emit updates.
|
|
168
222
|
|
|
169
|
-
### permissionState(permissionDescriptor
|
|
223
|
+
### permissionState(permissionDescriptor)
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
function permissionState(
|
|
227
|
+
permissionDescriptor: PermissionDescriptor
|
|
228
|
+
): SubscribableThing<PermissionState>;
|
|
229
|
+
```
|
|
170
230
|
|
|
171
231
|
This function is a wrapper for the [`query()`](https://developer.mozilla.org/docs/Web/API/Permissions/query) method of the [Permissions API](https://w3c.github.io/permissions). It will monitor the permission status to emit a new state whenever it gets updated.
|
|
172
232
|
|
|
173
|
-
### reports(options
|
|
233
|
+
### reports([options])
|
|
234
|
+
|
|
235
|
+
```ts
|
|
236
|
+
function reports(options?: IReportingObserverOptions): SubscribableThing<IReport[]>;
|
|
237
|
+
```
|
|
174
238
|
|
|
175
239
|
This function is a wrapper for the [`ReportingObserver`](https://developer.mozilla.org/docs/Web/API/ReportingObserver) of the [Reporting API](https://w3c.github.io/reporting).
|
|
176
240
|
|
|
177
|
-
### resizes(htmlElement
|
|
241
|
+
### resizes(htmlElement, [options])
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
function resizes(
|
|
245
|
+
htmlElement: HTMLElement,
|
|
246
|
+
options?: IResizesObserverOptions
|
|
247
|
+
): SubscribableThing<IResizeObserverEntry[]>;
|
|
248
|
+
```
|
|
178
249
|
|
|
179
250
|
This function is a wrapper for the [`ResizeObserver`](https://developer.mozilla.org/docs/Web/API/ResizeObserver) of the [Resize Observer specification](https://drafts.csswg.org/resize-observer).
|
|
180
251
|
|
|
181
|
-
### unhandledRejection(coolingOffPeriod
|
|
252
|
+
### unhandledRejection(coolingOffPeriod)
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
function unhandledRejection(coolingOffPeriod: number): SubscribableThing<any>;
|
|
256
|
+
```
|
|
182
257
|
|
|
183
258
|
This function emits unhandled rejections. It will listen for the [`unhandledrejection` event](https://developer.mozilla.org/docs/Web/API/Window/unhandledrejection_event) to register possibly unhandled rejections. It will then wait for the cooling-off period to elapse before it emits the reason (aka the error) that caused the unhandled rejection. It is possible that a previously unhandled rejection gets handled later on in which case a [`rejectionhandled` event](https://developer.mozilla.org/docs/Web/API/Window/rejectionhandled_event) will be fired. If that happens during the cooling-off period nothing will be emitted by this function.
|
|
184
259
|
|
|
185
|
-
### videoFrame(videoElement
|
|
260
|
+
### videoFrame(videoElement)
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
function videoFrame(
|
|
264
|
+
videoElement: HTMLVideoElement
|
|
265
|
+
): SubscribableThing<{ now: number } & IVideoFrameMetadata>;
|
|
266
|
+
```
|
|
186
267
|
|
|
187
268
|
This function wraps the [`requestVideoFrameCallback()`](https://wicg.github.io/video-rvfc) method of the given [`HTMLVideoElement`](https://html.spec.whatwg.org/multipage/media.html#htmlvideoelement). It emits the current timestamp combined with the [`VideoFrameMetadata`](https://wicg.github.io/video-rvfc/#video-frame-metadata) object.
|
|
188
269
|
|
|
189
|
-
### wakeLock(type
|
|
270
|
+
### wakeLock(type)
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
function wakeLock(type: TWakeLockType): SubscribableThing<boolen>;
|
|
274
|
+
```
|
|
190
275
|
|
|
191
276
|
This function simplifies the usage of the [Screen Wake Lock API](https://w3c.github.io/screen-wake-lock). It emits true when a wake lock could be acquired and emits false once the wake lock gets released by the browser. As long as the subscription is alive it will continuosly try to get a new wake lock if the current one gets released.
|
package/package.json
CHANGED
|
@@ -21,28 +21,28 @@
|
|
|
21
21
|
},
|
|
22
22
|
"description": "A collection of reactive wrappers for various browser APIs.",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/core": "^7.16.
|
|
24
|
+
"@babel/core": "^7.16.12",
|
|
25
25
|
"@babel/plugin-external-helpers": "^7.16.7",
|
|
26
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
27
|
-
"@babel/preset-env": "^7.16.
|
|
28
|
-
"@commitlint/cli": "^16.0
|
|
26
|
+
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
27
|
+
"@babel/preset-env": "^7.16.11",
|
|
28
|
+
"@commitlint/cli": "^16.1.0",
|
|
29
29
|
"@commitlint/config-angular": "^16.0.0",
|
|
30
30
|
"@rollup/plugin-babel": "^5.3.0",
|
|
31
31
|
"baconjs": "^3.0.17",
|
|
32
32
|
"body-parser": "^1.19.1",
|
|
33
33
|
"callbag-basics": "^4.0.0",
|
|
34
|
-
"chai": "^4.3.
|
|
34
|
+
"chai": "^4.3.6",
|
|
35
35
|
"commitizen": "^4.2.4",
|
|
36
36
|
"cz-conventional-changelog": "^3.3.0",
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint-config-holy-grail": "^
|
|
37
|
+
"eslint": "^8.8.0",
|
|
38
|
+
"eslint-config-holy-grail": "^51.0.2",
|
|
39
39
|
"grunt": "^1.4.1",
|
|
40
40
|
"grunt-cli": "^1.4.3",
|
|
41
41
|
"grunt-contrib-clean": "^2.0.0",
|
|
42
42
|
"grunt-sh": "^0.2.0",
|
|
43
43
|
"husky": "^7.0.4",
|
|
44
|
-
"hyperf": "^1.
|
|
45
|
-
"karma": "^6.3.
|
|
44
|
+
"hyperf": "^1.3.0",
|
|
45
|
+
"karma": "^6.3.13",
|
|
46
46
|
"karma-browserstack-launcher": "^1.6.0",
|
|
47
47
|
"karma-chrome-launcher": "^3.1.0",
|
|
48
48
|
"karma-firefox-launcher": "^2.1.2",
|
|
@@ -53,20 +53,20 @@
|
|
|
53
53
|
"kefir": "^3.8.8",
|
|
54
54
|
"load-grunt-config": "^4.0.1",
|
|
55
55
|
"midi-test": "^1.1.9",
|
|
56
|
-
"mocha": "^9.
|
|
56
|
+
"mocha": "^9.2.0",
|
|
57
57
|
"prettier": "^2.5.1",
|
|
58
58
|
"pretty-quick": "^3.1.3",
|
|
59
|
-
"rollup": "^2.
|
|
59
|
+
"rollup": "^2.67.0",
|
|
60
60
|
"rxjs": "^7.5.2",
|
|
61
61
|
"rxjs-for-await": "^1.0.0",
|
|
62
62
|
"sinon": "^11.1.2",
|
|
63
63
|
"sinon-chai": "^3.7.0",
|
|
64
64
|
"ts-loader": "^9.2.6",
|
|
65
|
-
"tsconfig-holy-grail": "^11.1.
|
|
65
|
+
"tsconfig-holy-grail": "^11.1.25",
|
|
66
66
|
"tslint": "^6.1.3",
|
|
67
67
|
"tslint-config-holy-grail": "^53.2.26",
|
|
68
|
-
"typescript": "^4.5.
|
|
69
|
-
"webpack": "^5.
|
|
68
|
+
"typescript": "^4.5.5",
|
|
69
|
+
"webpack": "^5.68.0",
|
|
70
70
|
"xstream": "^11.14.0"
|
|
71
71
|
},
|
|
72
72
|
"files": [
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
"test": "grunt lint && grunt test"
|
|
96
96
|
},
|
|
97
97
|
"types": "build/es2019/module.d.ts",
|
|
98
|
-
"version": "2.0.
|
|
98
|
+
"version": "2.0.7"
|
|
99
99
|
}
|