Skip to content

Commit

Permalink
refactor(noel): removeAllListenersForEvent to removeAllListeners
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenautjoe committed Oct 26, 2017
1 parent 5d8b7de commit 2510f0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface Noel {

removeListener(eventName: string, listener: NoelEventListener): void;

removeAllListenersForEvent(eventName: string): void;
removeAllListeners(eventName: string): void;

getEvent(eventName: string): NoelEvent;

Expand Down
2 changes: 1 addition & 1 deletion src/noel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class NoelImp implements Noel {
}
}

removeAllListenersForEvent(eventName: string) {
removeAllListeners(eventName: string) {
const eventsMap = this.eventsMap;
if (eventsMap) {
const event = eventsMap.get(eventName);
Expand Down
6 changes: 3 additions & 3 deletions test/noel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ describe('Noel', () => {
});
});

describe('removeAllListenersForEvent(eventName: string)', () => {
describe('removeAllListeners(eventName: string)', () => {
describe('when event has listeners', () => {
it('should clear its listeners', () => {
const noel = new Noel();
const eventName = generateRandomString();
fillNoelWithRandomEventListeners(noel, eventName);

noel.removeAllListenersForEvent(eventName);
noel.removeAllListeners(eventName);

const event = noel['eventsMap'].get(eventName);
expect(event['listeners']).toBeNull();
Expand All @@ -161,7 +161,7 @@ describe('Noel', () => {
const noel = new Noel();
const eventName = generateRandomString();

noel.removeAllListenersForEvent(eventName);
noel.removeAllListeners(eventName);

expect(noel['eventsMap']).toBeNull();
});
Expand Down

0 comments on commit 2510f0e

Please sign in to comment.