Skip to main content
zerotal

Documentation


Documentation / @zerotal/flow / index / expose

Function: expose()

expose(_value, context): void

Defined in: flow/src/decorators.ts:416

The opt-in network boundary: makes a member reachable from the client and crosses the wire.

Parameters

_value

unknown

context

ExposeContext

Returns

void

Remarks

On a field, the property is included in the snapshot and is mutable by the client (e.g. via flow:model), so it round-trips both directions. On a method, the method becomes callable from the browser over the WebSocket as an action. Nothing not marked (directly or via a decorator that implies it, such as @locked, @task, @on, @reactive, @modelable, @presence, @shared) is exposed. Rejected on a getter/accessor — use @computed for a derived value, or an @expose field for client-writable state.

Example

class Counter extends Component {
  @expose count = 0;

  @expose increment() {
    this.count++;
  }
}