Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/starfx/mod.ts

A micro-mvc framework for react apps
Go to Latest
import * as starfx from "https://deno.land/x/starfx@v0.13.2/mod.ts";

Functions

Create an Operation that can be either resolved (or rejected) with a synchronous callback. This is the Effection equivalent of new Promise().

Pause the current operation, then runs a promise, async function, plain function, or operation within a new scope. The calling operation will be resumed (or errored) once call is completed.

Creates a middleware thunksline for HTTP requests.

Create a new Channel. Use channels to communicate between operations. In order to dispatch messages from outside an operation such as from a callback, use Signal.

Creates a new queue. Queues are unlimited in size and sending a message to a queue is always synchronous.

Create a new scope to serve as an entry point from normal JavaScript execution into Effection.

Create a new Signal

Creates a middleware pipeline.

Consume an effection stream using a simple for-of loop.

Run the given function or operation when the current operation shuts down. This is equivalent to running the function or operation in a finally {} block, but it can help you avoid rightward drift.

Race the given operations against each other and return the value of whichever operation returns first. This has the same purpose as Promise.race.

Define an Effection resource

Execute an operation.

Sleep for the given amount of milliseconds.

Run another operation concurrently as a child of the current one.

supvervise will watch whatever Operation is provided and it will automatically try to restart it when it exists. By default it uses a backoff pressure mechanism so if there is an error simply calling the Operation then it will exponentially wait longer until attempting to restart and eventually give up.

timer() will create a cache timer for each key inside of a starfx api endpoint. key is a hash of the action type and payload.

Create an AbortSignal bound to the current scope. Whenever that scope is completed, errored, or halted, the abort signal will be triggered.

Interfaces

A broadcast channel that multiple consumers can subscribe to the via the same Stream, and messages sent to the channel are received by all consumers. The channel is not buffered, so if there are no consumers, the message is dropped.

An Operation in Effection describes an abstract computation. An operation does not do anything on its own. Rather, it only describes the steps it will take when it runs.

A programatic API to interact with an Effection scope from outside of an Operation.

The Effection equivalent of an AsyncIterable.

The Effection equivalent of an AsyncIterator

A handle to a concurrently running operation that lets you either use the result of that operation, or shut it down.