Log out detection

This commit is contained in:
Adhiraj
2020-07-13 14:42:37 +05:30
parent 8eca142186
commit 8b859b9376
2 changed files with 9 additions and 5 deletions

View File

@@ -13,8 +13,8 @@ import {
import { generateMessageTag } from '../WAConnection/Utils'
export default class WhatsAppWebBase extends WAConnection {
/** Set the callback for when the connection is taken over somewhere else */
setOnTakenOver(callback: (kind: 'replaced' | string | null) => void) {
/** Set the callback for when the connection is taken over somewhere else or logged out */
setOnDisconnect(callback: (kind: 'replaced' | string | null) => void) {
this.registerCallback (['Cmd', 'type:disconnect'], json => {
this.log ('connection taken over elsewhere')
this.close ()