@fncts/observable 0.0.31 → 0.0.33

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 (200) hide show
  1. package/Action.d.ts +2 -1
  2. package/AsyncScheduler.d.ts +1 -1
  3. package/LICENSE +26 -0
  4. package/ObservableRef/api.d.ts +3 -3
  5. package/ObservableRef/definition.d.ts +3 -3
  6. package/_cjs/Action.cjs +15 -16
  7. package/_cjs/Action.cjs.map +1 -1
  8. package/_cjs/AnimationFrameAction.cjs +30 -33
  9. package/_cjs/AnimationFrameAction.cjs.map +1 -1
  10. package/_cjs/AnimationFrameScheduler.cjs +30 -35
  11. package/_cjs/AnimationFrameScheduler.cjs.map +1 -1
  12. package/_cjs/AsyncAction.cjs +73 -88
  13. package/_cjs/AsyncAction.cjs.map +1 -1
  14. package/_cjs/AsyncScheduler.cjs +35 -41
  15. package/_cjs/AsyncScheduler.cjs.map +1 -1
  16. package/_cjs/BehaviorSubject.cjs +31 -37
  17. package/_cjs/BehaviorSubject.cjs.map +1 -1
  18. package/_cjs/Notification.cjs +65 -70
  19. package/_cjs/Notification.cjs.map +1 -1
  20. package/_cjs/Observable/api/connect.cjs +23 -25
  21. package/_cjs/Observable/api/connect.cjs.map +1 -1
  22. package/_cjs/Observable/api/connectable.cjs +46 -45
  23. package/_cjs/Observable/api/connectable.cjs.map +1 -1
  24. package/_cjs/Observable/api/fromCallback.cjs +44 -48
  25. package/_cjs/Observable/api/fromCallback.cjs.map +1 -1
  26. package/_cjs/Observable/api/fromEvent.cjs +15 -15
  27. package/_cjs/Observable/api/fromEvent.cjs.map +1 -1
  28. package/_cjs/Observable/api/index.cjs +32 -160
  29. package/_cjs/Observable/api/race.cjs +26 -30
  30. package/_cjs/Observable/api/race.cjs.map +1 -1
  31. package/_cjs/Observable/api/raceWith.cjs +14 -15
  32. package/_cjs/Observable/api/raceWith.cjs.map +1 -1
  33. package/_cjs/Observable/api/repeatWhen.cjs +54 -57
  34. package/_cjs/Observable/api/repeatWhen.cjs.map +1 -1
  35. package/_cjs/Observable/api/retryWhen.cjs +37 -41
  36. package/_cjs/Observable/api/retryWhen.cjs.map +1 -1
  37. package/_cjs/Observable/api/share.cjs +73 -83
  38. package/_cjs/Observable/api/share.cjs.map +1 -1
  39. package/_cjs/Observable/api/window.cjs +46 -43
  40. package/_cjs/Observable/api/window.cjs.map +1 -1
  41. package/_cjs/Observable/api/windowCount.cjs +45 -51
  42. package/_cjs/Observable/api/windowCount.cjs.map +1 -1
  43. package/_cjs/Observable/api/windowTime.cjs +73 -74
  44. package/_cjs/Observable/api/windowTime.cjs.map +1 -1
  45. package/_cjs/Observable/api/windowToggle.cjs +71 -74
  46. package/_cjs/Observable/api/windowToggle.cjs.map +1 -1
  47. package/_cjs/Observable/api/windowWhen.cjs +59 -55
  48. package/_cjs/Observable/api/windowWhen.cjs.map +1 -1
  49. package/_cjs/Observable/api.cjs +1858 -2033
  50. package/_cjs/Observable/api.cjs.map +1 -1
  51. package/_cjs/Observable/definition.cjs +107 -120
  52. package/_cjs/Observable/definition.cjs.map +1 -1
  53. package/_cjs/Observable/dom/animationFrames.cjs +30 -33
  54. package/_cjs/Observable/dom/animationFrames.cjs.map +1 -1
  55. package/_cjs/Observable/instances.cjs +0 -2
  56. package/_cjs/Observable.cjs +180 -215
  57. package/_cjs/ObservableRef/api.cjs +188 -156
  58. package/_cjs/ObservableRef/api.cjs.map +1 -1
  59. package/_cjs/ObservableRef/atomic.cjs +25 -28
  60. package/_cjs/ObservableRef/atomic.cjs.map +1 -1
  61. package/_cjs/ObservableRef/definition.cjs +32 -27
  62. package/_cjs/ObservableRef/definition.cjs.map +1 -1
  63. package/_cjs/ObservableRef.cjs +17 -39
  64. package/_cjs/Observer.cjs +0 -2
  65. package/_cjs/Operator.cjs +58 -61
  66. package/_cjs/Operator.cjs.map +1 -1
  67. package/_cjs/Scheduler.cjs +38 -37
  68. package/_cjs/Scheduler.cjs.map +1 -1
  69. package/_cjs/Subject.cjs +163 -202
  70. package/_cjs/Subject.cjs.map +1 -1
  71. package/_cjs/Subscriber.cjs +151 -170
  72. package/_cjs/Subscriber.cjs.map +1 -1
  73. package/_cjs/Subscription.cjs +98 -123
  74. package/_cjs/Subscription.cjs.map +1 -1
  75. package/_cjs/chunk.cjs +28 -0
  76. package/_cjs/config.cjs +11 -12
  77. package/_cjs/config.cjs.map +1 -1
  78. package/_cjs/global.cjs +0 -2
  79. package/_cjs/index.cjs +112 -36
  80. package/_cjs/internal/animationFrameProvider.cjs +32 -38
  81. package/_cjs/internal/animationFrameProvider.cjs.map +1 -1
  82. package/_cjs/internal/args.cjs +12 -12
  83. package/_cjs/internal/args.cjs.map +1 -1
  84. package/_cjs/internal/intervalProvider.cjs +15 -22
  85. package/_cjs/internal/intervalProvider.cjs.map +1 -1
  86. package/_cjs/internal/performanceTimestampProvider.cjs +10 -11
  87. package/_cjs/internal/performanceTimestampProvider.cjs.map +1 -1
  88. package/_cjs/internal/timeoutProvider.cjs +15 -22
  89. package/_cjs/internal/timeoutProvider.cjs.map +1 -1
  90. package/_cjs/internal/timestampProvider.cjs +10 -11
  91. package/_cjs/internal/timestampProvider.cjs.map +1 -1
  92. package/_cjs/internal/util.cjs +60 -68
  93. package/_cjs/internal/util.cjs.map +1 -1
  94. package/_mjs/Action.mjs +12 -8
  95. package/_mjs/Action.mjs.map +1 -1
  96. package/_mjs/AnimationFrameAction.mjs +25 -24
  97. package/_mjs/AnimationFrameAction.mjs.map +1 -1
  98. package/_mjs/AnimationFrameScheduler.mjs +25 -27
  99. package/_mjs/AnimationFrameScheduler.mjs.map +1 -1
  100. package/_mjs/AsyncAction.mjs +69 -79
  101. package/_mjs/AsyncAction.mjs.map +1 -1
  102. package/_mjs/AsyncScheduler.mjs +32 -34
  103. package/_mjs/AsyncScheduler.mjs.map +1 -1
  104. package/_mjs/BehaviorSubject.mjs +28 -29
  105. package/_mjs/BehaviorSubject.mjs.map +1 -1
  106. package/_mjs/Notification.mjs +57 -60
  107. package/_mjs/Notification.mjs.map +1 -1
  108. package/_mjs/Observable/api/connect.mjs +17 -17
  109. package/_mjs/Observable/api/connect.mjs.map +1 -1
  110. package/_mjs/Observable/api/connectable.mjs +39 -35
  111. package/_mjs/Observable/api/connectable.mjs.map +1 -1
  112. package/_mjs/Observable/api/fromCallback.mjs +40 -41
  113. package/_mjs/Observable/api/fromCallback.mjs.map +1 -1
  114. package/_mjs/Observable/api/fromEvent.mjs +12 -8
  115. package/_mjs/Observable/api/fromEvent.mjs.map +1 -1
  116. package/_mjs/Observable/api/index.mjs +15 -15
  117. package/_mjs/Observable/api/race.mjs +20 -22
  118. package/_mjs/Observable/api/race.mjs.map +1 -1
  119. package/_mjs/Observable/api/raceWith.mjs +11 -8
  120. package/_mjs/Observable/api/raceWith.mjs.map +1 -1
  121. package/_mjs/Observable/api/repeatWhen.mjs +48 -49
  122. package/_mjs/Observable/api/repeatWhen.mjs.map +1 -1
  123. package/_mjs/Observable/api/retryWhen.mjs +31 -33
  124. package/_mjs/Observable/api/retryWhen.mjs.map +1 -1
  125. package/_mjs/Observable/api/share.mjs +65 -74
  126. package/_mjs/Observable/api/share.mjs.map +1 -1
  127. package/_mjs/Observable/api/window.mjs +38 -34
  128. package/_mjs/Observable/api/window.mjs.map +1 -1
  129. package/_mjs/Observable/api/windowCount.mjs +39 -43
  130. package/_mjs/Observable/api/windowCount.mjs.map +1 -1
  131. package/_mjs/Observable/api/windowTime.mjs +63 -64
  132. package/_mjs/Observable/api/windowTime.mjs.map +1 -1
  133. package/_mjs/Observable/api/windowToggle.mjs +58 -62
  134. package/_mjs/Observable/api/windowToggle.mjs.map +1 -1
  135. package/_mjs/Observable/api/windowWhen.mjs +50 -46
  136. package/_mjs/Observable/api/windowWhen.mjs.map +1 -1
  137. package/_mjs/Observable/api.mjs +1822 -2030
  138. package/_mjs/Observable/api.mjs.map +1 -1
  139. package/_mjs/Observable/definition.mjs +94 -108
  140. package/_mjs/Observable/definition.mjs.map +1 -1
  141. package/_mjs/Observable/dom/animationFrames.mjs +23 -23
  142. package/_mjs/Observable/dom/animationFrames.mjs.map +1 -1
  143. package/_mjs/Observable/instances.mjs +0 -2
  144. package/_mjs/Observable.mjs +20 -25
  145. package/_mjs/ObservableRef/api.mjs +180 -144
  146. package/_mjs/ObservableRef/api.mjs.map +1 -1
  147. package/_mjs/ObservableRef/atomic.mjs +21 -20
  148. package/_mjs/ObservableRef/atomic.mjs.map +1 -1
  149. package/_mjs/ObservableRef/definition.mjs +29 -19
  150. package/_mjs/ObservableRef/definition.mjs.map +1 -1
  151. package/_mjs/ObservableRef.mjs +4 -5
  152. package/_mjs/Observer.mjs +0 -2
  153. package/_mjs/Operator.mjs +50 -50
  154. package/_mjs/Operator.mjs.map +1 -1
  155. package/_mjs/Scheduler.mjs +30 -26
  156. package/_mjs/Scheduler.mjs.map +1 -1
  157. package/_mjs/Subject.mjs +154 -191
  158. package/_mjs/Subject.mjs.map +1 -1
  159. package/_mjs/Subscriber.mjs +136 -156
  160. package/_mjs/Subscriber.mjs.map +1 -1
  161. package/_mjs/Subscription.mjs +90 -113
  162. package/_mjs/Subscription.mjs.map +1 -1
  163. package/_mjs/config.mjs +10 -6
  164. package/_mjs/config.mjs.map +1 -1
  165. package/_mjs/global.mjs +0 -2
  166. package/_mjs/index.mjs +14 -15
  167. package/_mjs/internal/animationFrameProvider.mjs +28 -30
  168. package/_mjs/internal/animationFrameProvider.mjs.map +1 -1
  169. package/_mjs/internal/args.mjs +9 -5
  170. package/_mjs/internal/args.mjs.map +1 -1
  171. package/_mjs/internal/intervalProvider.mjs +14 -16
  172. package/_mjs/internal/intervalProvider.mjs.map +1 -1
  173. package/_mjs/internal/performanceTimestampProvider.mjs +9 -5
  174. package/_mjs/internal/performanceTimestampProvider.mjs.map +1 -1
  175. package/_mjs/internal/timeoutProvider.mjs +14 -16
  176. package/_mjs/internal/timeoutProvider.mjs.map +1 -1
  177. package/_mjs/internal/timestampProvider.mjs +9 -5
  178. package/_mjs/internal/timestampProvider.mjs.map +1 -1
  179. package/_mjs/internal/util.mjs +54 -59
  180. package/_mjs/internal/util.mjs.map +1 -1
  181. package/_src/Action.ts +2 -0
  182. package/_src/AsyncScheduler.ts +2 -0
  183. package/_src/Observable/api.ts +4 -4
  184. package/_src/ObservableRef/api.ts +36 -12
  185. package/_src/ObservableRef/definition.ts +12 -4
  186. package/package.json +6 -2
  187. package/_cjs/Observable/api/index.cjs.map +0 -1
  188. package/_cjs/Observable/instances.cjs.map +0 -1
  189. package/_cjs/Observable.cjs.map +0 -1
  190. package/_cjs/ObservableRef.cjs.map +0 -1
  191. package/_cjs/Observer.cjs.map +0 -1
  192. package/_cjs/global.cjs.map +0 -1
  193. package/_cjs/index.cjs.map +0 -1
  194. package/_mjs/Observable/api/index.mjs.map +0 -1
  195. package/_mjs/Observable/instances.mjs.map +0 -1
  196. package/_mjs/Observable.mjs.map +0 -1
  197. package/_mjs/ObservableRef.mjs.map +0 -1
  198. package/_mjs/Observer.mjs.map +0 -1
  199. package/_mjs/global.mjs.map +0 -1
  200. package/_mjs/index.mjs.map +0 -1
@@ -1,82 +1,72 @@
1
1
  import * as tsplus_module_1 from "@fncts/observable/Action";
2
- import { intervalProvider } from "@fncts/observable/internal/intervalProvider";
3
2
  import { arrayRemove } from "@fncts/observable/internal/util";
4
- export class AsyncAction extends tsplus_module_1.Action {
5
- constructor(scheduler, work) {
6
- super(scheduler, work);
7
- this.scheduler = scheduler;
8
- this.work = work;
9
- this.pending = false;
10
- }
11
- schedule(state, delay = 0) {
12
- if (this._closed) {
13
- return this;
14
- }
15
- this.state = state;
16
- const id = this.id;
17
- const scheduler = this.scheduler;
18
- if (id != null) {
19
- this.id = this.recycleAsyncId(scheduler, id, delay);
20
- }
21
- this.pending = true;
22
- this.delay = delay;
23
- this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
24
- return this;
25
- }
26
- requestAsyncId(scheduler, _id, delay = 0) {
27
- return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
28
- }
29
- recycleAsyncId(_scheduler, id, delay = 0) {
30
- if (delay != null && this.delay === delay && this.pending === false) {
31
- return id;
32
- }
33
- intervalProvider.clearInterval(id);
34
- return undefined;
35
- }
36
- execute(state, delay) {
37
- if (this._closed) {
38
- throw new Error("executing a cancelled action");
39
- }
40
- this.pending = false;
41
- const error = this.executeInternal(state, delay);
42
- if (error) {
43
- return error;
44
- } else if (this.pending === false && this.id != null) {
45
- this.id = this.recycleAsyncId(this.scheduler, this.id, null);
46
- }
47
- }
48
- executeInternal(state, _delay) {
49
- let errored = false;
50
- let errorValue;
51
- try {
52
- this.work(state);
53
- } catch (e) {
54
- errored = true;
55
- errorValue = e ? e : new Error("Scheduled action threw falsy error");
56
- }
57
- if (errored) {
58
- this.unsubscribe();
59
- return errorValue;
60
- }
61
- }
62
- unsubscribe() {
63
- if (!this._closed) {
64
- const {
65
- id,
66
- scheduler
67
- } = this;
68
- const {
69
- actions
70
- } = scheduler;
71
- this.work = this.state = this.scheduler = null;
72
- this.pending = false;
73
- arrayRemove(actions, this);
74
- if (id != null) {
75
- this.id = this.recycleAsyncId(scheduler, id, null);
76
- }
77
- this.delay = null;
78
- super.unsubscribe();
79
- }
80
- }
81
- }
3
+ import { intervalProvider } from "@fncts/observable/internal/intervalProvider";
4
+ //#region build/esm/AsyncAction.js
5
+ var AsyncAction = class extends tsplus_module_1.Action {
6
+ scheduler;
7
+ work;
8
+ id;
9
+ state;
10
+ delay;
11
+ pending = false;
12
+ constructor(scheduler, work) {
13
+ super(scheduler, work);
14
+ this.scheduler = scheduler;
15
+ this.work = work;
16
+ }
17
+ schedule(state, delay = 0) {
18
+ if (this._closed) return this;
19
+ this.state = state;
20
+ const id = this.id;
21
+ const scheduler = this.scheduler;
22
+ if (id != null) this.id = this.recycleAsyncId(scheduler, id, delay);
23
+ this.pending = true;
24
+ this.delay = delay;
25
+ this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
26
+ return this;
27
+ }
28
+ requestAsyncId(scheduler, _id, delay = 0) {
29
+ return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
30
+ }
31
+ recycleAsyncId(_scheduler, id, delay = 0) {
32
+ if (delay != null && this.delay === delay && this.pending === false) return id;
33
+ intervalProvider.clearInterval(id);
34
+ }
35
+ execute(state, delay) {
36
+ if (this._closed) throw new Error("executing a cancelled action");
37
+ this.pending = false;
38
+ const error = this.executeInternal(state, delay);
39
+ if (error) return error;
40
+ else if (this.pending === false && this.id != null) this.id = this.recycleAsyncId(this.scheduler, this.id, null);
41
+ }
42
+ executeInternal(state, _delay) {
43
+ let errored = false;
44
+ let errorValue;
45
+ try {
46
+ this.work(state);
47
+ } catch (e) {
48
+ errored = true;
49
+ errorValue = e ? e : /* @__PURE__ */ new Error("Scheduled action threw falsy error");
50
+ }
51
+ if (errored) {
52
+ this.unsubscribe();
53
+ return errorValue;
54
+ }
55
+ }
56
+ unsubscribe() {
57
+ if (!this._closed) {
58
+ const { id, scheduler } = this;
59
+ const { actions } = scheduler;
60
+ this.work = this.state = this.scheduler = null;
61
+ this.pending = false;
62
+ arrayRemove(actions, this);
63
+ if (id != null) this.id = this.recycleAsyncId(scheduler, id, null);
64
+ this.delay = null;
65
+ super.unsubscribe();
66
+ }
67
+ }
68
+ };
69
+ //#endregion
70
+ export { AsyncAction };
71
+
82
72
  //# sourceMappingURL=AsyncAction.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncAction.mjs","names":["intervalProvider","arrayRemove","AsyncAction","tsplus_module_1","Action","constructor","scheduler","work","pending","schedule","state","delay","_closed","id","recycleAsyncId","requestAsyncId","_id","setInterval","flush","bind","_scheduler","clearInterval","undefined","execute","Error","error","executeInternal","_delay","errored","errorValue","e","unsubscribe","actions"],"sources":["../_src/AsyncAction.ts"],"sourcesContent":[null],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"AsyncAction.mjs","names":[],"sources":["../esm/AsyncAction.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/observable/Action\";\nimport { intervalProvider } from \"@fncts/observable/internal/intervalProvider\";\nimport { arrayRemove } from \"@fncts/observable/internal/util\";\nexport class AsyncAction extends tsplus_module_1.Action {\n scheduler;\n work;\n id;\n state;\n delay;\n pending = false;\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n }\n schedule(state, delay = 0) {\n if (this._closed) {\n return this;\n }\n this.state = state;\n const id = this.id;\n const scheduler = this.scheduler;\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n this.pending = true;\n this.delay = delay;\n this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);\n return this;\n }\n requestAsyncId(scheduler, _id, delay = 0) {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n recycleAsyncId(_scheduler, id, delay = 0) {\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n intervalProvider.clearInterval(id);\n return undefined;\n }\n execute(state, delay) {\n if (this._closed) {\n throw new Error(\"executing a cancelled action\");\n }\n this.pending = false;\n const error = this.executeInternal(state, delay);\n if (error) {\n return error;\n }\n else if (this.pending === false && this.id != null) {\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n executeInternal(state, _delay) {\n let errored = false;\n let errorValue;\n try {\n this.work(state);\n }\n catch (e) {\n errored = true;\n errorValue = e ? e : new Error(\"Scheduled action threw falsy error\");\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n unsubscribe() {\n if (!this._closed) {\n const { id, scheduler } = this;\n const { actions } = scheduler;\n this.work = this.state = this.scheduler = null;\n this.pending = false;\n arrayRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n this.delay = null;\n super.unsubscribe();\n }\n }\n}\n//# sourceMappingURL=AsyncAction.js.map"],"mappings":";;;;AAGA,IAAa,cAAb,cAAiC,gBAAgB,OAAO;CACpD;CACA;CACA;CACA;CACA;CACA,UAAU;CACV,YAAY,WAAW,MAAM;AACzB,QAAM,WAAW,KAAK;AACtB,OAAK,YAAY;AACjB,OAAK,OAAO;;CAEhB,SAAS,OAAO,QAAQ,GAAG;AACvB,MAAI,KAAK,QACL,QAAO;AAEX,OAAK,QAAQ;EACb,MAAM,KAAK,KAAK;EAChB,MAAM,YAAY,KAAK;AACvB,MAAI,MAAM,KACN,MAAK,KAAK,KAAK,eAAe,WAAW,IAAI,MAAM;AAEvD,OAAK,UAAU;AACf,OAAK,QAAQ;AACb,OAAK,KAAK,KAAK,MAAM,KAAK,eAAe,WAAW,KAAK,IAAI,MAAM;AACnE,SAAO;;CAEX,eAAe,WAAW,KAAK,QAAQ,GAAG;AACtC,SAAO,iBAAiB,YAAY,UAAU,MAAM,KAAK,WAAW,KAAK,EAAE,MAAM;;CAErF,eAAe,YAAY,IAAI,QAAQ,GAAG;AACtC,MAAI,SAAS,QAAQ,KAAK,UAAU,SAAS,KAAK,YAAY,MAC1D,QAAO;AAEX,mBAAiB,cAAc,GAAG;;CAGtC,QAAQ,OAAO,OAAO;AAClB,MAAI,KAAK,QACL,OAAM,IAAI,MAAM,+BAA+B;AAEnD,OAAK,UAAU;EACf,MAAM,QAAQ,KAAK,gBAAgB,OAAO,MAAM;AAChD,MAAI,MACA,QAAO;WAEF,KAAK,YAAY,SAAS,KAAK,MAAM,KAC1C,MAAK,KAAK,KAAK,eAAe,KAAK,WAAW,KAAK,IAAI,KAAK;;CAGpE,gBAAgB,OAAO,QAAQ;EAC3B,IAAI,UAAU;EACd,IAAI;AACJ,MAAI;AACA,QAAK,KAAK,MAAM;WAEb,GAAG;AACN,aAAU;AACV,gBAAa,IAAI,oBAAI,IAAI,MAAM,qCAAqC;;AAExE,MAAI,SAAS;AACT,QAAK,aAAa;AAClB,UAAO;;;CAGf,cAAc;AACV,MAAI,CAAC,KAAK,SAAS;GACf,MAAM,EAAE,IAAI,cAAc;GAC1B,MAAM,EAAE,YAAY;AACpB,QAAK,OAAO,KAAK,QAAQ,KAAK,YAAY;AAC1C,QAAK,UAAU;AACf,eAAY,SAAS,KAAK;AAC1B,OAAI,MAAM,KACN,MAAK,KAAK,KAAK,eAAe,WAAW,IAAI,KAAK;AAEtD,QAAK,QAAQ;AACb,SAAM,aAAa"}
@@ -1,35 +1,33 @@
1
- import * as tsplus_module_1 from "@fncts/observable/Scheduler";
2
- import * as tsplus_module_2 from "@fncts/observable/AsyncAction";
3
- export class AsyncScheduler extends tsplus_module_1.Scheduler {
4
- constructor(actionConstructor, now = tsplus_module_1.Scheduler.now) {
5
- super(actionConstructor, now);
6
- this.actions = [];
7
- this.active = false;
8
- this.scheduled = undefined;
9
- }
10
- flush(action) {
11
- const {
12
- actions
13
- } = this;
14
- if (this.active) {
15
- actions.push(action);
16
- return;
17
- }
18
- let error;
19
- this.active = true;
20
- do {
21
- if (error = action.execute(action.state, action.delay)) {
22
- break;
23
- }
24
- } while (action = actions.shift());
25
- this.active = false;
26
- if (error) {
27
- while (action = actions.shift()) {
28
- action.unsubscribe();
29
- }
30
- throw error;
31
- }
32
- }
33
- }
34
- export const asyncScheduler = /*#__PURE__*/new AsyncScheduler(tsplus_module_2.AsyncAction);
1
+ import { Scheduler } from "./Scheduler.mjs";
2
+ import * as tsplus_module_1 from "@fncts/observable/AsyncAction";
3
+ //#region build/esm/AsyncScheduler.js
4
+ var AsyncScheduler = class extends Scheduler {
5
+ actions = [];
6
+ active = false;
7
+ scheduled = void 0;
8
+ constructor(actionConstructor, now = Scheduler.now) {
9
+ super(actionConstructor, now);
10
+ }
11
+ flush(action) {
12
+ const { actions } = this;
13
+ if (this.active) {
14
+ actions.push(action);
15
+ return;
16
+ }
17
+ let error;
18
+ this.active = true;
19
+ do
20
+ if (error = action.execute(action.state, action.delay)) break;
21
+ while (action = actions.shift());
22
+ this.active = false;
23
+ if (error) {
24
+ while (action = actions.shift()) action.unsubscribe();
25
+ throw error;
26
+ }
27
+ }
28
+ };
29
+ const asyncScheduler = new AsyncScheduler(tsplus_module_1.AsyncAction);
30
+ //#endregion
31
+ export { AsyncScheduler, asyncScheduler };
32
+
35
33
  //# sourceMappingURL=AsyncScheduler.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncScheduler.mjs","names":["AsyncScheduler","tsplus_module_1","Scheduler","constructor","actionConstructor","now","actions","active","scheduled","undefined","flush","action","push","error","execute","state","delay","shift","unsubscribe","asyncScheduler","tsplus_module_2","AsyncAction"],"sources":["../_src/AsyncScheduler.ts"],"sourcesContent":[null],"mappings":";;AAAA,OAAM,MAAOA,cAAe,SAAQC,eAAA,CAAAC,SAAS;EAM3CC,YAAYC,iBAAgC,EAAEC,GAAA,GAAoBJ,eAAA,CAAAC,SAAS,CAACG,GAAG;IAC7E,KAAK,CAACD,iBAAiB,EAAEC,GAAG,CAAC;IANxB,KAAAC,OAAO,GAA4B,EAAE;IAE5C,KAAAC,MAAM,GAAW,KAAK;IACtB,KAAAC,SAAS,GAAQC,SAAS;EAI1B;EAEAC,KAAKA,CAACC,MAAwB;IAC5B,MAAM;MAAEL;IAAO,CAAE,GAAG,IAAI;IAExB,IAAI,IAAI,CAACC,MAAM,EAAE;MACfD,OAAO,CAACM,IAAI,CAACD,MAAM,CAAC;MACpB;IACF;IAEA,IAAIE,KAAc;IAClB,IAAI,CAACN,MAAM,GAAG,IAAI;IAElB,GAAG;MACD,IAAKM,KAAK,GAAGF,MAAM,CAACG,OAAO,CAACH,MAAM,CAACI,KAAK,EAAEJ,MAAM,CAACK,KAAM,CAAC,EAAG;QACzD;MACF;IACF,CAAC,QAASL,MAAM,GAAGL,OAAO,CAACW,KAAK,EAAG;IAEnC,IAAI,CAACV,MAAM,GAAG,KAAK;IAEnB,IAAIM,KAAK,EAAE;MACT,OAAQF,MAAM,GAAGL,OAAO,CAACW,KAAK,EAAG,EAAG;QAClCN,MAAM,CAACO,WAAW,EAAE;MACtB;MACA,MAAML,KAAK;IACb;EACF;;AAGF,OAAO,MAAMM,cAAc,gBAAG,IAAInB,cAAc,CAAAoB,eAAA,CAACC,WAAW,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"AsyncScheduler.mjs","names":[],"sources":["../esm/AsyncScheduler.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/observable/AsyncAction\";\nimport { Scheduler } from \"./Scheduler.js\";\nexport class AsyncScheduler extends Scheduler {\n actions = [];\n active = false;\n scheduled = undefined;\n constructor(actionConstructor, now = Scheduler.now) {\n super(actionConstructor, now);\n }\n flush(action) {\n const { actions } = this;\n if (this.active) {\n actions.push(action);\n return;\n }\n let error;\n this.active = true;\n do {\n if ((error = action.execute(action.state, action.delay))) {\n break;\n }\n } while ((action = actions.shift()));\n this.active = false;\n if (error) {\n while ((action = actions.shift())) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\nexport const asyncScheduler = new AsyncScheduler(tsplus_module_1.AsyncAction);\n//# sourceMappingURL=AsyncScheduler.js.map"],"mappings":";;;AAEA,IAAa,iBAAb,cAAoC,UAAU;CAC1C,UAAU,EAAE;CACZ,SAAS;CACT,YAAY,KAAA;CACZ,YAAY,mBAAmB,MAAM,UAAU,KAAK;AAChD,QAAM,mBAAmB,IAAI;;CAEjC,MAAM,QAAQ;EACV,MAAM,EAAE,YAAY;AACpB,MAAI,KAAK,QAAQ;AACb,WAAQ,KAAK,OAAO;AACpB;;EAEJ,IAAI;AACJ,OAAK,SAAS;AACd;AACI,OAAK,QAAQ,OAAO,QAAQ,OAAO,OAAO,OAAO,MAAM,CACnD;SAEE,SAAS,QAAQ,OAAO;AAClC,OAAK,SAAS;AACd,MAAI,OAAO;AACP,UAAQ,SAAS,QAAQ,OAAO,CAC5B,QAAO,aAAa;AAExB,SAAM;;;;AAIlB,MAAa,iBAAiB,IAAI,eAAe,gBAAgB,YAAY"}
