Skip to content

Consider adding lifecycle events #133

@nandi95

Description

@nandi95

Search terms
events
emit
lifecycle

Describe the solution you'd like
Lifecycle events can be added such as saving, saved, replicating, deleting etc to the package.

Describe how this would benefit the project/others
This would add an additional way to interact with the flow of the model logic.

Note: this will cause the event emitter to not to be tree shakeable as it's always included

Ideas:

  • The listeners could return a boolean and if false the original logic stops e.g.: deleting hook returns false, no request will be made and and any further logic in the delete() method bot executed
  • The hooks are free to change the passed in argument as it's passed by reference.

Describe alternatives you've considered
None

This feature depends on #23

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions