Version 3.1.0 is behind the current release: jump to latest version (3.6.1).
interface Scope
thefrontside/effectionA programatic API to interact with an Effection scope from outside of an Operation.
Most often this is used to integrate external APIs with Effection by
capturing a Scope from a running operation with useScope, and then
using it to call back into itself from a callback.
The following example calls into Effection to implement a proxy around a google search by using express.js.
Examples
Example 1
import { main, useScope, suspend } from "effection";
import { express } from "express";
await main(function*() {
  let scope = yield* useScope();
  express().get("/", (req, resp) => {
    return scope.run(function*() {
      let signal = yield* useAbortSignal();
      let response = yield* fetch(`https://google.com?q=${req.params.q}`, { signal });
      resp.send(yield* response.text());
    });
  });
  yield* suspend();
});
Methods
- run<T>(operation: () => Operation<T>): Task<T>
- Spawn an Operation within - Scope.- This is used to create concurrent tasks from outside of a running operation. 
- get<T>(context: Context<T>): T | undefined
- Get a Context value from outside of an operation. 
- set<T>(context: Context<T>, value: T): T
- Set the value of a Context from outside of an operation