File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
src/BootstrapBlazor/wwwroot/modules Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -3,19 +3,14 @@ import EventHandler from "./event-handler.js";
33
44export function init ( id , options ) {
55 const { invoke, onlineStateChangedCallback, onNetworkStateChangedCallback, indicators } = options ;
6- navigator . connection . onchange = e => {
7- const nt = e . target ;
6+ const updateState = nt => {
87 const { downlink, effectiveType, rtt } = nt ;
98 invoke . invokeMethodAsync ( onNetworkStateChangedCallback , {
109 downlink, networkType : effectiveType , rTT : rtt
1110 } ) ;
1211 }
13-
14- const resetState = ( ) => {
15- const { downlink, effectiveType, rtt } = navigator . connection ;
16- invoke . invokeMethodAsync ( onNetworkStateChangedCallback , {
17- downlink, networkType : effectiveType , rTT : rtt
18- } ) ;
12+ navigator . connection . onchange = e => {
13+ updateState ( e . target ) ;
1914 }
2015
2116 const onlineStateChanged = ( ) => {
@@ -47,7 +42,8 @@ export function init(id, options) {
4742 onlineStateChanged,
4843 offlineStateChanged
4944 } ) ;
50- resetState ( ) ;
45+
46+ updateState ( navigator . connection ) ;
5147}
5248
5349export async function dispose ( id ) {
You can’t perform that action at this time.
0 commit comments