@effect/platform-browser 0.20.2 → 0.20.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.
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import * as Fiber from "effect/Fiber";
|
|
3
4
|
/** @internal */
|
|
4
5
|
export const runMain = effect => {
|
|
5
|
-
const fiber = Effect.runFork(effect
|
|
6
|
+
const fiber = Effect.runFork(Effect.tapErrorCause(effect, cause => {
|
|
7
|
+
if (Cause.isInterruptedOnly(cause)) {
|
|
8
|
+
return Effect.unit;
|
|
9
|
+
}
|
|
10
|
+
return Effect.logError(cause);
|
|
11
|
+
}));
|
|
6
12
|
fiber.addObserver(() => {
|
|
7
13
|
Effect.runFork(interruptAll(fiber.id()));
|
|
8
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":["Effect","Fiber","runMain","effect","fiber","runFork","addObserver","interruptAll","id","addEventListener","interruptAsFork","flatMap","roots","interruptAllAs"],"sources":["../../../src/internal/runtime.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAGrC;AACA,OAAO,MAAMC,OAAO,GAClBC,MAAkC,IAChC;EACF,MAAMC,KAAK,GAAGJ,MAAM,CAACK,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["Cause","Effect","Fiber","runMain","effect","fiber","runFork","tapErrorCause","cause","isInterruptedOnly","unit","logError","addObserver","interruptAll","id","addEventListener","interruptAsFork","flatMap","roots","interruptAllAs"],"sources":["../../../src/internal/runtime.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,cAAc;AACrC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,OAAO,KAAKC,KAAK,MAAM,cAAc;AAGrC;AACA,OAAO,MAAMC,OAAO,GAClBC,MAAkC,IAChC;EACF,MAAMC,KAAK,GAAGJ,MAAM,CAACK,OAAO,CAC1BL,MAAM,CAACM,aAAa,CAACH,MAAM,EAAGI,KAAK,IAAI;IACrC,IAAIR,KAAK,CAACS,iBAAiB,CAACD,KAAK,CAAC,EAAE;MAClC,OAAOP,MAAM,CAACS,IAAI;IACpB;IACA,OAAOT,MAAM,CAACU,QAAQ,CAACH,KAAK,CAAC;EAC/B,CAAC,CAAC,CACH;EAEDH,KAAK,CAACO,WAAW,CAAC,MAAK;IACrBX,MAAM,CAACK,OAAO,CAACO,YAAY,CAACR,KAAK,CAACS,EAAE,EAAE,CAAC,CAAC;EAC1C,CAAC,CAAC;EAEFC,gBAAgB,CAAC,cAAc,EAAE,MAAK;IACpCd,MAAM,CAACK,OAAO,CAACD,KAAK,CAACW,eAAe,CAACX,KAAK,CAACS,EAAE,EAAE,CAAC,CAAC;EACnD,CAAC,CAAC;AACJ,CAAC;AAED,MAAMD,YAAY,GAAIC,EAAmB,IACvCb,MAAM,CAACgB,OAAO,CACZf,KAAK,CAACgB,KAAK,EACVA,KAAK,IAAKhB,KAAK,CAACiB,cAAc,CAACD,KAAK,EAAEJ,EAAE,CAAC,CAC3C"}
|
package/internal/runtime.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.runMain = void 0;
|
|
7
|
+
var Cause = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Cause"));
|
|
7
8
|
var Effect = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Effect"));
|
|
8
9
|
var Fiber = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("effect/Fiber"));
|
|
9
10
|
function _getRequireWildcardCache(e) {
|
|
@@ -33,7 +34,12 @@ function _interopRequireWildcard(e, r) {
|
|
|
33
34
|
}
|
|
34
35
|
/** @internal */
|
|
35
36
|
const runMain = effect => {
|
|
36
|
-
const fiber = Effect.runFork(effect
|
|
37
|
+
const fiber = Effect.runFork(Effect.tapErrorCause(effect, cause => {
|
|
38
|
+
if (Cause.isInterruptedOnly(cause)) {
|
|
39
|
+
return Effect.unit;
|
|
40
|
+
}
|
|
41
|
+
return Effect.logError(cause);
|
|
42
|
+
}));
|
|
37
43
|
fiber.addObserver(() => {
|
|
38
44
|
Effect.runFork(interruptAll(fiber.id()));
|
|
39
45
|
});
|
package/internal/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":["
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["Cause","_interopRequireWildcard","require","Effect","Fiber","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","runMain","effect","fiber","runFork","tapErrorCause","cause","isInterruptedOnly","unit","logError","addObserver","interruptAll","id","addEventListener","interruptAsFork","exports","flatMap","roots","interruptAllAs"],"sources":["../src/internal/runtime.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA,IAAAA,KAAA,gBAAAC,uBAAA,eAAAC,OAAA;AACA,IAAAC,MAAA,gBAAAF,uBAAA,eAAAC,OAAA;AACA,IAAAE,KAAA,gBAAAH,uBAAA,eAAAC,OAAA;AAAqC,SAAAG,yBAAAC,CAAA;EAAA,yBAAAC,OAAA;EAAA,IAAAC,CAAA,OAAAD,OAAA;IAAAE,CAAA,OAAAF,OAAA;EAAA,QAAAF,wBAAA,YAAAA,CAAAC,CAAA;IAAA,OAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA;EAAA,GAAAF,CAAA;AAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA;EAAA,KAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA;EAAA,aAAAA,CAAA,uBAAAA,CAAA,yBAAA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O,YAAY,CAACR,KAAK,CAACS,EAAE,EAAE,CAAC,CAAC;EAC1C,CAAC,CAAC;EAEFC,gBAAgB,CAAC,cAAc,EAAE,MAAK;IACpCnC,MAAM,CAAC0B,OAAO,CAACD,KAAK,CAACW,eAAe,CAACX,KAAK,CAACS,EAAE,EAAE,CAAC,CAAC;EACnD,CAAC,CAAC;AACJ,CAAC;AAAAG,OAAA,CAAAd,OAAA,GAAAA,OAAA;AAED,MAAMU,YAAY,GAAIC,EAAmB,IACvClC,MAAM,CAACsC,OAAO,CACZrC,KAAK,CAACsC,KAAK,EACVA,KAAK,IAAKtC,KAAK,CAACuC,cAAc,CAACD,KAAK,EAAEL,EAAE,CAAC,CAC3C"}
|
package/package.json
CHANGED
package/src/internal/runtime.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause"
|
|
1
2
|
import * as Effect from "effect/Effect"
|
|
2
3
|
import * as Fiber from "effect/Fiber"
|
|
3
4
|
import type * as FiberId from "effect/FiberId"
|
|
@@ -6,7 +7,14 @@ import type * as FiberId from "effect/FiberId"
|
|
|
6
7
|
export const runMain = <E, A>(
|
|
7
8
|
effect: Effect.Effect<never, E, A>
|
|
8
9
|
) => {
|
|
9
|
-
const fiber = Effect.runFork(
|
|
10
|
+
const fiber = Effect.runFork(
|
|
11
|
+
Effect.tapErrorCause(effect, (cause) => {
|
|
12
|
+
if (Cause.isInterruptedOnly(cause)) {
|
|
13
|
+
return Effect.unit
|
|
14
|
+
}
|
|
15
|
+
return Effect.logError(cause)
|
|
16
|
+
})
|
|
17
|
+
)
|
|
10
18
|
|
|
11
19
|
fiber.addObserver(() => {
|
|
12
20
|
Effect.runFork(interruptAll(fiber.id()))
|