From ea8cb4ddd1e10134c074ad4225583da7cb9b1513 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Tue, 28 Jun 2022 10:38:09 -0500 Subject: [PATCH] docs(sern.ts): add comments for addExternal --- src/handler/sern.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/handler/sern.ts b/src/handler/sern.ts index 5bbcc36..5653090 100644 --- a/src/handler/sern.ts +++ b/src/handler/sern.ts @@ -36,9 +36,23 @@ export function init(wrapper: Wrapper) { /** * * @param emitter Any external event emitter. - * The object will be stored in a map, and then fetched by the name of the emitter provided. + * The object will be stored in a map, and then fetched by the name of the instance's class provided. * As there are infinite possibilities to adding external event emitters, * Most types aren't provided and are as narrow as possibly can. + * @example + * ``` + * Sern.addExternal(new Level()) + * ``` + * ``` + * // events/level.ts + * export default eventModule({ + * emitter: 'Level', + * name: 'error', + * execute(args) { + * console.log(args) + * } + * }) + * */ export function addExternal(emitter: T) { if (ExternalEventEmitters.has(emitter.constructor.name)) {