window.postmessage angular 6 code example
Example 1: how to receive window.postmessage event in angular 9
window.addEventListener("message", () => {
this.receiveMessage();
}, false)
Example 2: how to receive window.postmessage event in angular 9
constructor(private _authService: AuthService, private _router: Router) {
if (window.addEventListener) {
window.addEventListener("message", this.receiveMessage.bind(this), false);
} else {
(<any>window).attachEvent("onmessage", this.receiveMessage.bind(this));
}
}