Skip to content

Commit

Permalink
fix: add method removeListener as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
1fabiopereira committed Jun 3, 2023
1 parent ec4791f commit 1b1877f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pitch-detector",
"version": "0.1.3",
"version": "0.1.4",
"description": "High performance real time pitch detection.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe('PitchDetector', () => {
it.each([
['addListener', 'addListener'],
['removeAllListeners', 'removeAllListeners'],
['removeSubscription', 'removeListener'],
['removeAllListeners', 'removeListener'],
])(
'should call %s method from event emitter when %s method will be called',
async (target: string, method: string) => {
Expand Down
3 changes: 2 additions & 1 deletion src/internal/pitch-detector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ export class InternalPitchDetector {

/**
* Method event listeners
* @deprecated since version 0.1.4, instead use `removeAllListeners`
*/
removeListener(subscription: Subscription): void {
if (subscription) {
this.event?.removeSubscription(subscription);
this.event?.removeAllListeners('data');
}
}

Expand Down

0 comments on commit 1b1877f

Please sign in to comment.