@typed/fx 1.27.3 → 1.28.0

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 (191) hide show
  1. package/dist/cjs/AsyncData.js +1 -1
  2. package/dist/cjs/AsyncData.js.map +1 -1
  3. package/dist/cjs/Emitter.js +3 -3
  4. package/dist/cjs/Emitter.js.map +1 -1
  5. package/dist/cjs/Form.js +15 -15
  6. package/dist/cjs/Form.js.map +1 -1
  7. package/dist/cjs/FormEntry.js +3 -3
  8. package/dist/cjs/FormEntry.js.map +1 -1
  9. package/dist/cjs/Fx.js +11 -9
  10. package/dist/cjs/Fx.js.map +1 -1
  11. package/dist/cjs/Idle.js +8 -8
  12. package/dist/cjs/Idle.js.map +1 -1
  13. package/dist/cjs/Match.js +17 -17
  14. package/dist/cjs/Match.js.map +1 -1
  15. package/dist/cjs/Pull.js +3 -3
  16. package/dist/cjs/Pull.js.map +1 -1
  17. package/dist/cjs/Push.js +1 -1
  18. package/dist/cjs/Push.js.map +1 -1
  19. package/dist/cjs/RefArray.js +2 -2
  20. package/dist/cjs/RefArray.js.map +1 -1
  21. package/dist/cjs/RefChunk.js +1 -1
  22. package/dist/cjs/RefChunk.js.map +1 -1
  23. package/dist/cjs/RefHashMap.js +1 -1
  24. package/dist/cjs/RefHashMap.js.map +1 -1
  25. package/dist/cjs/RefHashSet.js +1 -1
  26. package/dist/cjs/RefHashSet.js.map +1 -1
  27. package/dist/cjs/RefSubject.js +150 -75
  28. package/dist/cjs/RefSubject.js.map +1 -1
  29. package/dist/cjs/Sink.js +14 -14
  30. package/dist/cjs/Sink.js.map +1 -1
  31. package/dist/cjs/Stream.js +1 -1
  32. package/dist/cjs/Stream.js.map +1 -1
  33. package/dist/cjs/Subject.js +27 -22
  34. package/dist/cjs/Subject.js.map +1 -1
  35. package/dist/cjs/Typeclass.js +1 -1
  36. package/dist/cjs/Typeclass.js.map +1 -1
  37. package/dist/cjs/Versioned.js +4 -4
  38. package/dist/cjs/Versioned.js.map +1 -1
  39. package/dist/cjs/index.js +1 -1
  40. package/dist/cjs/index.js.map +1 -1
  41. package/dist/cjs/internal/DeferredRef.js +14 -11
  42. package/dist/cjs/internal/DeferredRef.js.map +1 -1
  43. package/dist/cjs/internal/core.js +71 -42
  44. package/dist/cjs/internal/core.js.map +1 -1
  45. package/dist/cjs/internal/diff.js +1 -1
  46. package/dist/cjs/internal/diff.js.map +1 -1
  47. package/dist/cjs/internal/effect-loop-operator.js +1 -1
  48. package/dist/cjs/internal/effect-loop-operator.js.map +1 -1
  49. package/dist/cjs/internal/effect-operator.js +3 -3
  50. package/dist/cjs/internal/effect-operator.js.map +1 -1
  51. package/dist/cjs/internal/effect-producer.js +3 -3
  52. package/dist/cjs/internal/effect-producer.js.map +1 -1
  53. package/dist/cjs/internal/helpers.js +63 -42
  54. package/dist/cjs/internal/helpers.js.map +1 -1
  55. package/dist/cjs/internal/keyed.js +34 -26
  56. package/dist/cjs/internal/keyed.js.map +1 -1
  57. package/dist/cjs/internal/loop-operator.js +1 -1
  58. package/dist/cjs/internal/loop-operator.js.map +1 -1
  59. package/dist/cjs/internal/operator.js +1 -1
  60. package/dist/cjs/internal/operator.js.map +1 -1
  61. package/dist/cjs/internal/protos.js +1 -1
  62. package/dist/cjs/internal/protos.js.map +1 -1
  63. package/dist/cjs/internal/provide.js +1 -1
  64. package/dist/cjs/internal/provide.js.map +1 -1
  65. package/dist/cjs/internal/share.js +8 -13
  66. package/dist/cjs/internal/share.js.map +1 -1
  67. package/dist/cjs/internal/sync-operator.js +4 -4
  68. package/dist/cjs/internal/sync-operator.js.map +1 -1
  69. package/dist/cjs/internal/sync-producer.js +27 -23
  70. package/dist/cjs/internal/sync-producer.js.map +1 -1
  71. package/dist/cjs/internal/withKey.js +7 -7
  72. package/dist/cjs/internal/withKey.js.map +1 -1
  73. package/dist/dts/AsyncData.d.ts +2 -2
  74. package/dist/dts/AsyncData.d.ts.map +1 -1
  75. package/dist/dts/Emitter.d.ts +1 -1
  76. package/dist/dts/Emitter.d.ts.map +1 -1
  77. package/dist/dts/Fx.d.ts +39 -13
  78. package/dist/dts/Fx.d.ts.map +1 -1
  79. package/dist/dts/Idle.d.ts.map +1 -1
  80. package/dist/dts/Match.d.ts +1 -1
  81. package/dist/dts/Match.d.ts.map +1 -1
  82. package/dist/dts/Push.d.ts +4 -1
  83. package/dist/dts/Push.d.ts.map +1 -1
  84. package/dist/dts/RefArray.d.ts +1 -2
  85. package/dist/dts/RefArray.d.ts.map +1 -1
  86. package/dist/dts/RefChunk.d.ts.map +1 -1
  87. package/dist/dts/RefHashMap.d.ts +1 -1
  88. package/dist/dts/RefHashMap.d.ts.map +1 -1
  89. package/dist/dts/RefHashSet.d.ts.map +1 -1
  90. package/dist/dts/RefSubject.d.ts +64 -3
  91. package/dist/dts/RefSubject.d.ts.map +1 -1
  92. package/dist/dts/Sink.d.ts +2 -1
  93. package/dist/dts/Sink.d.ts.map +1 -1
  94. package/dist/dts/Subject.d.ts +2 -1
  95. package/dist/dts/Subject.d.ts.map +1 -1
  96. package/dist/dts/Versioned.d.ts +3 -1
  97. package/dist/dts/Versioned.d.ts.map +1 -1
  98. package/dist/dts/internal/DeferredRef.d.ts +6 -4
  99. package/dist/dts/internal/DeferredRef.d.ts.map +1 -1
  100. package/dist/dts/internal/core.d.ts +25 -12
  101. package/dist/dts/internal/core.d.ts.map +1 -1
  102. package/dist/dts/internal/diff.d.ts +1 -1
  103. package/dist/dts/internal/diff.d.ts.map +1 -1
  104. package/dist/dts/internal/effect-operator.d.ts.map +1 -1
  105. package/dist/dts/internal/helpers.d.ts +8 -6
  106. package/dist/dts/internal/helpers.d.ts.map +1 -1
  107. package/dist/dts/internal/keyed.d.ts +2 -2
  108. package/dist/dts/internal/keyed.d.ts.map +1 -1
  109. package/dist/dts/internal/loop-operator.d.ts +1 -1
  110. package/dist/dts/internal/loop-operator.d.ts.map +1 -1
  111. package/dist/dts/internal/protos.d.ts +1 -1
  112. package/dist/dts/internal/protos.d.ts.map +1 -1
  113. package/dist/dts/internal/provide.d.ts.map +1 -1
  114. package/dist/dts/internal/share.d.ts +1 -1
  115. package/dist/dts/internal/share.d.ts.map +1 -1
  116. package/dist/dts/internal/strategies.d.ts.map +1 -1
  117. package/dist/dts/internal/sync-operator.d.ts.map +1 -1
  118. package/dist/dts/internal/sync-producer.d.ts +4 -4
  119. package/dist/dts/internal/sync-producer.d.ts.map +1 -1
  120. package/dist/esm/Emitter.js +1 -1
  121. package/dist/esm/Emitter.js.map +1 -1
  122. package/dist/esm/Form.js +14 -14
  123. package/dist/esm/Form.js.map +1 -1
  124. package/dist/esm/FormEntry.js +2 -2
  125. package/dist/esm/FormEntry.js.map +1 -1
  126. package/dist/esm/Fx.js +16 -5
  127. package/dist/esm/Fx.js.map +1 -1
  128. package/dist/esm/Idle.js +7 -7
  129. package/dist/esm/Idle.js.map +1 -1
  130. package/dist/esm/Match.js +17 -17
  131. package/dist/esm/Match.js.map +1 -1
  132. package/dist/esm/Pull.js +2 -2
  133. package/dist/esm/Push.js.map +1 -1
  134. package/dist/esm/RefArray.js +1 -1
  135. package/dist/esm/RefArray.js.map +1 -1
  136. package/dist/esm/RefHashMap.js.map +1 -1
  137. package/dist/esm/RefSubject.js +140 -59
  138. package/dist/esm/RefSubject.js.map +1 -1
  139. package/dist/esm/Sink.js +13 -13
  140. package/dist/esm/Sink.js.map +1 -1
  141. package/dist/esm/Subject.js +29 -20
  142. package/dist/esm/Subject.js.map +1 -1
  143. package/dist/esm/Versioned.js +1 -1
  144. package/dist/esm/Versioned.js.map +1 -1
  145. package/dist/esm/internal/DeferredRef.js +13 -10
  146. package/dist/esm/internal/DeferredRef.js.map +1 -1
  147. package/dist/esm/internal/core.js +70 -37
  148. package/dist/esm/internal/core.js.map +1 -1
  149. package/dist/esm/internal/diff.js.map +1 -1
  150. package/dist/esm/internal/effect-operator.js +2 -2
  151. package/dist/esm/internal/effect-producer.js +1 -1
  152. package/dist/esm/internal/helpers.js +62 -39
  153. package/dist/esm/internal/helpers.js.map +1 -1
  154. package/dist/esm/internal/keyed.js +26 -17
  155. package/dist/esm/internal/keyed.js.map +1 -1
  156. package/dist/esm/internal/share.js +7 -12
  157. package/dist/esm/internal/share.js.map +1 -1
  158. package/dist/esm/internal/sync-operator.js +3 -3
  159. package/dist/esm/internal/sync-operator.js.map +1 -1
  160. package/dist/esm/internal/sync-producer.js +7 -5
  161. package/dist/esm/internal/sync-producer.js.map +1 -1
  162. package/dist/esm/internal/withKey.js +6 -6
  163. package/dist/esm/internal/withKey.js.map +1 -1
  164. package/package.json +8 -7
  165. package/src/Emitter.ts +2 -1
  166. package/src/Form.ts +22 -30
  167. package/src/FormEntry.ts +2 -2
  168. package/src/Fx.ts +54 -36
  169. package/src/Idle.ts +7 -7
  170. package/src/Match.ts +24 -26
  171. package/src/Pull.ts +2 -2
  172. package/src/Push.ts +4 -1
  173. package/src/RefArray.ts +1 -1
  174. package/src/RefHashMap.ts +1 -1
  175. package/src/RefSubject.ts +262 -98
  176. package/src/Sink.ts +15 -14
  177. package/src/Subject.ts +55 -39
  178. package/src/Versioned.ts +4 -2
  179. package/src/internal/DeferredRef.ts +21 -11
  180. package/src/internal/core.ts +92 -61
  181. package/src/internal/diff.ts +1 -1
  182. package/src/internal/effect-operator.ts +2 -2
  183. package/src/internal/effect-producer.ts +3 -3
  184. package/src/internal/helpers.ts +89 -42
  185. package/src/internal/keyed.ts +47 -42
  186. package/src/internal/loop-operator.ts +1 -1
  187. package/src/internal/protos.ts +1 -1
  188. package/src/internal/share.ts +11 -26
  189. package/src/internal/sync-operator.ts +3 -3
  190. package/src/internal/sync-producer.ts +7 -5
  191. package/src/internal/withKey.ts +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"RefHashSet.js","names":["_Function","require","HashSet","_interopRequireWildcard","RefSubject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","make","initial","tagged","exports","add","dual","ref","value","update","appendAll","mutate","filterValues","predicate","map","filter","size","mapValues","f","partition","reduce","b"],"sources":["../../src/RefHashSet.ts"],"sourcesContent":[null],"mappings":";;;;;;;;AAOA,IAAAA,SAAA,gBAAAC,OAAA;AACA,IAAAC,OAAA,gBAAAC,uBAAA,eAAAF,OAAA;AAGA,IAAAG,UAAA,gBAAAD,uBAAA,eAAAF,OAAA;AAA6C,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,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AClD,CAAC,CACF","ignoreList":[]}
1
+ {"version":3,"file":"RefHashSet.js","names":["_Function","require","HashSet","_interopRequireWildcard","RefSubject","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","make","initial","tagged","exports","add","dual","ref","value","update","appendAll","mutate","filterValues","predicate","map","filter","size","mapValues","f","partition","reduce","b"],"sources":["../../src/RefHashSet.ts"],"sourcesContent":[null],"mappings":";;;;;;;;AAOA,IAAAA,SAAA,gBAAAC,OAAA;AACA,IAAAC,OAAA,gBAAAC,uBAAA,eAAAF,OAAA;AAGA,IAAAG,UAAA,gBAAAD,uBAAA,eAAAF,OAAA;AAA6C,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CA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SAASc,MAAMA,CAAab,GAAwB,EAAEc,CAAI,EAAEH,CAAoB;EAC9E,OAAOtC,UAAU,CAACkC,GAAG,CAACP,GAAG,EAAE7B,OAAO,CAAC0C,MAAM,CAACC,CAAC,EAAEH,CAAC,CAAC,CAAC;AAClD,CAAC,CACF","ignoreList":[]}
@@ -18,7 +18,7 @@ exports.isFiltered = isFiltered;
18
18
  exports.isRefSubject = isRefSubject;
19
19
  exports.modifyEffect = exports.modify = exports.mapEffect = exports.map = exports.make = void 0;
20
20
  exports.of = of;
21
- exports.provide = void 0;
21
+ exports.proxy = exports.provide = void 0;
22
22
  exports.delete = exports.reset = reset;
23
23
  exports.set = exports.runUpdates = void 0;
24
24
  exports.skipRepeats = skipRepeats;
@@ -31,33 +31,34 @@ exports.transformOrFail = transformOrFail;
31
31
  exports.tuple = tuple;
32
32
  exports.unsafeGetExit = exports.unsafeGet = void 0;
33
33
  exports.unsafeMake = unsafeMake;
34
- exports.updateEffect = exports.update = void 0;
34
+ exports.withSpan = exports.when = exports.updateEffect = exports.update = void 0;
35
35
  var C = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@typed/context"));
36
- var _effect = /*#__PURE__*/require("effect");
36
+ var Array = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Array"));
37
37
  var Boolean = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Boolean"));
38
38
  var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Cause"));
39
39
  var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Effect"));
40
- var Equal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Equal"));
41
40
  var ExecutionStrategy = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/ExecutionStrategy"));
42
41
  var Exit = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Exit"));
42
+ var Fiber = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Fiber"));
43
43
  var _Function = /*#__PURE__*/require("effect/Function");
44
44
  var Layer = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Layer"));
45
+ var MutableRef = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/MutableRef"));
45
46
  var _Number = /*#__PURE__*/require("effect/Number");
46
47
  var Option = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Option"));
47
- var ReadonlyArray = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/ReadonlyArray"));
48
48
  var Scope = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Scope"));
49
- var core = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/core.js"));
49
+ var Unify = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Unify"));
50
+ var internal = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/core.js"));
50
51
  var DeferredRef = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/DeferredRef.js"));
51
52
  var _helpers = /*#__PURE__*/require("./internal/helpers.js");
52
53
  var _protos = /*#__PURE__*/require("./internal/protos.js");
53
54
  var _provide = /*#__PURE__*/require("./internal/provide.js");
54
- var share = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./internal/share.js"));
55
+ var _share = /*#__PURE__*/require("./internal/share.js");
55
56
  var Sink = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./Sink.js"));