@@ -1,31 +1,30 @@
1
1
  import * as tsplus_module_1 from "@fncts/observable/Subject";
2
- export class BehaviorSubject extends tsplus_module_1.Subject {
3
- constructor(_value) {
4
- super();
5
- this._value = _value;
6
- }
7
- get value() {
8
- return this.getValue();
9
- }
10
- getValue() {
11
- const {
12
- hasError,
13
- thrownError,
14
- _value
15
- } = this;
16
- if (hasError) {
17
- throw thrownError;
18
- }
19
- this.throwIfClosed();
20
- return _value;
21
- }
22
- subscribeInternal(subscriber) {
23
- const subscription = super.subscribeInternal(subscriber);
24
- !subscription._closed && subscriber.next(this._value);
25
- return subscription;
26
- }
27
- next(value) {
28
- super.next(this._value = value);
29
- }
30
- }
2
+ //#region build/esm/BehaviorSubject.js
3
+ var BehaviorSubject = class extends tsplus_module_1.Subject {
4
+ _value;
5
+ constructor(_value) {
6
+ super();
7
+ this._value = _value;
8
+ }
9
+ get value() {
10
+ return this.getValue();
11
+ }
12
+ getValue() {
13
+ const { hasError, thrownError, _value } = this;
14
+ if (hasError) throw thrownError;
15
+ this.throwIfClosed();
16
+ return _value;
17
+ }
18
+ subscribeInternal(subscriber) {
19
+ const subscription = super.subscribeInternal(subscriber);
20
+ !subscription._closed && subscriber.next(this._value);
21
+ return subscription;
22
+ }
23
+ next(value) {
24
+ super.next(this._value = value);
25
+ }
26
+ };
27
+ //#endregion
28
+ export { BehaviorSubject };
29
+
31
30
  //# sourceMappingURL=BehaviorSubject.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BehaviorSubject.mjs","names":["BehaviorSubject","tsplus_module_1","Subject","constructor","_value","value","getValue","hasError","thrownError","throwIfClosed","subscribeInternal","subscriber","subscription","_closed","next"],"sources":["../_src/BehaviorSubject.ts"],"sourcesContent":[null],"mappings":";AAAA,OAAM,MAAOA,eAAmB,SAAQC,eAAA,CAAAC,OAAwB;EAC9DC,YAAoBC,MAAS;IAC3B,KAAK,EAAE;IADW,KAAAA,MAAM,GAANA,MAAM;EAE1B;EAEA,IAAIC,KAAKA,CAAA;IACP,OAAO,IAAI,CAACC,QAAQ,EAAE;EACxB;EAEAA,QAAQA,CAAA;IACN,MAAM;MAAEC,QAAQ;MAAEC,WAAW;MAAEJ;IAAM,CAAE,GAAG,IAAI;IAC9C,IAAIG,QAAQ,EAAE;MACZ,MAAMC,WAAW;IACnB;IACA,IAAI,CAACC,aAAa,EAAE;IACpB,OAAOL,MAAM;EACf;EAEUM,iBAAiBA,CAACC,UAAgC;IAC1D,MAAMC,YAAY,GAAG,KAAK,CAACF,iBAAiB,CAACC,UAAU,CAAC;IACxD,CAACC,YAAY,CAACC,OAAO,IAAIF,UAAU,CAACG,IAAI,CAAC,IAAI,CAACV,MAAM,CAAC;IACrD,OAAOQ,YAAY;EACrB;EAEAE,IAAIA,CAACT,KAAQ;IACX,KAAK,CAACS,IAAI,CAAE,IAAI,CAACV,MAAM,GAAGC,KAAM,CAAC;EACnC","ignoreList":[]}
