Skip to content

Commit

Permalink
feat: 🎸 check ready after login
Browse files Browse the repository at this point in the history
  • Loading branch information
hcfw007 committed Dec 19, 2023
1 parent 92f0e69 commit 65439aa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/wechaty-mixins/puppet-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@ const puppetMixin = <MixinBase extends WechatifyUserModuleMixin & GErrorMixin &
throw new Error('no contact found for id: ' + payload.contactId)
}
this.emit('login', contact)
const readyTimeout = setTimeout(() => {
if (this.puppet.readyIndicator.value()) {
this.emit('ready')
}
})
puppet.once('ready', () => {
// if we got ready from puppet, we don't have to fire it here.
// it will be fired by ready listener
clearTimeout(readyTimeout)
})
} catch (e) {
this.emit('error', GError.from(e))
}
Expand Down

0 comments on commit 65439aa

Please sign in to comment.