@donmahallem/rxjs-zone 0.2.17 → 0.3.3
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/dist/cjs/dist/index.d.ts +1 -0
- package/dist/cjs/{types2 → dist}/index.d.ts.map +0 -0
- package/dist/cjs/dist/index.spec.d.ts +1 -0
- package/dist/cjs/{types2 → dist}/index.spec.d.ts.map +0 -0
- package/dist/cjs/dist/run-inside-zone.d.ts +1 -0
- package/dist/cjs/{types2 → dist}/run-inside-zone.d.ts.map +0 -0
- package/dist/cjs/dist/run-outside-zone.d.ts +1 -0
- package/dist/cjs/{types2 → dist}/run-outside-zone.d.ts.map +0 -0
- package/dist/cjs/index.js +53 -37
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/dist/index.d.ts +1 -0
- package/dist/esm/{types2 → dist}/index.d.ts.map +0 -0
- package/dist/esm/dist/index.spec.d.ts +1 -0
- package/dist/esm/{types2 → dist}/index.spec.d.ts.map +0 -0
- package/dist/esm/dist/run-inside-zone.d.ts +1 -0
- package/dist/esm/{types2 → dist}/run-inside-zone.d.ts.map +0 -0
- package/dist/esm/dist/run-outside-zone.d.ts +1 -0
- package/dist/esm/{types2 → dist}/run-outside-zone.d.ts.map +0 -0
- package/dist/esm/index.js +53 -37
- package/dist/esm/index.js.map +1 -1
- package/dist/types/run-inside-zone.d.ts +8 -2
- package/dist/types/run-inside-zone.d.ts.map +1 -1
- package/dist/types/run-outside-zone.d.ts +8 -2
- package/dist/types/run-outside-zone.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/run-inside-zone.ts +11 -4
- package/src/run-outside-zone.ts +11 -4
- package/dist/cjs/dist/types2/index.d.ts +0 -3
- package/dist/cjs/dist/types2/index.d.ts.map +0 -1
- package/dist/cjs/dist/types2/index.spec.d.ts +0 -2
- package/dist/cjs/dist/types2/index.spec.d.ts.map +0 -1
- package/dist/cjs/dist/types2/run-inside-zone.d.ts +0 -4
- package/dist/cjs/dist/types2/run-inside-zone.d.ts.map +0 -1
- package/dist/cjs/dist/types2/run-outside-zone.d.ts +0 -4
- package/dist/cjs/dist/types2/run-outside-zone.d.ts.map +0 -1
- package/dist/cjs/types2/index.d.ts +0 -3
- package/dist/cjs/types2/index.spec.d.ts +0 -2
- package/dist/cjs/types2/run-inside-zone.d.ts +0 -4
- package/dist/cjs/types2/run-outside-zone.d.ts +0 -4
- package/dist/dts/index.d.ts +0 -8
- package/dist/esm/dist/types2/index.d.ts +0 -3
- package/dist/esm/dist/types2/index.d.ts.map +0 -1
- package/dist/esm/dist/types2/index.spec.d.ts +0 -2
- package/dist/esm/dist/types2/index.spec.d.ts.map +0 -1
- package/dist/esm/dist/types2/run-inside-zone.d.ts +0 -4
- package/dist/esm/dist/types2/run-inside-zone.d.ts.map +0 -1
- package/dist/esm/dist/types2/run-outside-zone.d.ts +0 -4
- package/dist/esm/dist/types2/run-outside-zone.d.ts.map +0 -1
- package/dist/esm/types2/index.d.ts +0 -3
- package/dist/esm/types2/index.spec.d.ts +0 -2
- package/dist/esm/types2/run-inside-zone.d.ts +0 -4
- package/dist/esm/types2/run-outside-zone.d.ts +0 -4
package/dist/cjs/dist/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -9,52 +9,68 @@ const rxjs = require('rxjs');
|
|
|
9
9
|
* Package @donmahallem/rxjs-zone
|
|
10
10
|
* Source https://donmahallem.github.io/js-libs/
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Runs the provided observable in the NgZone
|
|
14
|
+
*
|
|
15
|
+
* @param {import('@angular/core').NgZone} zone Zone to run in
|
|
16
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data in the zone
|
|
17
|
+
*/
|
|
18
|
+
function runInsideZone(zone) {
|
|
19
|
+
return (source) => new rxjs.Observable((observer) => source.subscribe({
|
|
20
|
+
complete() {
|
|
21
|
+
observer.complete();
|
|
22
|
+
},
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
error(err) {
|
|
25
|
+
observer.error(err);
|
|
26
|
+
},
|
|
27
|
+
next(x) {
|
|
28
|
+
if (core.NgZone.isInAngularZone()) {
|
|
26
29
|
observer.next(x);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
zone.run(() => {
|
|
33
|
+
observer.next(x);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
31
39
|
|
|
32
40
|
/*
|
|
33
41
|
* Package @donmahallem/rxjs-zone
|
|
34
42
|
* Source https://donmahallem.github.io/js-libs/
|
|
35
43
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Runs the provided observable outside the NgZone
|
|
46
|
+
*
|
|
47
|
+
* @param {import('@angular/core').NgZone} zone Zone to run outside of
|
|
48
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data outside the zone
|
|
49
|
+
*/
|
|
50
|
+
function runOutsideZone(zone) {
|
|
51
|
+
return (source) => new rxjs.Observable((observer) => source.subscribe({
|
|
52
|
+
complete() {
|
|
53
|
+
observer.complete();
|
|
54
|
+
},
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
error(err) {
|
|
57
|
+
observer.error(err);
|
|
58
|
+
},
|
|
59
|
+
next(x) {
|
|
60
|
+
if (core.NgZone.isInAngularZone()) {
|
|
61
|
+
zone.runOutsideAngular(() => {
|
|
62
|
+
observer.next(x);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
47
66
|
observer.next(x);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
}));
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
55
71
|
|
|
56
72
|
exports.runInsideZone = runInsideZone;
|
|
57
73
|
exports.runOutsideZone = runOutsideZone;
|
|
58
|
-
// BUILD:
|
|
74
|
+
// BUILD: Mon Jan 03 2022 15:03:29 GMT+0100 (Central European Standard Time)
|
|
59
75
|
|
|
60
76
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/run-inside-zone.ts","../../src/run-outside-zone.ts"],"sourcesContent":[null,null],"names":["Observable","NgZone"],"mappings":";;;;;;;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/run-inside-zone.ts","../../src/run-outside-zone.ts"],"sourcesContent":[null,null],"names":["Observable","NgZone"],"mappings":";;;;;;;AAAA;;;;AASA;;;;;;SAMgB,aAAa,CAAI,IAAY;IACzC,OAAO,CAAC,MAAqB,KACzB,IAAIA,eAAU,CACV,CAAC,QAAuB,KACpB,MAAM,CAAC,SAAS,CAAC;QACb,QAAQ;YACJ,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvB;;QAED,KAAK,CAAC,GAAQ;YACV,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,CAAI;YACL,IAAIC,WAAM,CAAC,eAAe,EAAE,EAAE;gBAC1B,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACpB;iBAAM;gBACH,IAAI,CAAC,GAAG,CAAC;oBACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACpB,CAAC,CAAC;aACN;SACJ;KACJ,CAAC,CACT,CAAC;AACV;;ACtCA;;;;AASA;;;;;;SAMgB,cAAc,CAAI,IAAY;IAC1C,OAAO,CAAC,MAAqB,KACzB,IAAID,eAAU,CACV,CAAC,QAAuB,KACpB,MAAM,CAAC,SAAS,CAAC;QACb,QAAQ;YACJ,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvB;;QAED,KAAK,CAAC,GAAQ;YACV,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,CAAI;YACL,IAAIC,WAAM,CAAC,eAAe,EAAE,EAAE;gBAC1B,IAAI,CAAC,iBAAiB,CAAC;oBACnB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACpB,CAAC,CAAC;aACN;iBAAM;gBACH,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACpB;SACJ;KACJ,CAAC,CACT,CAAC;AACV;;;;;;"}
|
package/dist/esm/dist/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/esm/index.js
CHANGED
|
@@ -5,51 +5,67 @@ import { Observable } from 'rxjs';
|
|
|
5
5
|
* Package @donmahallem/rxjs-zone
|
|
6
6
|
* Source https://donmahallem.github.io/js-libs/
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Runs the provided observable in the NgZone
|
|
10
|
+
*
|
|
11
|
+
* @param {import('@angular/core').NgZone} zone Zone to run in
|
|
12
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data in the zone
|
|
13
|
+
*/
|
|
14
|
+
function runInsideZone(zone) {
|
|
15
|
+
return (source) => new Observable((observer) => source.subscribe({
|
|
16
|
+
complete() {
|
|
17
|
+
observer.complete();
|
|
18
|
+
},
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
error(err) {
|
|
21
|
+
observer.error(err);
|
|
22
|
+
},
|
|
23
|
+
next(x) {
|
|
24
|
+
if (NgZone.isInAngularZone()) {
|
|
22
25
|
observer.next(x);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
zone.run(() => {
|
|
29
|
+
observer.next(x);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
27
35
|
|
|
28
36
|
/*
|
|
29
37
|
* Package @donmahallem/rxjs-zone
|
|
30
38
|
* Source https://donmahallem.github.io/js-libs/
|
|
31
39
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Runs the provided observable outside the NgZone
|
|
42
|
+
*
|
|
43
|
+
* @param {import('@angular/core').NgZone} zone Zone to run outside of
|
|
44
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data outside the zone
|
|
45
|
+
*/
|
|
46
|
+
function runOutsideZone(zone) {
|
|
47
|
+
return (source) => new Observable((observer) => source.subscribe({
|
|
48
|
+
complete() {
|
|
49
|
+
observer.complete();
|
|
50
|
+
},
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
error(err) {
|
|
53
|
+
observer.error(err);
|
|
54
|
+
},
|
|
55
|
+
next(x) {
|
|
56
|
+
if (NgZone.isInAngularZone()) {
|
|
57
|
+
zone.runOutsideAngular(() => {
|
|
58
|
+
observer.next(x);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
43
62
|
observer.next(x);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
}));
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
51
67
|
|
|
52
68
|
export { runInsideZone, runOutsideZone };
|
|
53
|
-
// BUILD:
|
|
69
|
+
// BUILD: Mon Jan 03 2022 15:03:29 GMT+0100 (Central European Standard Time)
|
|
54
70
|
|
|
55
71
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/run-inside-zone.ts","../../src/run-outside-zone.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;AAAA;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/run-inside-zone.ts","../../src/run-outside-zone.ts"],"sourcesContent":[null,null],"names":[],"mappings":";;;AAAA;;;;AASA;;;;;;SAMgB,aAAa,CAAI,IAAY;IACzC,OAAO,CAAC,MAAqB,KACzB,IAAI,UAAU,CACV,CAAC,QAAuB,KACpB,MAAM,CAAC,SAAS,CAAC;QACb,QAAQ;YACJ,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvB;;QAED,KAAK,CAAC,GAAQ;YACV,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,CAAI;YACL,IAAI,MAAM,CAAC,eAAe,EAAE,EAAE;gBAC1B,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACpB;iBAAM;gBACH,IAAI,CAAC,GAAG,CAAC;oBACL,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACpB,CAAC,CAAC;aACN;SACJ;KACJ,CAAC,CACT,CAAC;AACV;;ACtCA;;;;AASA;;;;;;SAMgB,cAAc,CAAI,IAAY;IAC1C,OAAO,CAAC,MAAqB,KACzB,IAAI,UAAU,CACV,CAAC,QAAuB,KACpB,MAAM,CAAC,SAAS,CAAC;QACb,QAAQ;YACJ,QAAQ,CAAC,QAAQ,EAAE,CAAC;SACvB;;QAED,KAAK,CAAC,GAAQ;YACV,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SACvB;QACD,IAAI,CAAC,CAAI;YACL,IAAI,MAAM,CAAC,eAAe,EAAE,EAAE;gBAC1B,IAAI,CAAC,iBAAiB,CAAC;oBACnB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBACpB,CAAC,CAAC;aACN;iBAAM;gBACH,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACpB;SACJ;KACJ,CAAC,CACT,CAAC;AACV;;;;;"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { NgZone } from '@angular/core';
|
|
2
|
-
import { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
|
-
|
|
2
|
+
import type { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
|
+
/**
|
|
4
|
+
* Runs the provided observable in the NgZone
|
|
5
|
+
*
|
|
6
|
+
* @param {import('@angular/core').NgZone} zone Zone to run in
|
|
7
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data in the zone
|
|
8
|
+
*/
|
|
9
|
+
export declare function runInsideZone<T>(zone: NgZone): MonoTypeOperatorFunction<T>;
|
|
4
10
|
//# sourceMappingURL=run-inside-zone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-inside-zone.d.ts","sourceRoot":"","sources":["../../src/run-inside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"run-inside-zone.d.ts","sourceRoot":"","sources":["../../src/run-inside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,KAAK,EAAE,wBAAwB,EAA4B,MAAM,MAAM,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAuB1E"}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { NgZone } from '@angular/core';
|
|
2
|
-
import { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
|
-
|
|
2
|
+
import type { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
|
+
/**
|
|
4
|
+
* Runs the provided observable outside the NgZone
|
|
5
|
+
*
|
|
6
|
+
* @param {import('@angular/core').NgZone} zone Zone to run outside of
|
|
7
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data outside the zone
|
|
8
|
+
*/
|
|
9
|
+
export declare function runOutsideZone<T>(zone: NgZone): MonoTypeOperatorFunction<T>;
|
|
4
10
|
//# sourceMappingURL=run-outside-zone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-outside-zone.d.ts","sourceRoot":"","sources":["../../src/run-outside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"run-outside-zone.d.ts","sourceRoot":"","sources":["../../src/run-outside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,KAAK,EAAE,wBAAwB,EAA4B,MAAM,MAAM,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,wBAAwB,CAAC,CAAC,CAAC,CAuB3E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donmahallem/rxjs-zone",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Helper for handling zone.js with rxjs",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"url": "https://github.com/donmahallem/js-libs.git"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": "
|
|
45
|
+
"node": ">=14"
|
|
46
46
|
},
|
|
47
47
|
"exports": {
|
|
48
48
|
"import": "./dist/esm/index.js",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@angular/core": "13.
|
|
60
|
+
"@angular/core": "13.1.1",
|
|
61
61
|
"rxjs": "7.4.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"@angular/core": "<14.0.0",
|
|
65
65
|
"rxjs": "<8.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "565f053c83362152c3b55c270efee1088e6aae47"
|
|
68
68
|
}
|
package/src/run-inside-zone.ts
CHANGED
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { NgZone } from '@angular/core';
|
|
7
|
-
import {
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
8
|
+
import type { MonoTypeOperatorFunction, Subscriber, Subscription } from 'rxjs';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Runs the provided observable in the NgZone
|
|
12
|
+
*
|
|
13
|
+
* @param {import('@angular/core').NgZone} zone Zone to run in
|
|
14
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data in the zone
|
|
15
|
+
*/
|
|
16
|
+
export function runInsideZone<T>(zone: NgZone): MonoTypeOperatorFunction<T> {
|
|
17
|
+
return (source: Observable<T>): Observable<T> =>
|
|
12
18
|
new Observable<T>(
|
|
13
19
|
(observer: Subscriber<T>): Subscription =>
|
|
14
20
|
source.subscribe({
|
|
@@ -30,3 +36,4 @@ export const runInsideZone: <T>(zone: NgZone) => MonoTypeOperatorFunction<T> =
|
|
|
30
36
|
},
|
|
31
37
|
})
|
|
32
38
|
);
|
|
39
|
+
}
|
package/src/run-outside-zone.ts
CHANGED
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { NgZone } from '@angular/core';
|
|
7
|
-
import {
|
|
7
|
+
import { Observable } from 'rxjs';
|
|
8
|
+
import type { MonoTypeOperatorFunction, Subscriber, Subscription } from 'rxjs';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Runs the provided observable outside the NgZone
|
|
12
|
+
*
|
|
13
|
+
* @param {import('@angular/core').NgZone} zone Zone to run outside of
|
|
14
|
+
* @returns {import('rxjs').MonoTypeOperatorFunction<T>} passes on data outside the zone
|
|
15
|
+
*/
|
|
16
|
+
export function runOutsideZone<T>(zone: NgZone): MonoTypeOperatorFunction<T> {
|
|
17
|
+
return (source: Observable<T>): Observable<T> =>
|
|
12
18
|
new Observable<T>(
|
|
13
19
|
(observer: Subscriber<T>): Subscription =>
|
|
14
20
|
source.subscribe({
|
|
@@ -30,3 +36,4 @@ export const runOutsideZone: <T>(zone: NgZone) => MonoTypeOperatorFunction<T> =
|
|
|
30
36
|
},
|
|
31
37
|
})
|
|
32
38
|
);
|
|
39
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/index.spec.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-inside-zone.d.ts","sourceRoot":"","sources":["../../src/run-inside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAwC,MAAM,MAAM,CAAC;AAEtF,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,wBAAwB,CAAC,CAAC,CAuBlE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-outside-zone.d.ts","sourceRoot":"","sources":["../../src/run-outside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAwC,MAAM,MAAM,CAAC;AAEtF,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,wBAAwB,CAAC,CAAC,CAuBnE,CAAC"}
|
package/dist/dts/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NgZone } from '@angular/core';
|
|
2
|
-
import { MonoTypeOperatorFunction } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
declare const runInsideZone: <T>(zone: NgZone) => MonoTypeOperatorFunction<T>;
|
|
5
|
-
|
|
6
|
-
declare const runOutsideZone: <T>(zone: NgZone) => MonoTypeOperatorFunction<T>;
|
|
7
|
-
|
|
8
|
-
export { runInsideZone, runOutsideZone };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.spec.d.ts","sourceRoot":"","sources":["../../src/index.spec.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-inside-zone.d.ts","sourceRoot":"","sources":["../../src/run-inside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAwC,MAAM,MAAM,CAAC;AAEtF,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,wBAAwB,CAAC,CAAC,CAuBlE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-outside-zone.d.ts","sourceRoot":"","sources":["../../src/run-outside-zone.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAwC,MAAM,MAAM,CAAC;AAEtF,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,wBAAwB,CAAC,CAAC,CAuBnE,CAAC"}
|