Skip to content

Commit a007198

Browse files
doug-wadedead-horse
authored andcommitted
docs: Document ctx.app.emit (#1284)
1 parent f90e825 commit a007198

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/api/context.md

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ ctx.state.user = await User.find(id);
6262

6363
Application instance reference.
6464

65+
### ctx.app.emit
66+
67+
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.
68+
6569
### ctx.cookies.get(name, [options])
6670

6771
Get cookie `name` with `options`:

0 commit comments

Comments
 (0)