@wppconnect/wa-js 1.2.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/blocklist/events/eventTypes.d.ts +18 -0
- package/dist/blocklist/index.d.ts +0 -1
- package/dist/chat/{eventEmitter.d.ts → events/eventTypes.d.ts} +36 -38
- package/dist/chat/events/index.d.ts +3 -1
- package/dist/{patch.d.ts → chat/events/registerNewMessageEvent.d.ts} +0 -0
- package/dist/chat/events/registerPresenceChange.d.ts +16 -0
- package/dist/chat/index.d.ts +0 -1
- package/dist/conn/events/eventTypes.d.ts +55 -0
- package/dist/conn/functions/index.d.ts +1 -0
- package/dist/conn/functions/setKeepAlive.d.ts +28 -0
- package/dist/conn/index.d.ts +0 -1
- package/dist/contact/functions/getProfilePictureUrl.d.ts +27 -0
- package/dist/contact/functions/index.d.ts +1 -0
- package/dist/contact/index.d.ts +0 -1
- package/dist/eventEmitter/eventEmitter.d.ts +169 -0
- package/dist/eventEmitter/eventTypes.d.ts +26 -0
- package/dist/eventEmitter/index.d.ts +195 -0
- package/dist/group/index.d.ts +0 -1
- package/dist/index.d.ts +3 -1
- package/dist/labels/index.d.ts +0 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/status/events/eventTypes.d.ts +18 -0
- package/dist/status/index.d.ts +0 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/types.d.ts +2 -0
- package/dist/util/wrapFunction.d.ts +20 -0
- package/dist/webpack/eventTypes.d.ts +19 -0
- package/dist/{webpack.d.ts → webpack/index.d.ts} +0 -0
- package/dist/whatsapp/collections/CallCollection.d.ts +3 -1
- package/dist/whatsapp/collections/ParticipantCollection.d.ts +3 -1
- package/dist/whatsapp/collections/PresenceCollection.d.ts +4 -4
- package/dist/whatsapp/collections/ProfilePicThumbCollection.d.ts +2 -4
- package/dist/whatsapp/collections/RecentStickerCollection.d.ts +3 -1
- package/dist/whatsapp/collections/StickerPackCollection.d.ts +3 -1
- package/dist/whatsapp/enums/ACK.d.ts +9 -3
- package/dist/whatsapp/enums/GROUP_SETTING_TYPE.d.ts +3 -1
- package/dist/whatsapp/enums/MSG_TYPE.d.ts +6 -2
- package/dist/whatsapp/exportModule.d.ts +19 -1
- package/dist/whatsapp/functions/createMsgProtobuf.d.ts +3 -1
- package/dist/whatsapp/functions/fetchLinkPreview.d.ts +3 -1
- package/dist/whatsapp/functions/findFirstWebLink.d.ts +3 -1
- package/dist/whatsapp/functions/getOrGenerate.d.ts +3 -1
- package/dist/whatsapp/functions/handleAck.d.ts +17 -3
- package/dist/whatsapp/functions/index.d.ts +3 -0
- package/dist/whatsapp/functions/isAuthenticated.d.ts +6 -3
- package/dist/whatsapp/functions/isMDBackend.d.ts +19 -0
- package/dist/whatsapp/functions/mediaTypeFromProtobuf.d.ts +19 -0
- package/dist/whatsapp/functions/profilePic.d.ts +2 -1
- package/dist/whatsapp/functions/randomId.d.ts +3 -1
- package/dist/whatsapp/functions/sendQueryExists.d.ts +3 -1
- package/dist/whatsapp/functions/status.d.ts +6 -2
- package/dist/whatsapp/functions/typeAttributeFromProtobuf.d.ts +19 -0
- package/dist/whatsapp/misc/Browser.d.ts +3 -1
- package/dist/whatsapp/misc/Clock.d.ts +6 -2
- package/dist/whatsapp/misc/Constants.d.ts +3 -1
- package/dist/whatsapp/misc/EventEmitter.d.ts +3 -1
- package/dist/whatsapp/misc/ImageUtils.d.ts +3 -1
- package/dist/whatsapp/misc/Locale.d.ts +3 -1
- package/dist/whatsapp/misc/MsgKey.d.ts +3 -1
- package/dist/whatsapp/misc/UserPrefs.d.ts +3 -1
- package/dist/whatsapp/misc/VCard.d.ts +3 -1
- package/dist/whatsapp/misc/Wap.d.ts +6 -2
- package/dist/whatsapp/misc/Wid.d.ts +3 -1
- package/dist/whatsapp/misc/WidFactory.d.ts +3 -1
- package/dist/whatsapp/models/CallModel.d.ts +6 -2
- package/dist/whatsapp/models/CallParticipantModel.d.ts +6 -2
- package/dist/whatsapp/models/PresenceModel.d.ts +49 -0
- package/dist/whatsapp/models/ProfilePicThumbModel.d.ts +3 -3
- package/dist/whatsapp/models/StickerModel.d.ts +6 -2
- package/dist/whatsapp/models/WebCallModel.d.ts +6 -2
- package/dist/whatsapp/models/index.d.ts +1 -0
- package/dist/whatsapp/multidevice/adv.d.ts +3 -1
- package/dist/whatsapp/multidevice/waNoiseInfo.d.ts +3 -1
- package/dist/whatsapp/stores.d.ts +3 -1
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +8 -0
- package/package.json +26 -23
- package/dist/blocklist/eventEmitter.d.ts +0 -49
- package/dist/conn/eventEmitter.d.ts +0 -86
- package/dist/contact/eventEmitter.d.ts +0 -48
- package/dist/group/eventEmitter.d.ts +0 -48
- package/dist/labels/eventEmitter.d.ts +0 -48
- package/dist/profile/eventEmitter.d.ts +0 -48
- package/dist/status/eventEmitter.d.ts +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export interface BlocklistEventTypes {
|
|
17
|
+
'blocklist.sync': undefined;
|
|
18
|
+
}
|
|
@@ -13,11 +13,20 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
import { MsgKey, MsgModel, Wid } from '../../whatsapp';
|
|
17
|
+
export interface ChatEventTypes {
|
|
18
|
+
/**
|
|
19
|
+
* Triggered when new message is received
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* WPP.on('chat.new_message', (msg) => {
|
|
24
|
+
* // Your code
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
'chat.new_message': MsgModel;
|
|
29
|
+
'chat.msg_revoke': {
|
|
21
30
|
/**
|
|
22
31
|
* Author of message, only for groups
|
|
23
32
|
*/
|
|
@@ -37,7 +46,7 @@ export interface EventTypes {
|
|
|
37
46
|
*/
|
|
38
47
|
type: 'revoke' | 'sender_revoke' | 'admin_revoke';
|
|
39
48
|
};
|
|
40
|
-
msg_ack_change: {
|
|
49
|
+
'chat.msg_ack_change': {
|
|
41
50
|
ack: number;
|
|
42
51
|
/**
|
|
43
52
|
* Who sended the ack, only for groups, broadcast and status
|
|
@@ -52,7 +61,7 @@ export interface EventTypes {
|
|
|
52
61
|
*/
|
|
53
62
|
ids: MsgKey[];
|
|
54
63
|
};
|
|
55
|
-
live_location_start: {
|
|
64
|
+
'chat.live_location_start': {
|
|
56
65
|
id: Wid;
|
|
57
66
|
msgId: MsgKey;
|
|
58
67
|
chat: Wid;
|
|
@@ -63,7 +72,7 @@ export interface EventTypes {
|
|
|
63
72
|
degrees?: number;
|
|
64
73
|
shareDuration: number;
|
|
65
74
|
};
|
|
66
|
-
live_location_update: {
|
|
75
|
+
'chat.live_location_update': {
|
|
67
76
|
id: Wid;
|
|
68
77
|
lastUpdated: number;
|
|
69
78
|
elapsed: number;
|
|
@@ -74,38 +83,27 @@ export interface EventTypes {
|
|
|
74
83
|
degrees?: number;
|
|
75
84
|
comment: string;
|
|
76
85
|
};
|
|
77
|
-
live_location_end: {
|
|
86
|
+
'chat.live_location_end': {
|
|
78
87
|
id: Wid;
|
|
79
88
|
chat: Wid;
|
|
80
89
|
seq: number;
|
|
81
90
|
};
|
|
91
|
+
/**
|
|
92
|
+
* On presence change
|
|
93
|
+
*/
|
|
94
|
+
'chat.presence_change': {
|
|
95
|
+
id: Wid;
|
|
96
|
+
isOnline: boolean;
|
|
97
|
+
isGroup: boolean;
|
|
98
|
+
isUser: boolean;
|
|
99
|
+
shortName: string;
|
|
100
|
+
state: string;
|
|
101
|
+
t: number;
|
|
102
|
+
isContact?: boolean;
|
|
103
|
+
participants?: {
|
|
104
|
+
id: string;
|
|
105
|
+
state: string;
|
|
106
|
+
shortName: string;
|
|
107
|
+
}[];
|
|
108
|
+
};
|
|
82
109
|
}
|
|
83
|
-
export declare const eventEmitter: Emittery<EventTypes, EventTypes, never>;
|
|
84
|
-
/**
|
|
85
|
-
* Subscribe to one event.
|
|
86
|
-
* @event
|
|
87
|
-
* @returns An unsubscribe method.
|
|
88
|
-
*/
|
|
89
|
-
export declare function on<Name extends keyof EventTypes>(eventName: Name, listener: (eventData: EventTypes[Name]) => void | Promise<void>): UnsubscribeFn;
|
|
90
|
-
/**
|
|
91
|
-
* Subscribe to one or more events only once. It will be unsubscribed after the first event.
|
|
92
|
-
* @event
|
|
93
|
-
*/
|
|
94
|
-
export declare function once<Name extends keyof EventTypes>(eventName: Name): Promise<EventTypes[Name]>;
|
|
95
|
-
/**
|
|
96
|
-
* @event
|
|
97
|
-
*/
|
|
98
|
-
export declare function off<Name extends keyof EventTypes>(eventName: Name, listener: (eventData: EventTypes[Name]) => void | Promise<void>): void;
|
|
99
|
-
/**
|
|
100
|
-
* Clear all event listeners on the instance.
|
|
101
|
-
*
|
|
102
|
-
* If `eventName` is given, only the listeners for that event are cleared.
|
|
103
|
-
*
|
|
104
|
-
* @event
|
|
105
|
-
*/
|
|
106
|
-
export declare function clearListeners<Name extends keyof EventTypes>(eventName?: Name | Name[]): void;
|
|
107
|
-
/**
|
|
108
|
-
* The number of listeners for the `eventName` or all events if not specified.
|
|
109
|
-
* @event
|
|
110
|
-
*/
|
|
111
|
-
export declare function listenerCount<Name extends keyof EventTypes>(eventName?: Name | Name[]): number;
|
|
@@ -14,5 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import './registerAckMessageEvent';
|
|
17
|
-
import './registerRevokeMessageEvent';
|
|
18
17
|
import './registerLiveLocationUpdateEvent';
|
|
18
|
+
import './registerNewMessageEvent';
|
|
19
|
+
import './registerPresenceChange';
|
|
20
|
+
import './registerRevokeMessageEvent';
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { AuthCode } from '../types';
|
|
17
|
+
export interface ConnEventTypes {
|
|
18
|
+
'conn.auth_code_change': AuthCode | null;
|
|
19
|
+
/**
|
|
20
|
+
* Triggered afted a success QR code scan
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```javascript
|
|
24
|
+
* WPP.on('conn.authenticated', () => {
|
|
25
|
+
* // Your code
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
'conn.authenticated': undefined;
|
|
30
|
+
'conn.logout': undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Triggered when the main interface is loaded, but is syncing
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```javascript
|
|
36
|
+
* WPP.on('conn.main_loaded', () => {
|
|
37
|
+
* // Your code
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
'conn.main_loaded': undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Triggered when the main interface is loaded, authenticated and ready to send message
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```javascript
|
|
47
|
+
* WPP.on('conn.main_ready', () => {
|
|
48
|
+
* // Your code
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
'conn.main_ready': undefined;
|
|
53
|
+
'conn.qrcode_idle': undefined;
|
|
54
|
+
'conn.require_auth': undefined;
|
|
55
|
+
}
|
|
@@ -20,4 +20,5 @@ export { isMainLoaded } from './isMainLoaded';
|
|
|
20
20
|
export { isMultiDevice } from './isMultiDevice';
|
|
21
21
|
export { logout } from './logout';
|
|
22
22
|
export { refreshQR } from './refreshQR';
|
|
23
|
+
export { setKeepAlive } from './setKeepAlive';
|
|
23
24
|
export { setMultiDevice } from './setMultiDevice';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Set keep alive state, that will force the focused and online state
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* // To enable
|
|
22
|
+
* await WPP.conn.setKeepAlive();
|
|
23
|
+
*
|
|
24
|
+
* // To disable
|
|
25
|
+
* await WPP.conn.setKeepAlive(false);
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function setKeepAlive(enable?: boolean): boolean;
|
package/dist/conn/index.d.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Wid } from '../../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Get the current text status
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```javascript
|
|
22
|
+
* const url = await WPP.contact.getProfilePicture('[number]@c.us');
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @category Chat
|
|
26
|
+
*/
|
|
27
|
+
export declare function getProfilePictureUrl(contactId: string | Wid, full?: boolean): Promise<string | null | undefined>;
|
|
@@ -13,5 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { getProfilePictureUrl } from './getProfilePictureUrl';
|
|
16
17
|
export { getStatus } from './getStatus';
|
|
17
18
|
export { queryExists } from './queryExists';
|
package/dist/contact/index.d.ts
CHANGED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CancelablePromise, ConstructorOptions, event, EventAndListener, EventEmitter2, eventNS, GeneralEventEmitter, Listener, ListenerFn, ListenToOptions, OnceOptions, WaitForFilter, WaitForOptions } from 'eventemitter2';
|
|
17
|
+
export interface OnOptions {
|
|
18
|
+
/**
|
|
19
|
+
* invoke the listener in async mode using setImmediate (fallback to setTimeout if not available) or process.nextTick depending on the nextTick option.
|
|
20
|
+
*/
|
|
21
|
+
async?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* additionally wraps the listener to a Promise for later invocation using emitAsync method. This option will be activated by default if its value is undefined and the listener function is an asynchronous function (whose constructor name is AsyncFunction).
|
|
24
|
+
*/
|
|
25
|
+
promisify?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* activates returning a listener object instead of 'this' by the subscription method.
|
|
28
|
+
*/
|
|
29
|
+
objectify?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare type ListenerType<T> = [T] extends [(...args: infer U) => any] ? U : [T] extends [void] ? [] : [T];
|
|
32
|
+
export declare class EventEmitter<EventData> {
|
|
33
|
+
constructor(options?: ConstructorOptions);
|
|
34
|
+
emit<Name extends keyof EventData>(event: Name, ...args: ListenerType<EventData[Name]>): boolean;
|
|
35
|
+
emitAsync<Name extends keyof EventData>(event: Name, ...args: ListenerType<EventData[Name]>): Promise<any[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Adds a listener to the end of the listeners array for the specified event.
|
|
38
|
+
*/
|
|
39
|
+
addListener<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void): this | Listener;
|
|
40
|
+
/**
|
|
41
|
+
* Adds a listener to the end of the listeners array for the specified event.
|
|
42
|
+
*/
|
|
43
|
+
on<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options: OnOptions & {
|
|
44
|
+
objectify: true;
|
|
45
|
+
}): Listener;
|
|
46
|
+
/**
|
|
47
|
+
* Adds a listener to the end of the listeners array for the specified event.
|
|
48
|
+
*/
|
|
49
|
+
on<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options?: boolean | OnOptions): this;
|
|
50
|
+
/**
|
|
51
|
+
* Adds a listener to the beginning of the listeners array for the specified event.
|
|
52
|
+
*/
|
|
53
|
+
prependListener<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options: OnOptions & {
|
|
54
|
+
objectify: true;
|
|
55
|
+
}): Listener;
|
|
56
|
+
/**
|
|
57
|
+
* Adds a listener to the beginning of the listeners array for the specified event.
|
|
58
|
+
*/
|
|
59
|
+
prependListener<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options?: boolean | OnOptions): this;
|
|
60
|
+
/**
|
|
61
|
+
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
|
|
62
|
+
*/
|
|
63
|
+
once<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options: OnOptions & {
|
|
64
|
+
objectify: true;
|
|
65
|
+
}): Listener;
|
|
66
|
+
/**
|
|
67
|
+
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
|
|
68
|
+
*/
|
|
69
|
+
once<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options?: true | OnOptions): this;
|
|
70
|
+
/**
|
|
71
|
+
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array
|
|
72
|
+
*/
|
|
73
|
+
prependOnceListener<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options: OnOptions & {
|
|
74
|
+
objectify: true;
|
|
75
|
+
}): Listener;
|
|
76
|
+
/**
|
|
77
|
+
* Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array
|
|
78
|
+
*/
|
|
79
|
+
prependOnceListener<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void, options?: boolean | OnOptions): this;
|
|
80
|
+
/**
|
|
81
|
+
* Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed.
|
|
82
|
+
*/
|
|
83
|
+
many<Name extends keyof EventData>(event: Name, timesToListen: number, listener: (...args: ListenerType<EventData[Name]>) => void, options: OnOptions & {
|
|
84
|
+
objectify: true;
|
|
85
|
+
}): Listener;
|
|
86
|
+
/**
|
|
87
|
+
* Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed.
|
|
88
|
+
*/
|
|
89
|
+
many<Name extends keyof EventData>(event: Name, timesToListen: number, listener: (...args: ListenerType<EventData[Name]>) => void, options?: boolean | OnOptions): this;
|
|
90
|
+
/**
|
|
91
|
+
* Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.
|
|
92
|
+
*/
|
|
93
|
+
prependMany<Name extends keyof EventData>(event: Name, timesToListen: number, listener: (...args: ListenerType<EventData[Name]>) => void, options: OnOptions & {
|
|
94
|
+
objectify: true;
|
|
95
|
+
}): Listener;
|
|
96
|
+
/**
|
|
97
|
+
* Adds a listener that will execute n times for the event before being removed. The listener is invoked only the first n times the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.
|
|
98
|
+
*/
|
|
99
|
+
prependMany<Name extends keyof EventData>(event: Name, timesToListen: number, listener: (...args: ListenerType<EventData[Name]>) => void, options?: boolean | OnOptions): this;
|
|
100
|
+
/**
|
|
101
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback.
|
|
102
|
+
*/
|
|
103
|
+
onAny(listener: EventAndListener): this;
|
|
104
|
+
/**
|
|
105
|
+
* Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the callback. The listener is added to the beginning of the listeners array
|
|
106
|
+
*/
|
|
107
|
+
prependAny(listener: EventAndListener): this;
|
|
108
|
+
/**
|
|
109
|
+
* Removes the listener that will be fired when any event is emitted.'
|
|
110
|
+
*/
|
|
111
|
+
offAny(listener: ListenerFn): this;
|
|
112
|
+
/**
|
|
113
|
+
* Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.
|
|
114
|
+
*/
|
|
115
|
+
removeListener<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void): this;
|
|
116
|
+
/**
|
|
117
|
+
* Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.
|
|
118
|
+
*/
|
|
119
|
+
off<Name extends keyof EventData>(event: Name, listener: (...args: ListenerType<EventData[Name]>) => void): this;
|
|
120
|
+
/**
|
|
121
|
+
* Removes all listeners, or those of the specified event.
|
|
122
|
+
*/
|
|
123
|
+
removeAllListeners<Name extends keyof EventData>(event?: Name): this;
|
|
124
|
+
/**
|
|
125
|
+
* By default EventEmitters will print a warning if more than 10 listeners are added to it. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.
|
|
126
|
+
*/
|
|
127
|
+
setMaxListeners(n: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* Returns the current max listener value for the EventEmitter which is either set by emitter.setMaxListeners(n) or defaults to EventEmitter2.defaultMaxListeners
|
|
130
|
+
*/
|
|
131
|
+
getMaxListeners(): number;
|
|
132
|
+
/**
|
|
133
|
+
* Returns an array listing the events for which the emitter has registered listeners.
|
|
134
|
+
*
|
|
135
|
+
* Note: Listeners order not guaranteed
|
|
136
|
+
*/
|
|
137
|
+
eventNames<Name extends keyof EventData>(nsAsArray?: boolean): Name[];
|
|
138
|
+
listenerCount<Name extends keyof EventData>(event?: Name): number;
|
|
139
|
+
/**
|
|
140
|
+
* Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners.
|
|
141
|
+
*/
|
|
142
|
+
listeners<Name extends keyof EventData>(event?: Name): ListenerFn[];
|
|
143
|
+
/**
|
|
144
|
+
* Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners.
|
|
145
|
+
*/
|
|
146
|
+
listenersAny(): ListenerFn[];
|
|
147
|
+
/**
|
|
148
|
+
* Returns a thenable object (promise interface) that resolves when a specific event occurs
|
|
149
|
+
*/
|
|
150
|
+
waitFor<Name extends keyof EventData>(event: Name, timeout?: number): CancelablePromise<ListenerType<EventData[Name]>>;
|
|
151
|
+
/**
|
|
152
|
+
* Returns a thenable object (promise interface) that resolves when a specific event occurs
|
|
153
|
+
*/
|
|
154
|
+
waitFor<Name extends keyof EventData>(event: Name, filter?: WaitForFilter): CancelablePromise<ListenerType<EventData[Name]>>;
|
|
155
|
+
/**
|
|
156
|
+
* Returns a thenable object (promise interface) that resolves when a specific event occurs
|
|
157
|
+
*/
|
|
158
|
+
waitFor<Name extends keyof EventData>(event: Name, options?: WaitForOptions): CancelablePromise<ListenerType<EventData[Name]>>;
|
|
159
|
+
listenTo(target: GeneralEventEmitter, events: event | eventNS, options?: ListenToOptions): this;
|
|
160
|
+
listenTo(target: GeneralEventEmitter, events: event[], options?: ListenToOptions): this;
|
|
161
|
+
listenTo(target: GeneralEventEmitter, events: object, options?: ListenToOptions): this;
|
|
162
|
+
stopListeningTo(target?: GeneralEventEmitter, event?: event | eventNS): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* Checks whether emitter has any listeners.
|
|
165
|
+
*/
|
|
166
|
+
hasListeners<Name extends keyof EventData>(event?: Name): boolean;
|
|
167
|
+
static once(emitter: EventEmitter2, event: string, options?: OnceOptions): CancelablePromise<any[]>;
|
|
168
|
+
static defaultMaxListeners: number;
|
|
169
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { BlocklistEventTypes } from '../blocklist/events/eventTypes';
|
|
17
|
+
import { ChatEventTypes } from '../chat/events/eventTypes';
|
|
18
|
+
import { ConnEventTypes } from '../conn/events/eventTypes';
|
|
19
|
+
import { StatusEventTypes } from '../status/events/eventTypes';
|
|
20
|
+
import { WebpackEvents } from '../webpack/eventTypes';
|
|
21
|
+
export { BlocklistEventTypes } from '../blocklist/events/eventTypes';
|
|
22
|
+
export { ChatEventTypes } from '../chat/events/eventTypes';
|
|
23
|
+
export { ConnEventTypes } from '../conn/events/eventTypes';
|
|
24
|
+
export { StatusEventTypes } from '../status/events/eventTypes';
|
|
25
|
+
export { WebpackEvents } from '../webpack/eventTypes';
|
|
26
|
+
export declare type EventTypes = BlocklistEventTypes & ChatEventTypes & ConnEventTypes & StatusEventTypes & WebpackEvents;
|