Using stately

Evy Stately is a library for managing product insurance offers.

It has methods to modify the content of the state. Modifying the state directly will not trigger the expected behaviour. When the action is complete, stately triggers an event to notify about the update of the inner store.

Instantiate Stately

import { EvyStately } from '@getevy/stately';

const stately = new EvyStately({ 
  apiKey: 'API_KEY', 
  apiUrl: 'API_URL', 
});

Subscribing to the store updates

stately.on('STORE_UPDATED', (store) => {
  console.log('store updated', store);
})

Each time there is a modification of the store, Stately triggers a new event. See the Methods reference for more information which methods actually triggers this event. If the method call does not update the store, Stately will not emit a new event.