context-inject
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Inject values from a parent scope into child scopes in async context.

node:

npm i async-context

deno:

import { context } from "https://deno.land/x/context_inject/src/index.ts";

example

const { inject, access } = context((): string => "nothing injected");
const withString = inject(() => "injected");

const f = () => Promise.resolve(access());

await withString(f)(); // "injected"

await f(); // "nothing injected"

Readme

Keywords

none

Package Sidebar

Install

npm i context-inject

Weekly Downloads

34

Version

0.0.3

License

MIT

Unpacked Size

3.94 kB

Total Files

9

Last publish

Collaborators

  • uriv