UNPKG

@slavmak2486/bx24ts

Version:

Library for bitrix24

49 lines (42 loc) 1.34 kB
import { baseBX24 } from "./base/BX24"; import { type Logger } from "./types/authBaseServe"; import { type getAuth } from "./types/getAuth"; export class Bx24Hook extends baseBX24{ declare url:string; override logger:Logger|null=null; constructor(url:string){ super(); this.AUTH_EXPIRES=new Date().getTime()+365*24*60*60*1000; this.url=url; } refreshAuth(cb?: ((params: any) => void) | undefined): void { if (this.logger){ this.logger?.log('Dont use refresh auth for Bx24Hook'); } if (cb) cb(this.getAuth()); } refreshAuthAsync(): Promise<getAuth> { return new Promise(reject=>{ if (this.logger){ this.logger?.log('Dont use refresh auth for Bx24Hook'); } reject({ access_token:'', domain:this.url, expires_in:0, member_id:'', refresh_token:'' }); }); } runCallback(e: MessageEvent<any>): void { if (this.logger){ this.logger?.log('Dont use runCallback for Bx24Hook', e); } } sendMessage(cmd: string, params: any, cb?: ((params: any) => void) | undefined): void { if (this.logger){ this.logger?.log('Dont use sendMessage for Bx24Hook', [cmd, params, cb]); } } }