Skip to content

Commit

Permalink
feat: Switched emittery to eventemitter2
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Changed all interface events to WPP.ev and WPP.on
  • Loading branch information
edgardmessias committed Apr 16, 2022
1 parent 977fe67 commit 0844cd2
Show file tree
Hide file tree
Showing 42 changed files with 668 additions and 952 deletions.
32 changes: 13 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
"buffer": "^6.0.3",
"conventional-changelog-cli": "^2.2.2",
"debug": "^4.3.4",
"emittery": "^0.10.2",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eventemitter2": "^6.4.5",
"file-type": "~16.5.3",
"husky": "^7.0.4",
"parse-data-url": "^4.0.1",
Expand Down
83 changes: 0 additions & 83 deletions src/blocklist/eventEmitter.ts

This file was deleted.

19 changes: 19 additions & 0 deletions src/blocklist/events/eventTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export interface BlocklistEventTypes {
'blocklist.sync': undefined;
}
11 changes: 2 additions & 9 deletions src/blocklist/events/registerSyncedEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,14 @@
* limitations under the License.
*/

import Debug from 'debug';

import { internalEv } from '../../eventEmitter';
import * as webpack from '../../webpack';
import { BlocklistStore } from '../../whatsapp';
import { eventEmitter } from '../eventEmitter';

const debug = Debug('WA-JS:blocklist');

webpack.onInjected(() => registerSyncedEvent());

function registerSyncedEvent() {
BlocklistStore.on('sort', () => {
debug('synced');
eventEmitter.emit('sync');
internalEv.emit('blocklist.sync');
});

debug('synced event registered');
}
9 changes: 0 additions & 9 deletions src/blocklist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,4 @@

import './events';

export {
clearListeners,
EventTypes,
listenerCount,
off,
on,
once,
UnsubscribeFn,
} from './eventEmitter';
export * from './functions';
146 changes: 0 additions & 146 deletions src/chat/eventEmitter.ts

This file was deleted.

Loading

0 comments on commit 0844cd2

Please sign in to comment.