added forceResolve for Toaster

pull/1/head
LianaHus 5 years ago
parent c388b78eec
commit 0d369491fe
  1. 7
      src/app/ui/tooltip.js

@ -23,6 +23,12 @@ class Toaster {
}, 2000)
animation(this.tooltip, css.animateTop.className)
}
forceResolve () {
if (this.id) clearTimeout(this.id)
if (this.resolveFn) this.resolveFn()
}
render (tooltipText, actionElement, opts) {
opts = defaultOptions(opts)
let canShorten = true
@ -43,6 +49,7 @@ class Toaster {
return new Promise((resolve, reject) => {
const shortTooltipText = (canShorten && tooltipText.length > 201) ? tooltipText.substring(0, 200) + '...' : tooltipText
this.resolveFn = resolve
let button = tooltipText.length > 201 ? yo`
<button class="btn btn-secondary btn-sm mx-3" style="white-space: nowrap;" onclick=${() => { modal.alert(tooltipText) }}>Show full message</button>

Loading…
Cancel
Save