Last active
May 15, 2017 15:20
-
-
Save arqex/10d231de5ec21a3434d58e3f07e833ab to your computer and use it in GitHub Desktop.
User reactions with helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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