events.ts 817 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Contract source: https://git.io/JfefG
  3. *
  4. * Feel free to let us know via PR, if you find something broken in this contract
  5. * file.
  6. */
  7. declare module '@ioc:Adonis/Core/Event' {
  8. /*
  9. |--------------------------------------------------------------------------
  10. | Define typed events
  11. |--------------------------------------------------------------------------
  12. |
  13. | You can define types for events inside the following interface and
  14. | AdonisJS will make sure that all listeners and emit calls adheres
  15. | to the defined types.
  16. |
  17. | For example:
  18. |
  19. | interface EventsList {
  20. | 'new:user': UserModel
  21. | }
  22. |
  23. | Now calling `Event.emit('new:user')` will statically ensure that passed value is
  24. | an instance of the the UserModel only.
  25. |
  26. */
  27. interface EventsList {
  28. //
  29. }
  30. }