You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every backend should emit events in the following circumstances:
before_create - Before an item is created so that the event handler can edit it or prevent it (by throwing an exception)
after_create - After an item is created, given the success/fail of the create and the ID of the item (if successful)
before_set - Before an item is updated so that the event handler can edit it or prevent it (by throwing an exception)
after_set - After an item is updated, given the success/fail of the set and the ID of the item
before_delete - Before an item is deleted so the event handler can prevent it (by throwing an exception)
after_delete - After an item is deleted, given the success/fail of the delete and the ID of the item
Backends should inherit from Mojo::EventEmitter. Events can be added to the backend by using the standard Mojo::EventEmitter methods. These events should be documented in Yancy::Backend.
The documentation should explain that the events will only be handled by the worker that handles the request. So these events cannot be used, by themselves, to broadcast updates to other clients unless all the clients are connected to the same worker, or some kind of messaging system is used (like Mercury).
The text was updated successfully, but these errors were encountered:
Instead of requiring all backends to support this which may only be used in limited circumstances, we should make this a role that users can apply to their backend object before configuring the Yancy plugin. This opens up new avenues of functionality, so I should also blog about it.
This feature is a good idea, but would be better implemented in Yancy::Model, which can be connected to any backend. But also, using Yancy::Model is itself a way to get these hooks to do whatever you want.
Every backend should emit events in the following circumstances:
Backends should inherit from Mojo::EventEmitter. Events can be added to the backend by using the standard Mojo::EventEmitter methods. These events should be documented in Yancy::Backend.
The documentation should explain that the events will only be handled by the worker that handles the request. So these events cannot be used, by themselves, to broadcast updates to other clients unless all the clients are connected to the same worker, or some kind of messaging system is used (like Mercury).
The text was updated successfully, but these errors were encountered: