Skip to content
Brod edited this page Jul 20, 2018 · 1 revision

Overview

The change method in Jackle is similar to Dispatch in redux, it's used to attempt changes the state - you can access it directly from a Jackle instance with jackle.change(), or from the state with state.change().

Usage

To call the change() method use jackle.change() or state.change().

jackle.change('update:temp', { ... });
// or
state.change('update:temp', { ... });

If you call the change method and a handler throws an error, the error will bubble to the caller - so be ready to catch them.

try {
  await jackle.change('update:temp', { ... })
} catch(error) {
  console.log('Uhoh! Something went wrong')
}

Interface

The Change method signature is available at Jagwah.change.

export module Jackle {
  ...
  export type change = (name: string, input: Jackle.parser.input, event?: Event) => Promise<any>;
}

Clone this wiki locally