Skip to content

Commit

Permalink
Fix cross window communication
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Babik committed Nov 20, 2023
1 parent caa5acf commit eb8acf1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Trace {

private showReportWindow(records: ReportRecord[]) {
let reportWindow = window.open(REPORT_WINDOW_URL, "_blank")
reportWindow.addEventListener("load", () => {
reportWindow.addEventListener("ready", () => {
reportWindow.postMessage(records)
})
}
Expand Down
5 changes: 3 additions & 2 deletions src/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ function toggle(row: HTMLElement, expand = false) {
}

window.addEventListener("message", (event: MessageEvent<ReportRecord[]>) => {
console.log(event.data)
generate(event.data)
})
})

window.dispatchEvent(new CustomEvent("ready"))

0 comments on commit eb8acf1

Please sign in to comment.