Skip to content

Commit

Permalink
fix: resolve initialization promise after terminal is visible
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Aug 5, 2020
1 parent 050931e commit 2589573
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,13 @@ class XTerminalElementImpl extends HTMLElement {
const lastEntry = entries.pop()
if (lastEntry.intersectionRatio === 1.0) {
this.terminalDivInitiallyVisible = true
await this.createTerminal()
this.applyPendingTerminalProfileOptions()
try {
await this.createTerminal()
this.applyPendingTerminalProfileOptions()
resolveInit()
} catch (ex) {
rejectInit(ex)
}
// Remove observer once visible
this.terminalDivIntersectionObserver.disconnect()
this.terminalDivIntersectionObserver = null
Expand Down Expand Up @@ -141,7 +146,6 @@ class XTerminalElementImpl extends HTMLElement {
},
{ capture: true },
)
resolveInit()
} catch (ex) {
rejectInit(ex)
throw ex
Expand Down

0 comments on commit 2589573

Please sign in to comment.