feathersjs / docs

[MOVED] Legacy Feathers documentation
https://crow.docs.feathersjs.com/
MIT License
242 stars 531 forks source link

Comment: Events (api/events.md) Where is the Blanket CRUD Event #1434

Closed frastlin closed 4 years ago

frastlin commented 4 years ago

Comment/Problem

I have a data table that should stay in-sync with the server, and the user can update, create, or remove items. Is there a universal event that runs for all CRUD events?

daffl commented 4 years ago

There is no general event for this. Since the events you'll get are known it's pretty easy to implement yourself:

['created', 'updated', 'patched', 'removed'].forEach(event => {
  service.on(event, data => service.emit('crudEvent', data));
})

app.mixins might be helpful here as well.