56
57
  var Subject = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./Subject.js"));
57
58
  var _TypeId = /*#__PURE__*/require("./TypeId.js");
58
59
  var Versioned = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./Versioned.js"));
59
60
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
60
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
61
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
61
62
  /**
62
63
  * A RefSubject is a Subject that can be used to read and write a value.
63
64
  * @since 1.20.0
@@ -66,6 +67,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
66
67
  const UNBOUNDED = {
67
68
  concurrency: "unbounded"
68
69
  };
70
+ // TODO: Kind of a Hack, but I don't really want to pollute the public API with this. What should we do with this?
71
+ const CURRENT_ENVIRONMENT_TAG = /*#__PURE__*/C.Tagged("@typed/environment/CurrentEnvironment");
72
+ const checkIsDOM = ctx => C.getOption(ctx, CURRENT_ENVIRONMENT_TAG).pipe(Option.map(s => s === "dom" || s === "test:dom"),
73
+ // Default behavior should allow multiple updates via Fx interface
74
+ Option.getOrElse(() => true));
69
75
  /**
70
76
  * @since 1.20.0
71
77
  */
@@ -76,7 +82,7 @@ function fromEffect(effect, options) {
76
82
  * @since 1.20.0
77
83
  */
78
84
  function fromFx(fx, options) {
79
- return DeferredRef.make((0, _helpers.getExitEquivalence)(options?.eq ?? Equal.equals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({
85
+ return DeferredRef.make((0, _helpers.getExitEquivalence)(options?.eq ?? internal.deepEquals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({
80
86
  deferredRef
81
87
  }) => makeCore(deferredRef, options)), Effect.tap(({
82
88
  core,
@@ -89,7 +95,7 @@ function fromFx(fx, options) {
89
95
  * @since 1.20.0
90
96
  */
91
97
  function fromRefSubject(ref, options) {
92
- return DeferredRef.make((0, _helpers.getExitEquivalence)(options?.eq ?? Equal.equals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({
98
+ return DeferredRef.make((0, _helpers.getExitEquivalence)(options?.eq ?? internal.deepEquals)).pipe(Effect.bindTo("deferredRef"), Effect.bind("core", ({
93
99
  deferredRef
94
100
  }) => makeCore(deferredRef, options)), Effect.tap(({
95
101
  core,
@@ -133,13 +139,17 @@ function unsafeMake(params) {
133
139
  } = params;
134
140
  return Effect.flatMap(Effect.runtime(), runtime => {
135
141
  const core = unsafeMakeCore(initial, id, runtime, scope, options);
142
+ const current = MutableRef.get(core.deferredRef.current);
136
143
  // Sometimes we might be instantiating directly from a known value
137
144
  // Here we seed the value and ensure the subject has it as well for re-broadcasting
138
- if ("initialValue" in params) {
145
+ if ("initialValue" in params && Option.isNone(current)) {
139
146
  core.deferredRef.done(Exit.succeed(params.initialValue));
140
147
  return Effect.map(core.subject.onSuccess(params.initialValue), () => new RefSubjectImpl(core));
148
+ } else if (Option.isSome(current)) {
149
+ return Effect.map(Effect.matchCauseEffect(current.value, core.subject), () => new RefSubjectImpl(core));
150
+ } else {
151
+ return Effect.succeed(new RefSubjectImpl(core));
141
152
  }
142
- return Effect.succeed(new RefSubjectImpl(core));
143
153
  });
144
154
  }
145
155
  class RefSubjectImpl extends _protos.FxEffectBase {
@@ -170,7 +180,7 @@ class RefSubjectImpl extends _protos.FxEffectBase {
170
180
  runUpdates(run) {
171
181
  return this.core.semaphore.withPermits(1)(run(this.getSetDelete));
172
182
  }
173
- unsafeGet = () => Option.getOrThrowWith(this.core.deferredRef.current, () => new Cause.NoSuchElementException());
183
+ unsafeGet = () => Option.getOrThrowWith(MutableRef.get(this.core.deferredRef.current), () => new Cause.NoSuchElementException());
174
184
  onSuccess(value) {
175
185
  return setCore(this.core, value);
176
186
  }
@@ -243,9 +253,9 @@ const runUpdates = exports.runUpdates = /*#__PURE__*/(0, _Function.dual)(isRefSu
243
253
  if (!options) {
244
254
  return ref.runUpdates(f);
245
255
  } else if (options.value === "initial") {
246
- return ref.runUpdates(ref => Effect.uninterruptibleMask(restore => Effect.flatMap(ref.get, initial => f(ref).pipe(restore, Effect.tapErrorCause(_effect.Unify.unify(cause => Cause.isInterruptedOnly(cause) ? options.onInterrupt(initial) : Effect.unit))))));
256
+ return ref.runUpdates(ref => Effect.uninterruptibleMask(restore => Effect.flatMap(ref.get, initial => f(ref).pipe(restore, Effect.tapErrorCause(Unify.unify(cause => Cause.isInterruptedOnly(cause) ? options.onInterrupt(initial) : Effect.void))))));
247
257
  } else {
248
- return ref.runUpdates(ref => Effect.uninterruptibleMask(restore => f(ref).pipe(restore, Effect.tapErrorCause(_effect.Unify.unify(cause => Cause.isInterruptedOnly(cause) ? Effect.flatMap(ref.get, options.onInterrupt) : Effect.unit)))));
258
+ return ref.runUpdates(ref => Effect.uninterruptibleMask(restore => f(ref).pipe(restore, Effect.tapErrorCause(Unify.unify(cause => Cause.isInterruptedOnly(cause) ? Effect.flatMap(ref.get, options.onInterrupt) : Effect.void)))));
249
259
  }
250
260
  });
251
261
  class RefSubjectCore {
@@ -269,22 +279,34 @@ function makeCore(initial, options) {
269
279
  return Effect.runtime().pipe(Effect.bindTo("runtime"), Effect.let("executionStrategy", () => options?.executionStrategy ?? ExecutionStrategy.parallel), Effect.bind("scope", ({
270
280
  executionStrategy,
271
281
  runtime
272
- }) => Scope.fork(C.get(runtime.context, Scope.Scope), executionStrategy)), Effect.bind("deferredRef", () => DeferredRef.make((0, _helpers.getExitEquivalence)(options?.eq ?? Equal.equals))), Effect.let("subject", () => Subject.unsafeMake(Math.max(1, options?.replay ?? 1))), Effect.tap(({
273
- scope,
274
- subject
275
- }) => Scope.addFinalizer(scope, subject.interrupt)), Effect.map(({
276
- deferredRef,
282
+ }) => Scope.fork(C.get(runtime.context, Scope.Scope), executionStrategy)), Effect.bind("id", () => Effect.fiberId), Effect.map(({
283
+ id,
277
284
  runtime,
278
- scope,
279
- subject
280
- }) => new RefSubjectCore(initial, subject, runtime, scope, deferredRef, Effect.unsafeMakeSemaphore(1))));
285
+ scope
286
+ }) => unsafeMakeCore(initial, id, runtime, scope, options)), Effect.tap(core => Scope.addFinalizer(core.scope, Effect.provide(core.subject.interrupt, core.runtime.context))));
281
287
  }
282
288
  function unsafeMakeCore(initial, id, runtime, scope, options) {
283
- return new RefSubjectCore(initial, Subject.unsafeMake(Math.max(1, options?.replay ?? 1)), runtime, scope, DeferredRef.unsafeMake(id, (0, _helpers.getExitEquivalence)(options?.eq ?? Equal.equals)), Effect.unsafeMakeSemaphore(1));
289
+ const subject = new Subject.HoldSubjectImpl();
290
+ const core = new RefSubjectCore(initial, subject, runtime, scope, DeferredRef.unsafeMake(id, (0, _helpers.getExitEquivalence)(options?.eq ?? internal.deepEquals), subject.lastValue), Effect.unsafeMakeSemaphore(1));
291
+ const onSuccess = a => core.deferredRef.done(Exit.succeed(a));
292
+ const onCause = cause => core.deferredRef.done(Exit.failCause(cause));
293
+ const onError = e => onCause(Cause.fail(e));
294
+ // Initialize the core with the initial value if it is synchronous
295
+ (0, _helpers.matchEffectPrimitive)(initial, {
296
+ Success: onSuccess,
297
+ Failure: onCause,
298
+ Some: onSuccess,
299
+ None: onError,
300
+ Left: onError,
301
+ Right: onSuccess,
302
+ Sync: f => onSuccess(f()),
303
+ Otherwise: () => false
304
+ });
305
+ return core;
284
306
  }
285
307
  function getOrInitializeCore(core, lockInitialize) {
286
308
  return Effect.suspend(() => {
287
- if (core._fiber === undefined && Option.isNone(core.deferredRef.current)) {
309
+ if (core._fiber === undefined && Option.isNone(MutableRef.get(core.deferredRef.current))) {
288
310
  return initializeCoreAndTap(core, lockInitialize);
289
311
  } else {
290
312
  return core.deferredRef;
@@ -296,16 +318,16 @@ function initializeCoreEffect(core, lock) {
296
318
  core._fiber = undefined;
297
319
  core.deferredRef.done(exit);
298
320
  }));
299
- return Effect.flatMap(Effect.forkIn(lock && core.semaphore ? core.semaphore.withPermits(1)(initialize) : initialize, core.scope), fiber => Effect.sync(() => core._fiber = fiber));
321
+ return Effect.flatMap(Effect.forkIn(lock ? core.semaphore.withPermits(1)(initialize) : initialize, core.scope), fiber => Effect.sync(() => core._fiber = fiber));
300
322
  }
301
323
  function initializeCore(core, lock) {
302
324
  const onSuccess = a => {
303
325
  core.deferredRef.done(Exit.succeed(a));
304
- return Effect.succeed(_effect.Fiber.succeed(a));
326
+ return Effect.succeed(Fiber.succeed(a));
305
327
  };
306
328
  const onCause = cause => {
307
329
  core.deferredRef.done(Exit.failCause(cause));
308
- return Effect.succeed(_effect.Fiber.failCause(cause));
330
+ return Effect.succeed(Fiber.failCause(cause));
309
331
  };
310
332
  const onError = e => onCause(Cause.fail(e));
311
333
  return (0, _helpers.matchEffectPrimitive)(core.initial, {
@@ -315,7 +337,7 @@ function initializeCore(core, lock) {
315
337
  None: onError,
316
338
  Left: onError,
317
339
  Right: onSuccess,
318
- Sync: f => onSuccess(f()),
340
+ Sync: f => Effect.suspend(() => onSuccess(f())),
319
341
  Otherwise: () => initializeCoreEffect(core, lock)
320
342
  });
321
343
  }
@@ -340,7 +362,7 @@ function onFailureCore(core, cause) {
340
362
  if (core.deferredRef.done(exit)) {
341
363
  return sendEvent(core, exit);
342
364
  } else {
343
- return Effect.unit;
365
+ return Effect.void;
344
366
  }
345
367
  });
346
368
  }
@@ -348,7 +370,7 @@ function interruptCore(core) {
348
370
  return Effect.fiberIdWith(id => {
349
371
  core.deferredRef.reset();
350
372
  const closeScope = Scope.close(core.scope, Exit.interrupt(id));
351
- const interruptFiber = core._fiber ? _effect.Fiber.interrupt(core._fiber) : Effect.unit;
373
+ const interruptFiber = core._fiber ? Fiber.interrupt(core._fiber) : Effect.void;
352
374
  const interruptSubject = core.subject.interrupt;
353
375
  return Effect.all([closeScope, interruptFiber, interruptSubject], {
354
376
  discard: true
@@ -357,12 +379,12 @@ function interruptCore(core) {
357
379
  }
358
380
  function deleteCore(core) {
359
381
  return Effect.suspend(() => {
360
- const current = core.deferredRef.current;
382
+ const current = MutableRef.get(core.deferredRef.current);
361
383
  core.deferredRef.reset();
362
384
  if (Option.isNone(current)) {
363
385
  return Effect.succeed(Option.none());
364
386
  }
365
- return core.subject.subscriberCount.pipe(Effect.provide(core.runtime.context), Effect.flatMap(count => count > 0 && !core._fiber ? initializeCore(core, false) : Effect.unit), Effect.zipRight(Effect.asSome(current.value)));
387
+ return core.subject.subscriberCount.pipe(Effect.provide(core.runtime.context), Effect.flatMap(count => count > 0 && !core._fiber ? initializeCore(core, false) : Effect.void), Effect.zipRight(Effect.asSome(current.value)));
366
388
  });
367
389
  }
368
390
  function tapEventCore(core, effect) {
@@ -421,10 +443,20 @@ class ComputedImpl extends Versioned.VersionedTransform {
421
443
  input;
422
444
  f;
423
445
  [_TypeId.ComputedTypeId] = _TypeId.ComputedTypeId;
446
+ _computed;
424
447
  constructor(input, f) {
425
- super(input, fx => share.hold(core.mapEffect(fx, f)), Effect.flatMap(f));
448
+ super(input, fx => internal.mapEffect(fx, f), Effect.flatMap(f));
426
449
  this.input = input;
427
450
  this.f = f;
451
+ this._computed = (0, _share.hold)(internal.fromFxEffect(Effect.contextWith(ctx => {
452
+ if (checkIsDOM(ctx)) {
453
+ return internal.fromEffect(input).pipe(_ => internal.continueWith(_, () => input), internal.skipRepeats, _ => internal.mapEffect(_, f), internal.skipRepeats);
454
+ }
455
+ return internal.fromEffect(Effect.flatMap(input, f));
456
+ })));
457
+ }
458
+ run(sink) {
459
+ return this._computed.run(sink);
428
460
  }
429
461
  unsafeGet = () => Option.getOrThrowWith(this._currentValue, () => new Cause.NoSuchElementException());
430
462
  static make(input, f) {
@@ -435,10 +467,17 @@ class FilteredImpl extends Versioned.VersionedTransform {
435
467
  input;
436
468
  f;
437
469
  [_TypeId.FilteredTypeId] = _TypeId.FilteredTypeId;
470
+ _filtered;
438
471
  constructor(input, f) {
439
- super(input, fx => share.hold(core.filterMapEffect(fx, f)), effect => Effect.flatten(Effect.flatMap(effect, f)));
472
+ super(input, fx => internal.filterMapEffect(fx, f), effect => Effect.flatten(Effect.flatMap(effect, f)));
440
473
  this.input = input;
441
474
  this.f = f;
475
+ this._filtered = (0, _share.hold)(internal.fromFxEffect(Effect.contextWith(ctx => {
476
+ if (checkIsDOM(ctx)) {
477
+ return internal.fromEffect(input).pipe(_ => internal.continueWith(_, () => input), internal.skipRepeats, _ => internal.filterMapEffect(_, f), internal.skipRepeats);
478
+ }
479
+ return Effect.flatMap(input, f).pipe(internal.fromEffect, _ => internal.filterMap(_, _Function.identity));
480
+ })));
442
481
  }
443
482
  static make(input, f) {
444
483
  return new FilteredImpl(input, f);
@@ -446,13 +485,16 @@ class FilteredImpl extends Versioned.VersionedTransform {
446
485
  asComputed() {
447
486
  return ComputedImpl.make(this.input, this.f);
448
487
  }
488
+ run(sink) {
489
+ return this._filtered.run(sink);
490
+ }
449
491
  unsafeGet = () => Option.getOrThrowWith(this._currentValue, () => new Cause.NoSuchElementException());
450
492
  }
451
493
  /**
452
494
  * @since 1.20.0
453
495
  */
454
496
  const skipRepeatsWith = exports.skipRepeatsWith = /*#__PURE__*/(0, _Function.dual)(2, function skipRepeatsWith(ref, eq) {
455
- const versioned = Versioned.transform(ref, fx => core.skipRepeatsWith(fx, eq), _Function.identity);
497
+ const versioned = Versioned.transform(ref, fx => internal.skipRepeatsWith(fx, eq), _Function.identity);
456
498
  if (_TypeId.FilteredTypeId in ref) {
457
499
  return FilteredImpl.make(versioned, Effect.succeedSome);
458
500
  } else {
@@ -460,7 +502,7 @@ const skipRepeatsWith = exports.skipRepeatsWith = /*#__PURE__*/(0, _Function.dua
460
502
  }
461
503
  });
462
504
  function skipRepeats(ref) {
463
- return skipRepeatsWith(ref, Equal.equals);
505
+ return skipRepeatsWith(ref, internal.deepEquals);
464
506
  }
465
507
  /**
466
508
  * @since 1.20.0
@@ -537,7 +579,7 @@ class RefSubjectTransformEffect extends _protos.FxEffectBase {
537
579
  this.subject = new Subject.HoldSubjectImpl();
538
580
  }
539
581
  run(sink) {
540
- return core.skipRepeats(core.merge(core.tapEffect(core.mapEffect(this.ref, this.from), this.subject.onSuccess), this.subject)).run(sink);
582
+ return internal.skipRepeats(internal.merge(internal.tapEffect(internal.mapEffect(this.ref, this.from), this.subject.onSuccess), this.subject)).run(sink);
541
583
  }
542
584
  runUpdates(run) {
543
585
  return this.ref.runUpdates(ref => run({
@@ -553,7 +595,7 @@ class RefSubjectTransformEffect extends _protos.FxEffectBase {
553
595
  }));
554
596
  }
555
597
  unsafeGet = () => {
556
- return Option.getOrThrowWith(_effect.MutableRef.get(this.subject.lastValue), () => new Cause.NoSuchElementException());
598
+ return Option.getOrThrowWith(MutableRef.get(this.subject.lastValue), () => new Cause.NoSuchElementException());
557
599
  };
558
600
  onFailure(cause) {
559
601
  return this.subject.onFailure(cause);
@@ -619,7 +661,7 @@ class RefSubjectTuple extends _protos.FxEffectBase {
619
661
  this.versioned = Versioned.hold(Versioned.tuple(refs));
620
662
  this.version = this.versioned.version;
621
663
  this.interrupt = Effect.all(refs.map(r => r.interrupt), UNBOUNDED);
622
- this.subscriberCount = Effect.map(Effect.all(refs.map(r => r.subscriberCount), UNBOUNDED), ReadonlyArray.reduce(0, _Number.sum));
664
+ this.subscriberCount = Effect.map(Effect.all(refs.map(r => r.subscriberCount), UNBOUNDED), Array.reduce(0, _Number.sum));
623
665
  this.getSetDelete = {
624
666
  get: this.versioned,
625
667
  set: a => Effect.all(refs.map((r, i) => set(r, a[i])), UNBOUNDED),
@@ -686,7 +728,7 @@ class RefSubjectStruct extends _protos.FxEffectBase {
686
728
  this.versioned = Versioned.hold(Versioned.struct(refs));
687
729
  this.version = this.versioned.version;
688
730
  this.interrupt = Effect.all(Object.values(refs).map(r => r.interrupt), UNBOUNDED);
689
- this.subscriberCount = Effect.map(Effect.all(Object.values(refs).map(r => r.subscriberCount), UNBOUNDED), ReadonlyArray.reduce(0, _Number.sum));
731
+ this.subscriberCount = Effect.map(Effect.all(Object.values(refs).map(r => r.subscriberCount), UNBOUNDED), Array.reduce(0, _Number.sum));
690
732
  this.getSetDelete = {
691
733
  get: this.versioned,
692
734
  set: a => Effect.all(Object.keys(refs).map(k => set(refs[k], a[k])), UNBOUNDED),
@@ -766,7 +808,16 @@ class RefSubjectTagged extends _protos.FxEffectBase {
766
808
  onSuccess(value) {
767
809
  return this.tag.withEffect(ref => ref.onSuccess(value));
768
810
  }
769
- make = (fxOrEffect, options) => this.tag.scoped(make(fxOrEffect, options));
811
+ layer = make => this.tag.scoped(make);
812
+ make = (fxOrEffect, options) => {
813
+ return this.tag.scoped(Effect.gen(function* (_) {
814
+ let ref = yield* make(fxOrEffect, options);
815
+ if (options?.drop || options?.take) {
816
+ ref = slice(ref, options.drop ?? 0, options.take ?? Infinity);
817
+ }
818
+ return ref;
819
+ }));
820
+ };
770
821
  }
771
822
  /**
772
823
  * @since 1.20.0
@@ -789,7 +840,7 @@ class RefSubjectFromTag extends _protos.FxEffectBase {
789
840
  this.tag = tag;
790
841
  this.f = f;
791
842
  this._get = Effect.map(tag, f);
792
- this._fx = core.fromFxEffect(this._get);
843
+ this._fx = internal.fromFxEffect(this._get);
793
844
  this.version = Effect.flatMap(this._get, ref => ref.version);
794
845
  this.interrupt = Effect.flatMap(this._get, ref => ref.interrupt);
795
846
  this.subscriberCount = Effect.flatMap(this._get, ref => ref.subscriberCount);
@@ -961,7 +1012,7 @@ const decrement = ref => update(ref, sub);
961
1012
  */
962
1013
  exports.decrement = decrement;
963
1014
  const slice = exports.slice = /*#__PURE__*/(0, _Function.dual)(3, function slice(ref, drop, take) {
964
- return new RefSubjectSlice(ref, drop, take);
1015
+ return new RefSubjectSimpleTransform(ref, _ => internal.slice(_, drop, take), _Function.identity);
965
1016
  });
966
1017
  /**
967
1018
  * @since 1.20.0
@@ -975,32 +1026,74 @@ const drop = exports.drop = /*#__PURE__*/(0, _Function.dual)(2, function drop(re
975
1026
  const take = exports.take = /*#__PURE__*/(0, _Function.dual)(2, function take(ref, take) {
976
1027
  return slice(ref, 0, take);
977
1028
  });
978
- class RefSubjectSlice extends _protos.FxEffectBase {
1029
+ /**
1030
+ * Get the current value of the RefSubject. If it has not been set yet, a Fiber will be used to wait for the value to be set.
1031
+ *
1032
+ * @since 1.25.0
1033
+ */
1034
+ const get = ref => ref;
1035
+ /**
1036
+ * Synchronously get the current Exit value of the RefSubject. If it has not been set yet, a Cause.NoSuchElementException will be thrown.
1037
+ *
1038
+ * Note: This is unimplemented for RefSubject.tagged and RefSubject.fromTag because they require the Effect context by definition.
1039
+ * It will throw immediately.
1040
+ *
1041
+ * @since 1.25.0
1042
+ */
1043
+ exports.get = get;
1044
+ const unsafeGetExit = ref => ref.unsafeGet();
1045
+ /**
1046
+ * Synchronously get the current value of the RefSubject.
1047
+ *
1048
+ * @since 1.25.0
1049
+ */
1050
+ exports.unsafeGetExit = unsafeGetExit;
1051
+ const unsafeGet = ref => Effect.runSync(unsafeGetExit(ref));
1052
+ /**
1053
+ * Extract all values from an object using a Proxy
1054
+ *
1055
+ * @since 2.0.0
1056
+ */
1057
+ exports.unsafeGet = unsafeGet;
1058
+ const proxy = source => {
1059
+ const target = {};
1060
+ return new Proxy(target, {
1061
+ get(self, prop) {
1062
+ if (prop in self) return self[prop];
1063
+ return self[prop] = map(source, a => a[prop]);
1064
+ }
1065
+ });
1066
+ };
1067
+ /**
1068
+ * @since 2.0.0
1069
+ */
1070
+ exports.proxy = proxy;
1071
+ const withSpan = exports.withSpan = /*#__PURE__*/(0, _Function.dual)(isRefSubjectDataFirst, (ref, name, options) => new RefSubjectSimpleTransform(ref, fx => internal.withSpan(fx, name, options), Effect.withSpan(name, options)));
1072
+ class RefSubjectSimpleTransform extends _protos.FxEffectBase {
979
1073
  ref;
980
- drop;
981
- take;
1074
+ transformFx;
1075
+ transformEffect;
982
1076
  [_TypeId.ComputedTypeId] = _TypeId.ComputedTypeId;
983
1077
  [_TypeId.RefSubjectTypeId] = _TypeId.RefSubjectTypeId;
984
1078
  version;
985
1079
  interrupt;
986
1080
  subscriberCount;
987
1081
  _fx;
988
- constructor(ref, drop, take) {
1082
+ constructor(ref, transformFx, transformEffect) {
989
1083
  super();
990
1084
  this.ref = ref;
991
- this.drop = drop;
992
- this.take = take;
1085
+ this.transformFx = transformFx;
1086
+ this.transformEffect = transformEffect;
993
1087
  this.version = ref.version;
994
1088
  this.interrupt = ref.interrupt;
995
1089
  this.subscriberCount = ref.subscriberCount;
996
- this._fx = share.hold(core.slice(ref, drop, take));
997
- this._effect = ref;
1090
+ this._fx = transformFx(ref);
998
1091
  }
999
1092
  run(sink) {
1000
1093
  return this._fx.run(sink);
1001
1094
  }
1002
1095
  toEffect() {
1003
- return this.ref;
1096
+ return this.transformEffect(this.ref);
1004
1097
  }
1005
1098
  runUpdates(run) {
1006
1099
  return this.ref.runUpdates(run);
@@ -1014,27 +1107,9 @@ class RefSubjectSlice extends _protos.FxEffectBase {
1014
1107
  }
1015
1108
  }
1016
1109
  /**
1017
- * Get the current value of the RefSubject. If it has not been set yet, a Fiber will be used to wait for the value to be set.
1018
- *
1019
- * @since 1.25.0
1110
+ * @since 2.0.0
1020
1111
  */
1021
- const get = ref => ref;
1022
- /**
1023
- * Synchronously get the current Exit value of the RefSubject. If it has not been set yet, a Cause.NoSuchElementException will be thrown.
1024
- *
1025
- * Note: This is unimplemented for RefSubject.tagged and RefSubject.fromTag because they require the Effect context by definition.
1026
- * It will throw immediately.
1027
- *
1028
- * @since 1.25.0
1029
- */
1030
- exports.get = get;
1031
- const unsafeGetExit = ref => ref.unsafeGet();
1032
- /**
1033
- * Synchronously get the current value of the RefSubject.
1034
- *
1035
- * @since 1.25.0
1036
- */
1037
- exports.unsafeGetExit = unsafeGetExit;
1038
- const unsafeGet = ref => Effect.runSync(unsafeGetExit(ref));
1039
- exports.unsafeGet = unsafeGet;
1112
+ const when = exports.when = /*#__PURE__*/(0, _Function.dual)(2, function when(ref, options) {
1113
+ return map(ref, a => a ? options.onTrue : options.onFalse);
1114
+ });
1040
1115
  //# sourceMappingURL=RefSubject.js.map