UNPKG

piral-core

Version:

The core library for creating a Piral instance.

12 lines 355 B
import { isSame } from '../utils'; export function dispatch(ctx, update) { const oldState = ctx.state.getState(); const newState = update(oldState); if (!isSame(oldState, newState)) { ctx.state.setState(newState); } } export function readState(ctx, read) { return read(ctx.state.getState()); } //# sourceMappingURL=state.js.map