Skip to content

Commit

Permalink
fix ci build #3247
Browse files Browse the repository at this point in the history
  • Loading branch information
smashah committed Oct 17, 2024
1 parent 2f84424 commit 6da20eb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/api/Client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { default as mime } from 'mime-types';
import { Page, EvaluateFunc, PageEventObject } from 'puppeteer';
import { Page, EvaluateFunc, PageEvent } from 'puppeteer';
import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatCreationResponse, EphemeralDuration } from './model/chat';
import { BusinessProfile, Contact, NumberCheck } from './model/contact';
import { Message, MessageInfo, PollData } from './model/message';
Expand Down Expand Up @@ -317,11 +317,11 @@ export class Client {
private _hostAccountNumber;
private _prio: number = Number.MAX_SAFE_INTEGER;
private _pageListeners : {
event: keyof PageEventObject,
event: keyof PageEvent,
callback: any,
priority ?: number
}[] = [];
private _registeredPageListeners : (keyof PageEventObject)[] = [];
private _registeredPageListeners : (keyof PageEvent)[] = [];
private _onLogoutCallbacks : any[] = [];
private _queues: {
[key in SimpleListener] ?: PQueue
Expand Down Expand Up @@ -722,15 +722,15 @@ export class Client {
// NON-STANDARD LISTENERS

private registerPageEventListener(_event: string, callback : any, priority ?: number) {
const event : keyof PageEventObject = _event as keyof PageEventObject
const event : keyof PageEvent = _event as keyof PageEvent
this._pageListeners.push({
event,
callback,
priority
})
if(this._registeredPageListeners.includes(event)) return true;
this._registeredPageListeners.push(event);
log.info(`setting page listener: ${event}`, this._registeredPageListeners)
log.info(`setting page listener: ${String(event)}`, this._registeredPageListeners)
this._page.on(event, async (...args) => {
await Promise.all(this._pageListeners.filter(l => l.event === event).filter(({priority})=>priority!==-1).sort((a,b)=>(b.priority || 0)-(a.priority || 0)).map(l => l.callback(...args)))
await Promise.all(this._pageListeners.filter(l => l.event === event).filter(({priority})=>priority==-1).sort((a,b)=>(b.priority || 0)-(a.priority || 0)).map(l => l.callback(...args)))
Expand Down Expand Up @@ -766,7 +766,7 @@ export class Client {
intervalCap: 1,
carryoverConcurrencyCount: true
})
if(this._registeredPageListeners.includes(event)) return true;
if(this._registeredPageListeners.includes(event as keyof PageEvent)) return true;
this.registerPageEventListener(event, async frame => {
if(frame.url().includes('post_logout=1')) {
console.log("LOGGED OUT")
Expand Down Expand Up @@ -2566,6 +2566,7 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom
}

/**
* @deprecated No longer works due to multi-device changes
* Retrieves Battery Level
* @returns Number
*/
Expand Down

0 comments on commit 6da20eb

Please sign in to comment.