代码拉取完成,页面将自动刷新
同步操作将从 GoEasy/微信小程序Websocket实时通讯 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
//app.js
import GoEasy from './utils/goeasy-2.1.11.min.js';
App({
globalData: {
goEasy: GoEasy.getInstance({
host:"hangzhou.goeasy.io",//应用所在的区域地址: 【hangzhou.goeasy.io |singapore.goeasy.io】
appkey:"BC-xxxx",// common key
modules: ['pubsub']
})
},
onLaunch: function () {
this.extendDateFormat();
//建立连接
this.globalData.goEasy.connect({
onSuccess: function () {
console.log("GoEasy connect successfully.")
},
onFailed: function (error) {
console.log("Failed to connect GoEasy, code:" + error.code + ",error:" + error.content);
wx.showModal({
icon: "none",
title: error.code.toString(),
content: error.content,
showCancel: false,
duration: 6000
});
},
onProgress: function (attempts) {
console.log("GoEasy is connecting", attempts);
}
});
},
extendDateFormat() {
Date.prototype.formatDate = function (fmt) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"h+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (o.hasOwnProperty(k)) {
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
return fmt;
};
}
})
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。