Skip to content

Instantly share code, notes, and snippets.

@arqex
Last active May 15, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arqex/10d231de5ec21a3434d58e3f07e833ab to your computer and use it in GitHub Desktop.
Save arqex/10d231de5ec21a3434d58e3f07e833ab to your computer and use it in GitHub Desktop.
User reactions with helper
// I call the helper `d` after the concept `domain`.
const d = () => freezer.get().user;
freezer.on('user:create', user => {
d().set(user.id, user);
});
freezer.on('user:update', (id, update) => {
d()[id].set(update);
});
freezer.on('user:delete', id => {
d().remove(id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment