Skip to content

Commit

Permalink
fix: support for off() & addListener() EventEmitter aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
miniak committed Sep 2, 2023
1 parent dd2d3f7 commit 5bdff02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/module-declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const generateModuleDeclaration = (
listener = `(${args.join(`,\n${indent}`)}) => void`;
}

for (let method of ['on', 'once', 'addListener', 'removeListener']) {
for (let method of ['on', 'off', 'once', 'addListener', 'removeListener']) {
moduleAPI.push(`${method}(event: '${moduleEvent.name}', listener: ${listener}): this;`);
}
});
Expand Down Expand Up @@ -251,7 +251,7 @@ export const generateModuleDeclaration = (
}

const returnsThis = (moduleMethod: Pick<DocumentationBlock, 'name'>) =>
['on', 'once', 'removeAllListeners', 'removeListener'].includes(moduleMethod.name);
['on', 'off', 'once', 'addListener', 'removeAllListeners', 'removeListener'].includes(moduleMethod.name);

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

0 comments on commit 5bdff02

Please sign in to comment.