use Map() on API.friend404

This commit is contained in:
pypy
2020-01-11 23:34:15 +09:00
parent f4842bec59
commit 5af4685e84

View File

@@ -1225,11 +1225,11 @@ if (window.CefSharp) {
// API: Friend // API: Friend
API.friend404 = {}; API.friend404 = new Map();
API.isFriendLoading = false; API.isFriendLoading = false;
API.$on('LOGIN', function () { API.$on('LOGIN', function () {
this.friend404 = {}; this.friend404.clear();
this.isFriendLoading = false; this.isFriendLoading = false;
}); });
@@ -1246,7 +1246,7 @@ if (window.CefSharp) {
return; return;
} }
user.$isFriend = true; user.$isFriend = true;
delete this.friend404[json.id]; this.friend404.delete(json.id);
}); });
}); });
@@ -1259,16 +1259,16 @@ if (window.CefSharp) {
return true; return true;
} }
// NOTE: NaN이면 false라서 괜찮음 // NOTE: NaN이면 false라서 괜찮음
return this.friend404[id] >= 2; return this.friend404.get(id) >= 2;
}); });
} }
this.currentUser.friends.forEach((id) => { this.currentUser.friends.forEach((id) => {
var ctx = this.cachedUsers.get(id); var ctx = this.cachedUsers.get(id);
if (!(ctx && if (!(ctx &&
ctx.$isFriend)) { ctx.$isFriend)) {
var hit = Number(this.friend404[id]) || 0; var hit = Number(this.friend404.get(id)) || 0;
if (hit < 2) { if (hit < 2) {
this.friend404[id] = hit + 1; this.friend404.set(id, hit + 1);
} }
} }
}); });