fix timeout typescript.

This commit is contained in:
Miroslav Šedivý 2021-07-17 11:30:46 +02:00
parent 45ef058bf4
commit 38bed98741
3 changed files with 11 additions and 6 deletions

View file

@ -45,7 +45,7 @@
@Ref('textarea') readonly _textarea!: HTMLTextAreaElement
private opened: boolean = false
private typing: any = null
private typing?: number
get clipboard() {
return this.$accessor.remote.clipboard
@ -56,15 +56,16 @@
if (this.typing) {
clearTimeout(this.typing)
this.typing = undefined
}
this.typing = setTimeout(() => this.$accessor.remote.sendClipboard(this.clipboard), 500)
this.typing = window.setTimeout(() => this.$accessor.remote.sendClipboard(this.clipboard), 500)
}
open() {
this.opened = true
document.body.addEventListener('click', this.close)
setTimeout(() => this._textarea.focus(), 0)
window.setTimeout(() => this._textarea.focus(), 0)
}
close() {