effect
Version:
The missing standard library for TypeScript, for writing production-grade software.
101 lines (99 loc) • 3.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.use = exports.make = exports.fork = exports.extend = exports.close = exports.addFinalizerExit = exports.addFinalizer = exports.ScopeTypeId = exports.Scope = exports.CloseableScopeTypeId = void 0;
var core = _interopRequireWildcard(require("./internal/core.js"));
var fiberRuntime = _interopRequireWildcard(require("./internal/fiberRuntime.js"));
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); }
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; }
/**
* @since 2.0.0
*/
/**
* A unique identifier for the `Scope` type.
*
* @since 2.0.0
* @category symbols
*/
const ScopeTypeId = exports.ScopeTypeId = core.ScopeTypeId;
/**
* A unique identifier for the `CloseableScope` type.
*
* @since 2.0.0
* @category symbols
*/
const CloseableScopeTypeId = exports.CloseableScopeTypeId = core.CloseableScopeTypeId;
/**
* A tag representing the current `Scope` in the environment.
*
* @since 2.0.0
* @category context
*/
const Scope = exports.Scope = fiberRuntime.scopeTag;
/**
* Adds a finalizer to this scope. The finalizer is guaranteed to be run when
* the scope is closed. Use this when the finalizer does not need to know the
* `Exit` value that the scope is closed with.
*
* @see {@link addFinalizerExit}
* @since 2.0.0
* @category utils
*/
const addFinalizer = exports.addFinalizer = core.scopeAddFinalizer;
/**
* Adds a finalizer to this scope. The finalizer receives the `Exit` value
* when the scope is closed, allowing it to perform different actions based
* on the exit status.
*
* @see {@link addFinalizer}
* @since 2.0.0
* @category utils
*/
const addFinalizerExit = exports.addFinalizerExit = core.scopeAddFinalizerExit;
/**
* Closes this scope with the specified exit value, running all finalizers that
* have been added to the scope.
*
* @since 2.0.0
* @category destructors
*/
const close = exports.close = core.scopeClose;
/**
* Extends the scope of an `Effect` that requires a scope into this scope.
* It provides this scope to the effect but does not close the scope when the
* effect completes execution. This allows extending a scoped value into a
* larger scope.
*
* @since 2.0.0
* @category utils
*/
const extend = exports.extend = fiberRuntime.scopeExtend;
/**
* Forks a new child scope with the specified execution strategy. The child scope
* will automatically be closed when this scope is closed.
*
* @since 2.0.0
* @category utils
*/
const fork = exports.fork = core.scopeFork;
/**
* Provides this closeable scope to an `Effect` that requires a scope,
* guaranteeing that the scope is closed with the result of that effect as
* soon as the effect completes execution, whether by success, failure, or
* interruption.
*
* @since 2.0.0
* @category destructors
*/
const use = exports.use = fiberRuntime.scopeUse;
/**
* Creates a new closeable scope where finalizers will run according to the
* specified `ExecutionStrategy`. If no execution strategy is provided, `sequential`
* will be used by default.
*
* @since 2.0.0
* @category constructors
*/
const make = exports.make = fiberRuntime.scopeMake;
//# sourceMappingURL=Scope.js.map