FlushGate
The Flush gate: where a binding writes each element's animated values, drawn onto the elements once a
frame. A binding registers each element with its target, writes values as its animations step, and the
gate draws them together, at the end of the frame's animation tick, through the Environment's renderer;
a write made outside a tick, as a drag's move is, asks for a frame of its own. A server render gets
inert, which does nothing.
import * as FlushGate from "@wardic/dom/FlushGate"
const gate = yield* FlushGate.FlushGate
const unregister = gate.register("card", { target: card })
gate.write("card", { opacity: 0.5 }) // drawn at the next frameIts exports also name types the module doesn't export: its internal types.
Classes
FlushGate
The Environment's Flush gate.
Extends
Type Aliases
Options
type Options = FlushGateOptions;What a binding hands its gate: the batch a frame's Starting-style switches run in.
Services
type Services = FlushGateServices;The services a gate needs from its Environment.
Shape
type Shape = Omit<FlushGate, "dispose">;The gate: what a binding registers its elements with and writes their values into.
Sink
type Sink = FlushSink;An element's commit target and hooks, given to register.
Variables
inert
const inert: Shape;The gate a server render gets: it flushes nothing, so register returns an unregister that does
nothing, and the rest do nothing, afterFlush included, since no flush comes. Code that takes the gate
at setup and uses it after mount keeps working on a server.
layerInert
const layerInert: Layer.Layer<FlushGate>;inert as a Layer, for a binding whose server render runs an Effect program.
make
const make: (options) => Effect.Effect<Shape, never, Services | Scope.Scope>;Build a gate over the context's Renderer, Frame loop and Refresh frame source, in the current Scope: what it forks runs in that Scope, and closing it ends the gate.
Parameters
options
Returns
Effect.Effect<Shape, never, Services | Scope.Scope>
Functions
layer()
function layer(options): Layer<FlushGate, never, any>;The gate as a Layer: built by make, ended by the Layer's Scope.
Parameters
options
Returns
Layer<FlushGate, never, any>