Effection Logo

function suspend

thefrontside/effection

function suspend(): Operation<void>

Indefinitely pause execution of the current operation.

A suspended operation will remain paused until its enclosing scope is destroyed, at which point it proceeds as though return had been called from the point of suspension.

Examples

Example 1

import { main, suspend } from "effection";

await main(function* (resolve) {
  try {
    console.log('suspending');
    yield* suspend();
  } finally {
    console.log('done!');
  }
});

Return Type

Operation<void>

an operation that suspends the current operation