Skip to content

Instantly share code, notes, and snippets.

@spac3unit
Forked from sergeysova/effector-debug.js
Created January 20, 2020 20:04
Show Gist options
  • Select an option

  • Save spac3unit/c2cc231ea36cb5d67b15e41e32538e74 to your computer and use it in GitHub Desktop.

Select an option

Save spac3unit/c2cc231ea36cb5d67b15e41e32538e74 to your computer and use it in GitHub Desktop.
const d = createDomain();
d.onCreateStore((s) => {
s.updates.watch((value) => {
console.log(`STORE ${s.shortName} UPDATED`, value);
});
});
d.onCreateEvent((e) => {
e.watch((params) => {
console.log(`EVENT ${e.shortName} TRIGGERED`, params);
});
});
d.onCreateEffect((e) => {
e.watch((params) => {
console.log(`EFFECT ${e.shortName} TRIGGERED`, params);
});
e.done.watch((params) => {
console.log(`EFFECT ${e.shortName} DONE`, params);
});
e.fail.watch((params) => {
console.log(`EFFECT ${e.shortName} FAIL`, params);
});
});
const { createStore, createEvent, createEffect } = d;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment