Commit ae6477b5fde4bcd09bac67ffebe5e44d675bbdb7

Authored by vking
1 parent 58fddd48

fix map & api

Showing 1 changed file with 6 additions and 5 deletions
... ... @@ -15,8 +15,9 @@ class rpcm {
tasks = {}
check(key) {
let nt = parseInt((new Date() / 1000))
let nt = new Date().getTime()
if (this.tasks[key]) {
//console.log('resSetIntervalnt',nt , this.tasks[key].timeout)
if (nt <= this.tasks[key].timeout) {
return true
}
... ... @@ -27,7 +28,7 @@ class rpcm {
get(key) {
return new Promise((success, fail) => {
let resSetInterval=setInterval(()=>{
//console.log('resSetInterval',this.tasks[key])
console.log('resSetInterval',key,this.tasks[key])
if(this.tasks[key].type=='success'){
wx.hideLoading();
success(this.tasks[key].res)
... ... @@ -44,13 +45,13 @@ class rpcm {
}
set(key,type='',res=null) {
let nt = parseInt((new Date() / 1000))
let nt = new Date().getTime()
this.tasks[key] = {
timeout: nt + 1000
timeout: nt + 5000
}
if(type){
this.tasks[key]['type']=type
this.tasks[key]['res']=res
this.tasks[key]['res']=JSON.parse(JSON.stringify(res))
}
}
}
... ...