function createContext
thefrontside/effectionCreate a new Context
Examples
Example 1
import { createContext, main } from "effection";
const YourContext = createContext<string>("context-id");
await main(function* () {
yield* YourContext.with("abc-123", function* () {
console.log(yield* YourContext.expect()); // "abc-123"
});
});
Type Parameters
T
Parameters
name: string
the unique name to give this context.
defaultValueoptional: T
Return Type
Context<T>
the new context