Skip to content

Commit 1d66f45

Browse files
authored
fix: support for off() & addListener() EventEmitter aliases (#241)
1 parent b7a0d4b commit 1d66f45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/module-declaration.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ export const generateModuleDeclaration = (
185185
listener = `(${args.join(`,\n${indent}`)}) => void`;
186186
}
187187

188-
for (let method of ['on', 'once', 'addListener', 'removeListener']) {
188+
for (let method of ['on', 'off', 'once', 'addListener', 'removeListener']) {
189189
moduleAPI.push(`${method}(event: '${moduleEvent.name}', listener: ${listener}): this;`);
190190
}
191191
});
@@ -251,7 +251,9 @@ export const generateModuleDeclaration = (
251251
}
252252

253253
const returnsThis = (moduleMethod: Pick<DocumentationBlock, 'name'>) =>
254-
['on', 'once', 'removeAllListeners', 'removeListener'].includes(moduleMethod.name);
254+
['on', 'off', 'once', 'addListener', 'removeAllListeners', 'removeListener'].includes(
255+
moduleMethod.name,
256+
);
255257

256258
const addMethod = (moduleMethod: MethodDocumentationBlock, prefix = '') => {
257259
utils.extendArray(

0 commit comments

Comments
 (0)