subscribable-things 2.0.10 → 2.1.2
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 +8 -0
- package/build/es2019/factories/attribute.d.ts +6 -0
- package/build/es2019/factories/attribute.d.ts.map +1 -0
- package/build/es2019/factories/attribute.js +11 -0
- package/build/es2019/factories/attribute.js.map +1 -0
- package/build/es2019/factories/map-subscribable-thing.d.ts +3 -0
- package/build/es2019/factories/map-subscribable-thing.d.ts.map +1 -0
- package/build/es2019/factories/map-subscribable-thing.js +2 -0
- package/build/es2019/factories/map-subscribable-thing.js.map +1 -0
- package/build/es2019/factories/prepend-subscribable-thing.d.ts +3 -0
- package/build/es2019/factories/prepend-subscribable-thing.d.ts.map +1 -0
- package/build/es2019/factories/prepend-subscribable-thing.js +5 -0
- package/build/es2019/factories/prepend-subscribable-thing.js.map +1 -0
- package/build/es2019/module.d.ts +2 -1
- package/build/es2019/module.d.ts.map +1 -1
- package/build/es2019/module.js +7 -1
- package/build/es2019/module.js.map +1 -1
- package/build/es5/bundle.js +46 -1
- package/package.json +24 -24
- package/src/factories/attribute.ts +26 -0
- package/src/factories/map-subscribable-thing.ts +9 -0
- package/src/factories/prepend-subscribable-thing.ts +13 -0
- package/src/module.ts +10 -2
package/README.md
CHANGED
|
@@ -130,6 +130,14 @@ function animationFrame(): SubscribableThing<number>;
|
|
|
130
130
|
|
|
131
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.
|
|
132
132
|
|
|
133
|
+
### attribute(htmlElement, name)
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
function attribute(htmlElement: HTMLElement, name: string): TSubscribableThing<null | string>;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This function uses `mutations()` on the inside to emit the latest value of the attribute with the given name.
|
|
140
|
+
|
|
133
141
|
### geolocation([options])
|
|
134
142
|
|
|
135
143
|
```ts
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TSubscribableThing } from '../types';
|
|
2
|
+
import type { createMapSubscribableThing } from './map-subscribable-thing';
|
|
3
|
+
import type { createMutations } from './mutations';
|
|
4
|
+
import type { createPrependSubscribableThing } from './prepend-subscribable-thing';
|
|
5
|
+
export declare const createAttribute: (mapSubscribableThing: ReturnType<typeof createMapSubscribableThing>, mutations: ReturnType<typeof createMutations>, prependSubscribableThing: ReturnType<typeof createPrependSubscribableThing>) => (htmlElement: HTMLElement, name: string) => TSubscribableThing<null | string>;
|
|
6
|
+
//# sourceMappingURL=attribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute.d.ts","sourceRoot":"","sources":["../../../src/factories/attribute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAEnF,eAAO,MAAM,eAAe,yBACF,WAAW,iCAAiC,CAAC,aACxD,WAAW,sBAAsB,CAAC,4BACnB,WAAW,qCAAqC,CAAC,mBAEtD,WAAW,QAAQ,MAAM,KAAG,mBAAmB,IAAI,GAAG,MAAM,CAepF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const createAttribute = (mapSubscribableThing, mutations, prependSubscribableThing) => {
|
|
2
|
+
return (htmlElement, name) => {
|
|
3
|
+
const getAttribute = () => htmlElement.getAttribute(name);
|
|
4
|
+
return prependSubscribableThing(mapSubscribableThing(mutations(htmlElement, {
|
|
5
|
+
attributeFilter: [name],
|
|
6
|
+
childList: false,
|
|
7
|
+
subtree: false
|
|
8
|
+
}), () => getAttribute()), getAttribute());
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=attribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute.js","sourceRoot":"","sources":["../../../src/factories/attribute.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,eAAe,GAAG,CAC3B,oBAAmE,EACnE,SAA6C,EAC7C,wBAA2E,EAC7E,EAAE;IACA,OAAO,CAAC,WAAwB,EAAE,IAAY,EAAqC,EAAE;QACjF,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAE1D,OAAO,wBAAwB,CAC3B,oBAAoB,CAChB,SAAS,CAAC,WAAW,EAAE;YACnB,eAAe,EAAE,CAAC,IAAI,CAAC;YACvB,SAAS,EAAE,KAAK;YAChB,OAAO,EAAE,KAAK;SACjB,CAAC,EACF,GAAG,EAAE,CAAC,YAAY,EAAE,CACvB,EACD,YAAY,EAAE,CACjB,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TSubscribableThing, TWrapSubscribeFunctionFunction } from '../types';
|
|
2
|
+
export declare const createMapSubscribableThing: (wrapSubscribeFunction: TWrapSubscribeFunctionFunction) => <TValue, TMappedValue>(subscribableThing: TSubscribableThing<TValue>, map: (value: TValue) => TMappedValue) => TSubscribableThing<TMappedValue>;
|
|
3
|
+
//# sourceMappingURL=map-subscribable-thing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-subscribable-thing.d.ts","sourceRoot":"","sources":["../../../src/factories/map-subscribable-thing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAE9E,eAAO,MAAM,0BAA0B,0BACX,8BAA8B,oJAKiE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-subscribable-thing.js","sourceRoot":"","sources":["../../../src/factories/map-subscribable-thing.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,0BAA0B,GACnC,CAAC,qBAAqD,EAAE,EAAE,CAC1D,CACI,iBAA6C,EAC7C,GAAoC,EACJ,EAAE,CAClC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TSubscribableThing, TWrapSubscribeFunctionFunction } from '../types';
|
|
2
|
+
export declare const createPrependSubscribableThing: (wrapSubscribeFunction: TWrapSubscribeFunctionFunction) => <TValue, TPrependedValue>(subscribableThing: TSubscribableThing<TValue>, prependedValue: TPrependedValue) => TSubscribableThing<TValue | TPrependedValue>;
|
|
3
|
+
//# sourceMappingURL=prepend-subscribable-thing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepend-subscribable-thing.d.ts","sourceRoot":"","sources":["../../../src/factories/prepend-subscribable-thing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAE9E,eAAO,MAAM,8BAA8B,0BACf,8BAA8B,8JAShD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const createPrependSubscribableThing = (wrapSubscribeFunction) => (subscribableThing, prependedValue) => wrapSubscribeFunction((observer) => {
|
|
2
|
+
observer.next(prependedValue);
|
|
3
|
+
return subscribableThing(observer);
|
|
4
|
+
});
|
|
5
|
+
//# sourceMappingURL=prepend-subscribable-thing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepend-subscribable-thing.js","sourceRoot":"","sources":["../../../src/factories/prepend-subscribable-thing.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,8BAA8B,GACvC,CAAC,qBAAqD,EAAE,EAAE,CAC1D,CACI,iBAA6C,EAC7C,cAA+B,EACa,EAAE,CAC9C,qBAAqB,CAAC,CAAC,QAAQ,EAAE,EAAE;IAC/B,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAE9B,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC"}
|
package/build/es2019/module.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './interfaces/index';
|
|
2
2
|
export * from './types/index';
|
|
3
3
|
export declare const animationFrame: import("./types/animation-frame-function").TAnimationFrameFunction;
|
|
4
|
+
export declare const mutations: import("./types/mutations-function").TMutationsFunction;
|
|
5
|
+
export declare const attribute: (htmlElement: HTMLElement, name: string) => import("./types/subscribable-thing").TSubscribableThing<string | null>;
|
|
4
6
|
export declare const geolocation: (options?: PositionOptions | undefined) => import("./types/subscribable-thing").TSubscribableThing<GeolocationPosition>;
|
|
5
7
|
export declare const intersections: import("./types/intersections-function").TIntersectionsFunction;
|
|
6
8
|
export declare const mediaDevices: import("./types/media-devices-function").TMediaDevicesFunction;
|
|
@@ -8,7 +10,6 @@ export declare const mediaQueryMatch: import("./types/media-query-match-function
|
|
|
8
10
|
export declare const metrics: import("./types/metrics-function").TMetricsFunction;
|
|
9
11
|
export declare const midiInputs: import("./types/midi-inputs-function").TMidiInputsFunction;
|
|
10
12
|
export declare const midiOutputs: import("./types/midi-outputs-function").TMidiOutputsFunction;
|
|
11
|
-
export declare const mutations: import("./types/mutations-function").TMutationsFunction;
|
|
12
13
|
export declare const on: import("./types/on-function").TOnFunction;
|
|
13
14
|
export declare const online: import("./types/online-function").TOnlineFunction;
|
|
14
15
|
export declare const permissionState: import("./types/permission-state-function").TPermissionStateFunction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AA6BA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAK9B,eAAO,MAAM,cAAc,oEAA6E,CAAC;AAEzG,eAAO,MAAM,SAAS,yDAAwE,CAAC;AAK/F,eAAO,MAAM,SAAS,oHAA6E,CAAC;AAEpG,eAAO,MAAM,WAAW,yHAA0E,CAAC;AAEnG,eAAO,MAAM,aAAa,iEAA4E,CAAC;AAEvG,eAAO,MAAM,YAAY,gEAA2E,CAAC;AAErG,eAAO,MAAM,eAAe,uEAA8E,CAAC;AAE3G,eAAO,MAAM,OAAO,qDAAsE,CAAC;AAE3F,eAAO,MAAM,UAAU,4DAA0C,CAAC;AAElE,eAAO,MAAM,WAAW,8DAA2C,CAAC;AAEpE,eAAO,MAAM,EAAE,2CAAkC,CAAC;AAElD,eAAO,MAAM,MAAM,mDAAqE,CAAC;AAEzF,eAAO,MAAM,eAAe,sEAA8E,CAAC;AAE3G,eAAO,MAAM,OAAO,qDAAsE,CAAC;AAE3F,eAAO,MAAM,OAAO,qDAAsE,CAAC;AAE3F,eAAO,MAAM,kBAAkB,4EAAiF,CAAC;AAEjH,eAAO,MAAM,UAAU,4DAAiE,CAAC;AAEzF,eAAO,MAAM,QAAQ,wDAAuE,CAAC"}
|
package/build/es2019/module.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { patch, toObserver } from 'rxjs-interop';
|
|
2
2
|
import { createAnimationFrame } from './factories/animation-frame';
|
|
3
|
+
import { createAttribute } from './factories/attribute';
|
|
3
4
|
import { createGeolocation } from './factories/geolocation';
|
|
4
5
|
import { createIntersections } from './factories/intersections';
|
|
6
|
+
import { createMapSubscribableThing } from './factories/map-subscribable-thing';
|
|
5
7
|
import { createMediaDevices } from './factories/media-devices';
|
|
6
8
|
import { createMediaQueryMatch } from './factories/media-query-match';
|
|
7
9
|
import { createMetrics } from './factories/metrics';
|
|
@@ -11,6 +13,7 @@ import { createMutations } from './factories/mutations';
|
|
|
11
13
|
import { createOn } from './factories/on';
|
|
12
14
|
import { createOnline } from './factories/online';
|
|
13
15
|
import { createPermissionState } from './factories/permission-state';
|
|
16
|
+
import { createPrependSubscribableThing } from './factories/prepend-subscribable-thing';
|
|
14
17
|
import { createReports } from './factories/reports';
|
|
15
18
|
import { createResizes } from './factories/resizes';
|
|
16
19
|
import { createUnhandledRejection } from './factories/unhandled-rejection';
|
|
@@ -28,6 +31,10 @@ export * from './types/index';
|
|
|
28
31
|
const window = createWindow();
|
|
29
32
|
const wrapSubscribeFunction = createWrapSubscribeFunction(patch, toObserver);
|
|
30
33
|
export const animationFrame = createAnimationFrame(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
34
|
+
export const mutations = createMutations(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
35
|
+
const mapSubscribableThing = createMapSubscribableThing(wrapSubscribeFunction);
|
|
36
|
+
const prependSubscribableThing = createPrependSubscribableThing(wrapSubscribeFunction);
|
|
37
|
+
export const attribute = createAttribute(mapSubscribableThing, mutations, prependSubscribableThing);
|
|
31
38
|
export const geolocation = createGeolocation(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
32
39
|
export const intersections = createIntersections(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
33
40
|
export const mediaDevices = createMediaDevices(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
@@ -35,7 +42,6 @@ export const mediaQueryMatch = createMediaQueryMatch(emitNotSupportedError, wind
|
|
|
35
42
|
export const metrics = createMetrics(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
36
43
|
export const midiInputs = createMidiInputs(wrapSubscribeFunction);
|
|
37
44
|
export const midiOutputs = createMidiOutputs(wrapSubscribeFunction);
|
|
38
|
-
export const mutations = createMutations(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
39
45
|
export const on = createOn(wrapSubscribeFunction);
|
|
40
46
|
export const online = createOnline(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
41
47
|
export const permissionState = createPermissionState(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OA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B,CAAC,CAAC"}
|
package/build/es5/bundle.js
CHANGED
|
@@ -26,6 +26,22 @@
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
var createAttribute = function createAttribute(mapSubscribableThing, mutations, prependSubscribableThing) {
|
|
30
|
+
return function (htmlElement, name) {
|
|
31
|
+
var getAttribute = function getAttribute() {
|
|
32
|
+
return htmlElement.getAttribute(name);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return prependSubscribableThing(mapSubscribableThing(mutations(htmlElement, {
|
|
36
|
+
attributeFilter: [name],
|
|
37
|
+
childList: false,
|
|
38
|
+
subtree: false
|
|
39
|
+
}), function () {
|
|
40
|
+
return getAttribute();
|
|
41
|
+
}), getAttribute());
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
29
45
|
var createGeolocation = function createGeolocation(emitNotSupportedError, window, wrapSubscribeFunction) {
|
|
30
46
|
return function (options) {
|
|
31
47
|
return wrapSubscribeFunction(function (observer) {
|
|
@@ -69,6 +85,22 @@
|
|
|
69
85
|
};
|
|
70
86
|
};
|
|
71
87
|
|
|
88
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
89
|
+
|
|
90
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
91
|
+
|
|
92
|
+
var createMapSubscribableThing = function createMapSubscribableThing(wrapSubscribeFunction) {
|
|
93
|
+
return function (subscribableThing, map) {
|
|
94
|
+
return wrapSubscribeFunction(function (observer) {
|
|
95
|
+
return subscribableThing(_objectSpread$1(_objectSpread$1({}, observer), {}, {
|
|
96
|
+
next: function next(value) {
|
|
97
|
+
return observer.next(map(value));
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
|
|
72
104
|
var createMediaDevices = function createMediaDevices(emitNotSupportedError, window, wrapSubscribeFunction) {
|
|
73
105
|
return function () {
|
|
74
106
|
return wrapSubscribeFunction(function (observer) {
|
|
@@ -304,6 +336,15 @@
|
|
|
304
336
|
};
|
|
305
337
|
};
|
|
306
338
|
|
|
339
|
+
var createPrependSubscribableThing = function createPrependSubscribableThing(wrapSubscribeFunction) {
|
|
340
|
+
return function (subscribableThing, prependedValue) {
|
|
341
|
+
return wrapSubscribeFunction(function (observer) {
|
|
342
|
+
observer.next(prependedValue);
|
|
343
|
+
return subscribableThing(observer);
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
|
|
307
348
|
var createReports = function createReports(emitNotSupportedError, window, wrapSubscribeFunction) {
|
|
308
349
|
return function (options) {
|
|
309
350
|
return wrapSubscribeFunction(function (observer) {
|
|
@@ -543,6 +584,10 @@
|
|
|
543
584
|
var window$1 = createWindow();
|
|
544
585
|
var wrapSubscribeFunction = createWrapSubscribeFunction(rxjsInterop.patch, rxjsInterop.toObserver);
|
|
545
586
|
var animationFrame = createAnimationFrame(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
587
|
+
var mutations = createMutations(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
588
|
+
var mapSubscribableThing = createMapSubscribableThing(wrapSubscribeFunction);
|
|
589
|
+
var prependSubscribableThing = createPrependSubscribableThing(wrapSubscribeFunction);
|
|
590
|
+
var attribute = createAttribute(mapSubscribableThing, mutations, prependSubscribableThing);
|
|
546
591
|
var geolocation = createGeolocation(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
547
592
|
var intersections = createIntersections(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
548
593
|
var mediaDevices = createMediaDevices(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
@@ -550,7 +595,6 @@
|
|
|
550
595
|
var metrics = createMetrics(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
551
596
|
var midiInputs = createMidiInputs(wrapSubscribeFunction);
|
|
552
597
|
var midiOutputs = createMidiOutputs(wrapSubscribeFunction);
|
|
553
|
-
var mutations = createMutations(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
554
598
|
var on = createOn(wrapSubscribeFunction);
|
|
555
599
|
var online = createOnline(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
556
600
|
var permissionState = createPermissionState(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
@@ -561,6 +605,7 @@
|
|
|
561
605
|
var wakeLock = createWakeLock(emitNotSupportedError, window$1, wrapSubscribeFunction);
|
|
562
606
|
|
|
563
607
|
exports.animationFrame = animationFrame;
|
|
608
|
+
exports.attribute = attribute;
|
|
564
609
|
exports.geolocation = geolocation;
|
|
565
610
|
exports.intersections = intersections;
|
|
566
611
|
exports.mediaDevices = mediaDevices;
|
package/package.json
CHANGED
|
@@ -15,36 +15,36 @@
|
|
|
15
15
|
}
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@babel/runtime": "^7.17.
|
|
18
|
+
"@babel/runtime": "^7.17.9",
|
|
19
19
|
"rxjs-interop": "^2.0.0",
|
|
20
|
-
"tslib": "^2.
|
|
20
|
+
"tslib": "^2.4.0"
|
|
21
21
|
},
|
|
22
22
|
"description": "A collection of reactive wrappers for various browser APIs.",
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@babel/core": "^7.17.
|
|
24
|
+
"@babel/core": "^7.17.9",
|
|
25
25
|
"@babel/plugin-external-helpers": "^7.16.7",
|
|
26
26
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
27
27
|
"@babel/preset-env": "^7.16.11",
|
|
28
|
-
"@commitlint/cli": "^16.2.
|
|
29
|
-
"@commitlint/config-angular": "^16.2.
|
|
30
|
-
"@rollup/plugin-babel": "^5.3.
|
|
28
|
+
"@commitlint/cli": "^16.2.4",
|
|
29
|
+
"@commitlint/config-angular": "^16.2.4",
|
|
30
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
31
31
|
"baconjs": "^3.0.17",
|
|
32
|
-
"body-parser": "^1.
|
|
32
|
+
"body-parser": "^1.20.0",
|
|
33
33
|
"callbag-basics": "^4.0.0",
|
|
34
34
|
"chai": "^4.3.6",
|
|
35
35
|
"commitizen": "^4.2.4",
|
|
36
36
|
"cz-conventional-changelog": "^3.3.0",
|
|
37
|
-
"eslint": "^8.
|
|
38
|
-
"eslint-config-holy-grail": "^52.0.
|
|
39
|
-
"grunt": "^1.
|
|
37
|
+
"eslint": "^8.14.0",
|
|
38
|
+
"eslint-config-holy-grail": "^52.0.8",
|
|
39
|
+
"grunt": "^1.5.2",
|
|
40
40
|
"grunt-cli": "^1.4.3",
|
|
41
|
-
"grunt-contrib-clean": "^2.0.
|
|
41
|
+
"grunt-contrib-clean": "^2.0.1",
|
|
42
42
|
"grunt-sh": "^0.2.0",
|
|
43
43
|
"husky": "^7.0.4",
|
|
44
44
|
"hyperf": "^1.3.0",
|
|
45
|
-
"karma": "^6.3.
|
|
45
|
+
"karma": "^6.3.19",
|
|
46
46
|
"karma-browserstack-launcher": "^1.6.0",
|
|
47
|
-
"karma-chrome-launcher": "^3.1.
|
|
47
|
+
"karma-chrome-launcher": "^3.1.1",
|
|
48
48
|
"karma-firefox-launcher": "^2.1.2",
|
|
49
49
|
"karma-mocha": "^2.0.1",
|
|
50
50
|
"karma-safari-launcher": "^1.0.0",
|
|
@@ -52,21 +52,21 @@
|
|
|
52
52
|
"karma-webpack": "^5.0.0",
|
|
53
53
|
"kefir": "^3.8.8",
|
|
54
54
|
"load-grunt-config": "^4.0.1",
|
|
55
|
-
"midi-test": "^1.2.
|
|
56
|
-
"mocha": "^9.2.
|
|
57
|
-
"prettier": "^2.
|
|
55
|
+
"midi-test": "^1.2.1",
|
|
56
|
+
"mocha": "^9.2.2",
|
|
57
|
+
"prettier": "^2.6.2",
|
|
58
58
|
"pretty-quick": "^3.1.3",
|
|
59
|
-
"rollup": "^2.
|
|
60
|
-
"rxjs": "^7.5.
|
|
59
|
+
"rollup": "^2.70.2",
|
|
60
|
+
"rxjs": "^7.5.5",
|
|
61
61
|
"rxjs-for-await": "^1.0.0",
|
|
62
62
|
"sinon": "^11.1.2",
|
|
63
63
|
"sinon-chai": "^3.7.0",
|
|
64
|
-
"ts-loader": "^9.2.
|
|
65
|
-
"tsconfig-holy-grail": "^11.1.
|
|
64
|
+
"ts-loader": "^9.2.9",
|
|
65
|
+
"tsconfig-holy-grail": "^11.1.30",
|
|
66
66
|
"tslint": "^6.1.3",
|
|
67
|
-
"tslint-config-holy-grail": "^53.2.
|
|
68
|
-
"typescript": "^4.
|
|
69
|
-
"webpack": "^5.
|
|
67
|
+
"tslint-config-holy-grail": "^53.2.28",
|
|
68
|
+
"typescript": "^4.6.3",
|
|
69
|
+
"webpack": "^5.72.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.
|
|
98
|
+
"version": "2.1.2"
|
|
99
99
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TSubscribableThing } from '../types';
|
|
2
|
+
import type { createMapSubscribableThing } from './map-subscribable-thing';
|
|
3
|
+
import type { createMutations } from './mutations';
|
|
4
|
+
import type { createPrependSubscribableThing } from './prepend-subscribable-thing';
|
|
5
|
+
|
|
6
|
+
export const createAttribute = (
|
|
7
|
+
mapSubscribableThing: ReturnType<typeof createMapSubscribableThing>,
|
|
8
|
+
mutations: ReturnType<typeof createMutations>,
|
|
9
|
+
prependSubscribableThing: ReturnType<typeof createPrependSubscribableThing>
|
|
10
|
+
) => {
|
|
11
|
+
return (htmlElement: HTMLElement, name: string): TSubscribableThing<null | string> => {
|
|
12
|
+
const getAttribute = () => htmlElement.getAttribute(name);
|
|
13
|
+
|
|
14
|
+
return prependSubscribableThing(
|
|
15
|
+
mapSubscribableThing(
|
|
16
|
+
mutations(htmlElement, {
|
|
17
|
+
attributeFilter: [name],
|
|
18
|
+
childList: false,
|
|
19
|
+
subtree: false
|
|
20
|
+
}),
|
|
21
|
+
() => getAttribute()
|
|
22
|
+
),
|
|
23
|
+
getAttribute()
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TSubscribableThing, TWrapSubscribeFunctionFunction } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createMapSubscribableThing =
|
|
4
|
+
(wrapSubscribeFunction: TWrapSubscribeFunctionFunction) =>
|
|
5
|
+
<TValue, TMappedValue>(
|
|
6
|
+
subscribableThing: TSubscribableThing<TValue>,
|
|
7
|
+
map: (value: TValue) => TMappedValue
|
|
8
|
+
): TSubscribableThing<TMappedValue> =>
|
|
9
|
+
wrapSubscribeFunction((observer) => subscribableThing({ ...observer, next: (value) => observer.next(map(value)) }));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TSubscribableThing, TWrapSubscribeFunctionFunction } from '../types';
|
|
2
|
+
|
|
3
|
+
export const createPrependSubscribableThing =
|
|
4
|
+
(wrapSubscribeFunction: TWrapSubscribeFunctionFunction) =>
|
|
5
|
+
<TValue, TPrependedValue>(
|
|
6
|
+
subscribableThing: TSubscribableThing<TValue>,
|
|
7
|
+
prependedValue: TPrependedValue
|
|
8
|
+
): TSubscribableThing<TPrependedValue | TValue> =>
|
|
9
|
+
wrapSubscribeFunction((observer) => {
|
|
10
|
+
observer.next(prependedValue);
|
|
11
|
+
|
|
12
|
+
return subscribableThing(observer);
|
|
13
|
+
});
|
package/src/module.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { patch, toObserver } from 'rxjs-interop';
|
|
2
2
|
import { createAnimationFrame } from './factories/animation-frame';
|
|
3
|
+
import { createAttribute } from './factories/attribute';
|
|
3
4
|
import { createGeolocation } from './factories/geolocation';
|
|
4
5
|
import { createIntersections } from './factories/intersections';
|
|
6
|
+
import { createMapSubscribableThing } from './factories/map-subscribable-thing';
|
|
5
7
|
import { createMediaDevices } from './factories/media-devices';
|
|
6
8
|
import { createMediaQueryMatch } from './factories/media-query-match';
|
|
7
9
|
import { createMetrics } from './factories/metrics';
|
|
@@ -11,6 +13,7 @@ import { createMutations } from './factories/mutations';
|
|
|
11
13
|
import { createOn } from './factories/on';
|
|
12
14
|
import { createOnline } from './factories/online';
|
|
13
15
|
import { createPermissionState } from './factories/permission-state';
|
|
16
|
+
import { createPrependSubscribableThing } from './factories/prepend-subscribable-thing';
|
|
14
17
|
import { createReports } from './factories/reports';
|
|
15
18
|
import { createResizes } from './factories/resizes';
|
|
16
19
|
import { createUnhandledRejection } from './factories/unhandled-rejection';
|
|
@@ -32,6 +35,13 @@ const wrapSubscribeFunction = createWrapSubscribeFunction(patch, toObserver);
|
|
|
32
35
|
|
|
33
36
|
export const animationFrame = createAnimationFrame(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
34
37
|
|
|
38
|
+
export const mutations = createMutations(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
39
|
+
|
|
40
|
+
const mapSubscribableThing = createMapSubscribableThing(wrapSubscribeFunction);
|
|
41
|
+
const prependSubscribableThing = createPrependSubscribableThing(wrapSubscribeFunction);
|
|
42
|
+
|
|
43
|
+
export const attribute = createAttribute(mapSubscribableThing, mutations, prependSubscribableThing);
|
|
44
|
+
|
|
35
45
|
export const geolocation = createGeolocation(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
36
46
|
|
|
37
47
|
export const intersections = createIntersections(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
@@ -46,8 +56,6 @@ export const midiInputs = createMidiInputs(wrapSubscribeFunction);
|
|
|
46
56
|
|
|
47
57
|
export const midiOutputs = createMidiOutputs(wrapSubscribeFunction);
|
|
48
58
|
|
|
49
|
-
export const mutations = createMutations(emitNotSupportedError, window, wrapSubscribeFunction);
|
|
50
|
-
|
|
51
59
|
export const on = createOn(wrapSubscribeFunction);
|
|
52
60
|
|
|
53
61
|
export const online = createOnline(emitNotSupportedError, window, wrapSubscribeFunction);
|