webman/push push-uniapp.js BUG

qiling

问题描述

这里写描述
push-uniapp.js 断线后 代码监听事件叠加
打包安卓后 navigator.onLine 报错

解决方式

push-uniapp.js 断线后 代码监听事件叠加

function Connection(options) {
    this.dispatcher = new Dispatcher();
    __extends(this, this.dispatcher);
    var properies = ['on', 'off', 'emit'];
    for (var i in properies) {
        this[properies[i]] = this.dispatcher[properies[i]];
    }
    this.options = options;
    this.state = 'initialized'; //initialized connecting connected disconnected
    this.doNotConnect = 0;
    this.reconnectInterval = 1;
    this.connection = null;
    this.reconnectTimer = 0;
    //增加已经创建过的标记
    this.isConnection = false;
    this.connect();
}

//非首次连接不设置回调 uniapp 只需要首次 注册事件 否则会叠加回调事件
if(!_this.isConnection){
    _this.isConnection = true;
    cb();
}

打包安卓后 navigator.onLine 报错

// 有网络的状态下,重连间隔最大2秒 这里安卓有bug 做兼容处理
// #ifdef H5
    if (this.reconnectInterval > 2000 && navigator.onLine) {
        _this.reconnectInterval = 2000;
    }
// #endif
// #ifdef APP-PLUS
    if (this.reconnectInterval > 2000) {
        _this.reconnectInterval = 2000;
    }
// #endif
247 1 0
1个回答

walkor

发个pr吧

  • 邹意 2024-06-07

    这玩意是不是我前两天研究的问题哦,还没来得及研究前端

×
🔝