function createScope
thefrontside/effectionfunction createScope(frame?: Frame): [Scope, () => Future<void>]
Create a new scope to serve as an entry point from normal JavaScript execution into Effection.
When creating a fresh scope (as opposed to capturing a reference to an existing one via https://effection-www-jctyb5nxhzq0.deno.dev/api/v3/createScope/useScope) it is the responsibility of the creator of the new scope to destroy it when it is no longer needed.
Examples
Example 1
let [scope, destroy] = createScope();
let task = scope.run(function*() {
//do some long running work
});
//... later
await destroy();
Parameters
frameoptional: Frame
Return Type
[https://effection-www-jctyb5nxhzq0.deno.dev/api/v3/createScope/Scope, () => https://effection-www-jctyb5nxhzq0.deno.dev/api/v3/createScope/Future<void>]
a tuple containing the new scope, and a function to destroy it.