Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rfcs/0005-standard-signals.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Conceptually, we want to run the reactive update lifecycle in an effect so that
We can do this with an override of `performUpdate()` that wraps ReactiveElement's implementation in a watched computed signal:

```ts
abstract class SignalWatcher extends Base {
class SignalWatcher extends Base {
// Watcher.watch() doesn't dedupe :(
private __watching = false;
private __watcher = new Signal.subtle.Watcher(() => {
Expand Down Expand Up @@ -101,6 +101,10 @@ abstract class SignalWatcher extends Base {
}
```

### effect(callback, options)

An `effect` re-runs the provided callback any time signals accessed inside the callback are set. Effects run a microtask after any signals change. `effect` returns a dispose funcction which can be called to stop the effect from running. By providing `options`, an effect can be associated with an `element` and coordinated with its update cycle.

### watch() directive

The `watch()` async directive accepts a signal and renders its value _asynchronously_ to the containing binding. When the signal changes, the binding value is updated directly.
Expand Down