Alipay JSSDK V3.1.1

ap.offNetworkChange(CALLBACK)

移除网络环境发生变化事件的监听。

代码示例

<script src="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.inc.min.js"></script>

<h2 class="am-ft-center">切换网络试试</h2>
<script>
  var handler = function(res){
    ap.alert('当前网络类型:' + res.networkType);
    ap.offNetworkChange(handler);
  };
  ap.onNetworkChange(handler);
</script>