import invoker,{BRIDGE_ERROR_CODE,CONTINUOUS_EVENT_LIST,PLATFORM_TYPE_ENUM,API_INVOKER_TYPE}from"./invoker";function startListenNetworkStatusHandler(e,t){var r=t.resolve,n=t.reject,s=t.context,o=t.containerType,i=t.appType,a=t.platformType,u=invoker.registerEvent(CONTINUOUS_EVENT_LIST.UPDATE_NETWORK_STATUS,(function(t){var r=t.data;r.errorCode!==BRIDGE_ERROR_CODE.SUCCESS?e.onFail&&e.onFail(r):e.onSuccess&&e.onSuccess(r.result)}));if(o){var E=function(e){invoker.registerContinuesEvent(e.result.requestId,u),invoker.handleBridgeResponse(e,r,n)},k=function(e){invoker.registerContinuesEvent(e.result.requestId,u),invoker.handleBridgeResponse(e,r,n)};i===API_INVOKER_TYPE.MINI_APP?s&&s({m:"taurus.common.startListenNetworkStatus",args:e,onSuccess:E,onFail:k}):a===PLATFORM_TYPE_ENUM.ANDROID?s&&s(E,k,"taurus.common","startListenNetworkStatus",e):a===PLATFORM_TYPE_ENUM.IOS&&s.callHandler("taurus.common.startListenNetworkStatus",Object.assign({},e),(function(e){invoker.registerContinuesEvent(e.result.requestId,u),invoker.handleBridgeResponse(e,r,n)}))}else s&&s.call("startListenNetworkStatus",e,(function(e){invoker.registerContinuesEvent(e.result.requestId,u),invoker.handleBridgeResponse(e,r,n)}))}invoker.registerAPI("startListenNetworkStatus",{mobile:startListenNetworkStatusHandler,mini:startListenNetworkStatusHandler}),startListenNetworkStatus.version={android:"1.3.1.1",ios:"1.3.1.1"};export default function startListenNetworkStatus(e){return invoker.invoke("startListenNetworkStatus",e)}