docs: Document ctx.app.emit (#1284)

This commit is contained in:
Douglas Wade 2018-12-06 23:28:23 -08:00 committed by Yiyu He
parent f90e825da9
commit a007198fa2

View file

@ -62,6 +62,10 @@ ctx.state.user = await User.find(id);
Application instance reference.
### ctx.app.emit
Koa applications extend an internal [EventEmitter](https://nodejs.org/dist/latest-v11.x/docs/api/events.html). `ctx.app.emit` emits an event with a type, defined by the first argument. For each event you can hook up "listeners", which is a function that is called when the event is emitted. Consult the [error handling docs](https://koajs.com/#error-handling) for more information.
### ctx.cookies.get(name, [options])
Get cookie `name` with `options`: