我需要在Angular 9应用中拦截慢速网络事件。
有什么办法吗?
我已经检测到离线和在线事件,但是我需要缓慢的网络事件检测
这是我用于在线和离线事件检测的代码
this.onlineEvent = fromEvent(window, 'online');
this.offlineEvent = fromEvent(window, 'offline');
this.slowLineEvent = fromEvent(window, 'slowline');
this.subscriptions.push(this.onlineEvent.subscribe(e => {
this.connectionStatusMessage = 'Back to online';
this.connectionStatus = 'online';
this.error = { type: 'ok', color: 'rgb(80, 218, 0)', message: 'CONNECTION.OK' };
}));
this.subscriptions.push(this.offlineEvent.subscribe(e => {
this.connectionStatusMessage = 'Connection lost! You are not connected to internet';
this.connectionStatus = 'offline';
this.error = { type: 'offline', color: 'red', message: 'CONNECTION.OFFLINE' };
}));