Browse documentation

createPulse

Creates one reactive value and returns `read()`, `write(...)` and `runSubscribers()`.

Table of contents

Category

Value

Import

js
import { createPulse } from "valyrian.js/pulses";

Public signature

ts
<T>(initialValue: T): [read: () => T, write: (newValue: T | ((current: T) => T)) => void, runSubscribers: () => void]

Parameters

ts
initialValue: T

Result

ts
[read: () => T, write: (newValue: T | ((current: T) => T)) => void, runSubscribers: () => void]

Observable effects

`write(...)` notifies after a value change. `runSubscribers()` runs current subscribers without changing the value.