1
+ {"version":3,"file":"BehaviorSubject.mjs","names":[],"sources":["../esm/BehaviorSubject.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/observable/Subject\";\nexport class BehaviorSubject extends tsplus_module_1.Subject {\n _value;\n constructor(_value) {\n super();\n this._value = _value;\n }\n get value() {\n return this.getValue();\n }\n getValue() {\n const { hasError, thrownError, _value } = this;\n if (hasError) {\n throw thrownError;\n }\n this.throwIfClosed();\n return _value;\n }\n subscribeInternal(subscriber) {\n const subscription = super.subscribeInternal(subscriber);\n !subscription._closed && subscriber.next(this._value);\n return subscription;\n }\n next(value) {\n super.next((this._value = value));\n }\n}\n//# sourceMappingURL=BehaviorSubject.js.map"],"mappings":";;AACA,IAAa,kBAAb,cAAqC,gBAAgB,QAAQ;CACzD;CACA,YAAY,QAAQ;AAChB,SAAO;AACP,OAAK,SAAS;;CAElB,IAAI,QAAQ;AACR,SAAO,KAAK,UAAU;;CAE1B,WAAW;EACP,MAAM,EAAE,UAAU,aAAa,WAAW;AAC1C,MAAI,SACA,OAAM;AAEV,OAAK,eAAe;AACpB,SAAO;;CAEX,kBAAkB,YAAY;EAC1B,MAAM,eAAe,MAAM,kBAAkB,WAAW;AACxD,GAAC,aAAa,WAAW,WAAW,KAAK,KAAK,OAAO;AACrD,SAAO;;CAEX,KAAK,OAAO;AACR,QAAM,KAAM,KAAK,SAAS,MAAO"}
@@ -1,72 +1,69 @@
1
- var _a, _b, _c;
2
- export const match = match_1;
3
- export const NextTypeId = /*#__PURE__*/Symbol.for("fncts.observable.Notification.Next");
4
- export class Next {
5
- constructor(value) {
6
- this.value = value;
7
- this._tag = "Next";
8
- this[_a] = NextTypeId;
9
- }
10
- }
11
- _a = NextTypeId;
12
- export const FailTypeId = /*#__PURE__*/Symbol.for("fncts.observable.Notification.Fail");
13
- export class Fail {
14
- constructor(error) {
15
- this.error = error;
16
- this._tag = "Fail";
17
- this[_b] = FailTypeId;
18
- }
19
- }
20
- _b = FailTypeId;
21
- export const CompleteTypeId = /*#__PURE__*/Symbol.for("fncts.observable.Notification.Complete");
22
- export class Complete {
23
- constructor() {
24
- this._tag = "Complete";
25
- this[_c] = CompleteTypeId;
26
- }
27
- }
28
- _c = CompleteTypeId;
29
- const COMPLETE = /*#__PURE__*/new Complete();
30
- export const Notification = {};
1
+ //#region build/esm/Notification.js
2
+ const match = match_1;
3
+ const NextTypeId = Symbol.for("fncts.observable.Notification.Next");
4
+ var Next = class {
5
+ value;
6
+ _tag = "Next";
7
+ [NextTypeId] = NextTypeId;
8
+ constructor(value) {
9
+ this.value = value;
10
+ }
11
+ };
12
+ const FailTypeId = Symbol.for("fncts.observable.Notification.Fail");
13
+ var Fail = class {
14
+ error;
15
+ _tag = "Fail";
16
+ [FailTypeId] = FailTypeId;
17
+ constructor(error) {
18
+ this.error = error;
19
+ }
20
+ };
21
+ const CompleteTypeId = Symbol.for("fncts.observable.Notification.Complete");
22
+ var Complete = class {
23
+ _tag = "Complete";
24
+ [CompleteTypeId] = CompleteTypeId;
25
+ };
26
+ const COMPLETE = new Complete();
27
+ const Notification = {};
31
28
  /**
32
- * @tsplus static fncts.observable.NotificationOps next
33
- */
34
- export function next(value) {
35
- return new Next(value);
29
+ * @tsplus static fncts.observable.NotificationOps next
30
+ */
31
+ function next(value) {
32
+ return new Next(value);
36
33
  }
37
34
  /**
38
- * @tsplus static fncts.observable.NotificationOps error
39
- */
40
- export function error(error) {
41
- return new Fail(error);
35
+ * @tsplus static fncts.observable.NotificationOps error
36
+ */
37
+ function error(error) {
38
+ return new Fail(error);
42
39
  }
43
40
  /**
44
- * @tsplus static fncts.observable.NotificationOps complete
45
- */
46
- export function complete() {
47
- return COMPLETE;
41
+ * @tsplus static fncts.observable.NotificationOps complete
42
+ */
43
+ function complete() {
44
+ return COMPLETE;
48
45
  }
49
46
  /**
50
- * @tsplus pipeable fncts.observable.Notification match
51
- */
47
+ * @tsplus pipeable fncts.observable.Notification match
48
+ */
52
49
  function match_1(onNext, onFail, onComplete) {
53
- return fa => {
54
- switch (fa._tag) {
55
- case "Next":
56
- return onNext(fa.value);
57
- case "Fail":
58
- return onFail(fa.error);
59
- case "Complete":
60
- return onComplete();
61
- }
62
- };
50
+ return (fa) => {
51
+ switch (fa._tag) {
52
+ case "Next": return onNext(fa.value);
53
+ case "Fail": return onFail(fa.error);
54
+ case "Complete": return onComplete();
55
+ }
56
+ };
63
57
  }
64
58
  /**
65
- * @tsplus pipeable fncts.observable.Notification observe
66
- */
67
- export function observe(observer) {
68
- return notification => {
69
- return match_1(a => observer.next?.(a), e => observer.error?.(e), () => observer.complete?.())(notification);
70
- };
59
+ * @tsplus pipeable fncts.observable.Notification observe
60
+ */
61
+ function observe(observer) {
62
+ return (notification) => {
63
+ return match_1((a) => observer.next?.(a), (e) => observer.error?.(e), () => observer.complete?.())(notification);
64
+ };
71
65
  }
66
+ //#endregion
67
+ export { Complete, CompleteTypeId, Fail, FailTypeId, Next, NextTypeId, Notification, complete, error, match, next, observe };
68
+
72
69
  //# sourceMappingURL=Notification.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.mjs","names":["match","match_1","NextTypeId","Symbol","for","Next","constructor","value","_tag","_a","FailTypeId","Fail","error","_b","CompleteTypeId","Complete","_c","COMPLETE","Notification","next","complete","onNext","onFail","onComplete","fa","observe","observer","notification","a","e"],"sources":["../_src/Notification.ts"],"sourcesContent":[null],"mappings":";aAgEgBA,KAAK,GAAAC,OAAA;AAhErB,OAAO,MAAMC,UAAU,gBAAGC,MAAM,CAACC,GAAG,CAAC,oCAAoC,CAAC;AAG1E,OAAM,MAAOC,IAAI;EAGfC,YAAqBC,KAAQ;IAAR,KAAAA,KAAK,GAALA,KAAK;IAFjB,KAAAC,IAAI,GAAuB,MAAM;IACjC,KAAAC,EAAA,CAAY,GAAeP,UAAU;EACd;;KADtBA,UAAU;AAItB,OAAO,MAAMQ,UAAU,gBAAGP,MAAM,CAACC,GAAG,CAAC,oCAAoC,CAAC;AAG1E,OAAM,MAAOO,IAAI;EAGfL,YAAqBM,KAAe;IAAf,KAAAA,KAAK,GAALA,KAAK;IAFjB,KAAAJ,IAAI,GAAuB,MAAM;IACjC,KAAAK,EAAA,CAAY,GAAeH,UAAU;EACP;;KAD7BA,UAAU;AAItB,OAAO,MAAMI,cAAc,gBAAGX,MAAM,CAACC,GAAG,CAAC,wCAAwC,CAAC;AAGlF,OAAM,MAAOW,QAAQ;EAArBT,YAAA;IACW,KAAAE,IAAI,GAAG,UAAU;IACjB,KAAAQ,EAAA,CAAgB,GAAmBF,cAAc;EAC5D;;KADYA,cAAc;AAG1B,MAAMG,QAAQ,gBAAG,IAAIF,QAAQ,EAAE;AAY/B,OAAO,MAAMG,YAAY,GAAoB,EAAE;AAE/C;;;AAGA,OAAM,SAAUC,IAAIA,CAAuBZ,KAAQ;EACjD,OAAO,IAAIF,IAAI,CAACE,KAAK,CAAC;AACxB;AAEA;;;AAGA,OAAM,SAAUK,KAAKA,CAAuBA,KAAe;EACzD,OAAO,IAAID,IAAI,CAACC,KAAK,CAAC;AACxB;AAEA;;;AAGA,OAAM,SAAUQ,QAAQA,CAAA;EACtB,OAAOH,QAAQ;AACjB;AAEA;;;AAGA,SAAAhB,QAAqCoB,MAAmB,EAAEC,MAA0B,EAAEC,UAAmB;EACvG,OAAWC,EAAsB,IAAmB;IAClD,QAAQA,EAAE,CAAChB,IAAI;MACb,KAAK,MAAM;QACT,OAAOa,MAAM,CAACG,EAAE,CAACjB,KAAK,CAAC;MACzB,KAAK,MAAM;QACT,OAAOe,MAAM,CAACE,EAAE,CAACZ,KAAK,CAAC;MACzB,KAAK,UAAU;QACb,OAAOW,UAAU,EAAE;IACvB;EACF,CAAC;AACH;AAEA;;;AAGA,OAAM,SAAUE,OAAOA,CAAOC,QAAiC;EAC7D,OAAQC,YAAgC,IAAU;IAChD,OAAO1B,OAAA,CACJ2B,CAAC,IAAKF,QAAQ,CAACP,IAAI,GAAGS,CAAC,CAAC,EACxBC,CAAC,IAAKH,QAAQ,CAACd,KAAK,GAAGiB,CAAC,CAAC,EAC1B,MAAMH,QAAQ,CAACN,QAAQ,GAAE,CAAE,EAHtBO,YAAY,CAIlB;EACH,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"Notification.mjs","names":[],"sources":["../esm/Notification.js"],"sourcesContent":["export const match = match_1;\nexport const NextTypeId = Symbol.for(\"fncts.observable.Notification.Next\");\nexport class Next {\n value;\n _tag = \"Next\";\n [NextTypeId] = NextTypeId;\n constructor(value) {\n this.value = value;\n }\n}\nexport const FailTypeId = Symbol.for(\"fncts.observable.Notification.Fail\");\nexport class Fail {\n error;\n _tag = \"Fail\";\n [FailTypeId] = FailTypeId;\n constructor(error) {\n this.error = error;\n }\n}\nexport const CompleteTypeId = Symbol.for(\"fncts.observable.Notification.Complete\");\nexport class Complete {\n _tag = \"Complete\";\n [CompleteTypeId] = CompleteTypeId;\n}\nconst COMPLETE = new Complete();\nexport const Notification = {};\n/**\n * @tsplus static fncts.observable.NotificationOps next\n */\nexport function next(value) {\n return new Next(value);\n}\n/**\n * @tsplus static fncts.observable.NotificationOps error\n */\nexport function error(error) {\n return new Fail(error);\n}\n/**\n * @tsplus static fncts.observable.NotificationOps complete\n */\nexport function complete() {\n return COMPLETE;\n}\n/**\n * @tsplus pipeable fncts.observable.Notification match\n */\nfunction match_1(onNext, onFail, onComplete) {\n return (fa) => {\n switch (fa._tag) {\n case \"Next\":\n return onNext(fa.value);\n case \"Fail\":\n return onFail(fa.error);\n case \"Complete\":\n return onComplete();\n }\n };\n}\n/**\n * @tsplus pipeable fncts.observable.Notification observe\n */\nexport function observe(observer) {\n return (notification) => {\n return match_1((a) => observer.next?.(a), (e) => observer.error?.(e), () => observer.complete?.())(notification);\n };\n}\n//# sourceMappingURL=Notification.js.map"],"mappings":";AAAA,MAAa,QAAQ;AACrB,MAAa,aAAa,OAAO,IAAI,qCAAqC;AAC1E,IAAa,OAAb,MAAkB;CACd;CACA,OAAO;CACP,CAAC,cAAc;CACf,YAAY,OAAO;AACf,OAAK,QAAQ;;;AAGrB,MAAa,aAAa,OAAO,IAAI,qCAAqC;AAC1E,IAAa,OAAb,MAAkB;CACd;CACA,OAAO;CACP,CAAC,cAAc;CACf,YAAY,OAAO;AACf,OAAK,QAAQ;;;AAGrB,MAAa,iBAAiB,OAAO,IAAI,yCAAyC;AAClF,IAAa,WAAb,MAAsB;CAClB,OAAO;CACP,CAAC,kBAAkB;;AAEvB,MAAM,WAAW,IAAI,UAAU;AAC/B,MAAa,eAAe,EAAE;;;;AAI9B,SAAgB,KAAK,OAAO;AACxB,QAAO,IAAI,KAAK,MAAM;;;;;AAK1B,SAAgB,MAAM,OAAO;AACzB,QAAO,IAAI,KAAK,MAAM;;;;;AAK1B,SAAgB,WAAW;AACvB,QAAO;;;;;AAKX,SAAS,QAAQ,QAAQ,QAAQ,YAAY;AACzC,SAAQ,OAAO;AACX,UAAQ,GAAG,MAAX;GACI,KAAK,OACD,QAAO,OAAO,GAAG,MAAM;GAC3B,KAAK,OACD,QAAO,OAAO,GAAG,MAAM;GAC3B,KAAK,WACD,QAAO,YAAY;;;;;;;AAOnC,SAAgB,QAAQ,UAAU;AAC9B,SAAQ,iBAAiB;AACrB,SAAO,SAAS,MAAM,SAAS,OAAO,EAAE,GAAG,MAAM,SAAS,QAAQ,EAAE,QAAQ,SAAS,YAAY,CAAC,CAAC,aAAa"}
@@ -1,22 +1,22 @@
1
- import * as tsplus_module_1 from "@fncts/observable/Subject";
2
1
  import * as tsplus_module_2 from "@fncts/observable/Observable";
2
+ import * as tsplus_module_1 from "@fncts/observable/Subject";
3
3
  import * as tsplus_module_3 from "@fncts/observable/Observable/api";
4
- const DEFAULT_CONNECT_CONFIG = {
5
- connector: () => new tsplus_module_1.Subject()
6
- };
4
+ //#region build/esm/Observable/api/connect.js
5
+ const DEFAULT_CONNECT_CONFIG = { connector: () => new tsplus_module_1.Subject() };
7
6
  /**
8
- * @tsplus pipeable fncts.observable.Observable connect
9
- */
10
- export function connect(selector, config = DEFAULT_CONNECT_CONFIG) {
11
- return fa => {
12
- const {
13
- connector
14
- } = config;
15
- return new tsplus_module_2.Observable((subscriber, environment) => {
16
- const subject = connector();
17
- tsplus_module_3.from(selector(tsplus_module_3.fromSubscribable(subject))).provideEnvironment(environment).subscribe(subscriber);
18
- subscriber.add(fa.provideEnvironment(environment).subscribe(subject));
19
- });
20
- };
7
+ * @tsplus pipeable fncts.observable.Observable connect
8
+ */
9
+ function connect(selector, config = DEFAULT_CONNECT_CONFIG) {
10
+ return (fa) => {
11
+ const { connector } = config;
12
+ return new tsplus_module_2.Observable((subscriber, environment) => {
13
+ const subject = connector();
14
+ tsplus_module_3.from(selector(tsplus_module_3.fromSubscribable(subject))).provideEnvironment(environment).subscribe(subscriber);
15
+ subscriber.add(fa.provideEnvironment(environment).subscribe(subject));
16
+ });
17
+ };
21
18
  }
19
+ //#endregion
20
+ export { connect };
21
+
22
22
  //# sourceMappingURL=connect.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect.mjs","names":["DEFAULT_CONNECT_CONFIG","connector","tsplus_module_1","Subject","connect","selector","config","fa","tsplus_module_2","Observable","subscriber","environment","subject","tsplus_module_3","from","fromSubscribable","provideEnvironment","subscribe","add"],"sources":["../../../_src/Observable/api/connect.ts"],"sourcesContent":[null],"mappings":";;;AAIA,MAAMA,sBAAsB,GAA4B;EACtDC,SAAS,EAAEA,CAAA,KAAM,IAAAC,eAAA,CAAIC,OAAO;CAC7B;AAED;;;AAGA,OAAM,SAAUC,OAAOA,CACrBC,QAAqE,EACrEC,MAAA,GAA8BN,sBAAsB;EAEpD,OAAQO,EAAuB,IAAmC;IAChE,MAAM;MAAEN;IAAS,CAAE,GAAGK,MAAM;IAC5B,OAAO,IAAAE,eAAA,CAAIC,UAAU,CAAC,CAACC,UAAU,EAAEC,WAAW,KAAI;MAChD,MAAMC,OAAO,GAAGX,SAAS,EAAE;MAC3BY,eAAA,CAAAC,IAAA,CAAgBT,QAAQ,CAACQ,eAAA,CAAAE,gBAAA,CAA4BH,OAAO,CAAC,CAAC,CAAC,CAC5DI,kBAAkB,CAACL,WAAW,CAAC,CAC/BM,SAAS,CAACP,UAAU,CAAC;MACxBA,UAAU,CAACQ,GAAG,CAACX,EAAE,CAACS,kBAAkB,CAACL,WAAW,CAAC,CAACM,SAAS,CAACL,OAAO,CAAC,CAAC;IACvE,CAAC,CAAC;EACJ,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"connect.mjs","names":[],"sources":["../../../esm/Observable/api/connect.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/observable/Subject\";\nimport * as tsplus_module_2 from \"@fncts/observable/Observable\";\nimport * as tsplus_module_3 from \"@fncts/observable/Observable/api\";\nconst DEFAULT_CONNECT_CONFIG = {\n connector: () => new tsplus_module_1.Subject(),\n};\n/**\n * @tsplus pipeable fncts.observable.Observable connect\n */\nexport function connect(selector, config = DEFAULT_CONNECT_CONFIG) {\n return (fa) => {\n const { connector } = config;\n return new tsplus_module_2.Observable((subscriber, environment) => {\n const subject = connector();\n tsplus_module_3.from(selector(tsplus_module_3.fromSubscribable(subject)))\n .provideEnvironment(environment)\n .subscribe(subscriber);\n subscriber.add(fa.provideEnvironment(environment).subscribe(subject));\n });\n };\n}\n//# sourceMappingURL=connect.js.map"],"mappings":";;;;AAGA,MAAM,yBAAyB,EAC3B,iBAAiB,IAAI,gBAAgB,SAAS,EACjD;;;;AAID,SAAgB,QAAQ,UAAU,SAAS,wBAAwB;AAC/D,SAAQ,OAAO;EACX,MAAM,EAAE,cAAc;AACtB,SAAO,IAAI,gBAAgB,YAAY,YAAY,gBAAgB;GAC/D,MAAM,UAAU,WAAW;AAC3B,mBAAgB,KAAK,SAAS,gBAAgB,iBAAiB,QAAQ,CAAC,CAAC,CACpE,mBAAmB,YAAY,CAC/B,UAAU,WAAW;AAC1B,cAAW,IAAI,GAAG,mBAAmB,YAAY,CAAC,UAAU,QAAQ,CAAC;IACvE"}
@@ -1,42 +1,46 @@
1
- import * as tsplus_module_1 from "@fncts/observable/Subject";
2
1
  import * as tsplus_module_2 from "@fncts/observable/Observable";
2
+ import * as tsplus_module_1 from "@fncts/observable/Subject";
3
3
  import * as tsplus_module_3 from "@fncts/observable/Observable/api";
4
+ //#region build/esm/Observable/api/connectable.js
4
5
  const DEFAULT_CONFIG = {
5
- connector: () => new tsplus_module_1.Subject(),
6
- resetOnDisconnect: false
6
+ connector: () => new tsplus_module_1.Subject(),
7
+ resetOnDisconnect: false
8
+ };
9
+ var Connectable = class extends tsplus_module_2.Observable {
10
+ connection;
11
+ connector;
12
+ resetOnDisconnect;
13
+ source;
14
+ subject;
15
+ constructor(source, config) {
16
+ const { connector, resetOnDisconnect = true } = config;
17
+ const subject = connector();
18
+ super((subscriber) => {
19
+ return subject.subscribe(subscriber);
20
+ });
21
+ this.connection = null;
22
+ this.subject = subject;
23
+ this.connector = connector;
24
+ this.resetOnDisconnect = resetOnDisconnect;
25
+ this.source = tsplus_module_3.from(source);
26
+ }
27
+ connect() {
28
+ if (!this.connection || this.connection._closed) {
29
+ this.connection = tsplus_module_3.defer(() => this.source).provideEnvironment(this.environment).subscribe(this.subject);
30
+ if (this.resetOnDisconnect) this.connection.add(() => this.subject = this.connector());
31
+ }
32
+ return this.connection;
33
+ }
7
34
  };
8
- export class Connectable extends tsplus_module_2.Observable {
9
- constructor(source, config) {
10
- const {
11
- connector,
12
- resetOnDisconnect = true
13
- } = config;
14
- const subject = connector();
15
- super(subscriber => {
16
- return subject.subscribe(subscriber);
17
- });
18
- this.connection = null;
19
- this.subject = subject;
20
- this.connector = connector;
21
- this.resetOnDisconnect = resetOnDisconnect;
22
- this.source = tsplus_module_3.from(source);
23
- }
24
- connect() {
25
- if (!this.connection || this.connection._closed) {
26
- this.connection = tsplus_module_3.defer(() => this.source).provideEnvironment(this.environment).subscribe(this.subject);
27
- if (this.resetOnDisconnect) {
28
- this.connection.add(() => this.subject = this.connector());
29
- }
30
- }
31
- return this.connection;
32
- }
33
- }
34
35
  /**
35
- * @tsplus pipeable fncts.observable.Observable connectable
36
- */
37
- export function connectable(config = DEFAULT_CONFIG) {
38
- return source => {
39
- return new Connectable(source, config);
40
- };
36
+ * @tsplus pipeable fncts.observable.Observable connectable
37
+ */
38
+ function connectable(config = DEFAULT_CONFIG) {
39
+ return (source) => {
40
+ return new Connectable(source, config);
41
+ };
41
42
  }
43
+ //#endregion
44
+ export { Connectable, connectable };
45
+
42
46
  //# sourceMappingURL=connectable.mjs.map