Last active
December 5, 2022 21:20
-
-
Save kagklis/58551ff9d231d325c99406011acbf439 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
// ... | |
}) | |
export class ChartComponent implements AfterViewInit { | |
private get size() { | |
return { | |
width: (3 * window.innerWidth) / 4, | |
height: (3 * window.innerHeight) / 4, | |
}; | |
} | |
// ... | |
private renderWithWorker(data: ChartData) { | |
if (!this.currentWorker) { | |
// ... | |
this.registerResizeEvents(); | |
} else { | |
// ... | |
} | |
} | |
private registerResizeEvents(): void { | |
window.addEventListener('resize', () => { | |
this.currentWorker.postMessage({ | |
type: 'resize', | |
...this.size | |
}); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment