diff --git a/html/src/app.js b/html/src/app.js index 18f2a185..6ae29dfc 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -294,7 +294,7 @@ speechSynthesis.getVoices(); API.$emit = function (name, ...args) { // console.log(name, ...args); var handlers = this.eventHandlers.get(name); - if (handlers === undefined) { + if (typeof handlers === 'undefined') { return; } try { @@ -308,7 +308,7 @@ speechSynthesis.getVoices(); API.$on = function (name, handler) { var handlers = this.eventHandlers.get(name); - if (handlers === undefined) { + if (typeof handlers === 'undefined') { handlers = []; this.eventHandlers.set(name, handlers); } @@ -317,7 +317,7 @@ speechSynthesis.getVoices(); API.$off = function (name, handler) { var handlers = this.eventHandlers.get(name); - if (handlers === undefined) { + if (typeof handlers === 'undefined') { return; } var { length } = handlers; @@ -354,7 +354,7 @@ speechSynthesis.getVoices(); } // merge requests var req = this.pendingGetRequests.get(init.url); - if (req !== undefined) { + if (typeof req !== 'undefined') { return req; } } else if (init.VRCPlusIcon) { @@ -502,16 +502,16 @@ speechSynthesis.getVoices(); var text = []; if (code > 0) { var status = this.statusCodes[code]; - if (status === undefined) { + if (typeof status === 'undefined') { text.push(`${code}`); } else { text.push(`${code} ${status}`); } } - if (error !== undefined) { + if (typeof error !== 'undefined') { text.push(JSON.stringify(error)); } - if (extra !== undefined) { + if (typeof extra !== 'undefined') { text.push(JSON.stringify(extra)); } text = text.map((s) => escapeTag(s)).join('
'); @@ -525,7 +525,7 @@ speechSynthesis.getVoices(); }; API.$bulk = function (options, args) { - if (options.handle !== undefined) { + if ('handle' in options) { options.handle.call(this, args, options); } if (args.json.length > 0 && @@ -537,7 +537,7 @@ speechSynthesis.getVoices(); ? args.json.length : options.params.n === args.json.length)) { this.bulk(options); - } else if (options.done !== undefined) { + } else if ('done' in options) { options.done.call(this, true, options); } return args; @@ -545,7 +545,7 @@ speechSynthesis.getVoices(); API.bulk = function (options) { this[options.fn](options.params).catch((err) => { - if (options.done !== undefined) { + if ('done' in options) { options.done.call(this, false, options); } throw err; @@ -766,7 +766,7 @@ speechSynthesis.getVoices(); this.text = 'Private'; } else if (L.worldId) { var ref = API.cachedWorlds.get(L.worldId); - if (ref === undefined) { + if (typeof ref === 'undefined') { API.getWorld({ worldId: L.worldId }).then((args) => { @@ -1037,7 +1037,7 @@ speechSynthesis.getVoices(); } var key = tag.substr(9); var value = subsetOfLanguages[key]; - if (value === undefined) { + if (typeof value === 'undefined') { continue; } ref.$languages.push({ @@ -1157,7 +1157,7 @@ speechSynthesis.getVoices(); json.$online_for = API.currentUser.$online_for; json.$offline_for = API.currentUser.$offline_for; } - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', username: '', @@ -1276,7 +1276,7 @@ speechSynthesis.getVoices(); API.getCachedUser = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedUsers.get(params.userId); - if (ref === undefined) { + if (typeof ref === 'undefined') { this.getUser(params).catch(reject).then(resolve); } else { resolve({ @@ -1391,7 +1391,7 @@ speechSynthesis.getVoices(); API.applyWorld = function (json) { var ref = this.cachedWorlds.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', name: '', @@ -1462,7 +1462,7 @@ speechSynthesis.getVoices(); API.getCachedWorld = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedWorlds.get(params.worldId); - if (ref === undefined) { + if (typeof ref === 'undefined') { this.getWorld(params).catch(reject).then(resolve); } else { resolve({ @@ -1491,7 +1491,7 @@ speechSynthesis.getVoices(); */ API.getWorlds = function (params, option) { var endpoint = 'worlds'; - if (option !== undefined) { + if (typeof option !== 'undefined') { endpoint = `worlds/${option}`; } return this.call(endpoint, { @@ -1724,7 +1724,7 @@ speechSynthesis.getVoices(); API.applyAvatar = function (json) { var ref = this.cachedAvatars.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', name: '', @@ -1778,7 +1778,7 @@ speechSynthesis.getVoices(); API.getCachedAvatar = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedAvatars.get(params.avatarId); - if (ref === undefined) { + if (typeof ref === 'undefined') { this.getAvatar(params).catch(reject).then(resolve); } else { resolve({ @@ -1884,7 +1884,7 @@ speechSynthesis.getVoices(); API.$on('NOTIFICATION:ACCEPT', function (args) { var ref = this.cachedNotifications.get(args.params.notificationId); - if (ref === undefined || + if (typeof ref === 'undefined' || ref.$isDeleted) { return; } @@ -1905,7 +1905,7 @@ speechSynthesis.getVoices(); API.$on('NOTIFICATION:HIDE', function (args) { var ref = this.cachedNotifications.get(args.params.notificationId); - if (ref === undefined && + if (typeof ref === 'undefined' && ref.$isDeleted) { return; } @@ -1921,7 +1921,7 @@ speechSynthesis.getVoices(); API.applyNotification = function (json) { var ref = this.cachedNotifications.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', senderUserId: '', @@ -2180,7 +2180,7 @@ speechSynthesis.getVoices(); API.applyPlayerModeration = function (json) { var ref = this.cachedPlayerModerations.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', type: '', @@ -2374,7 +2374,7 @@ speechSynthesis.getVoices(); API.$on('FAVORITE:DELETE', function (args) { var ref = this.cachedFavoritesByObjectId.get(args.params.objectId); - if (ref === undefined) { + if (typeof ref === 'undefined') { return; } // 애초에 $isDeleted인데 여기로 올 수 가 있나..? @@ -2486,7 +2486,7 @@ speechSynthesis.getVoices(); API.applyFavorite = function (json) { var ref = this.cachedFavorites.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', type: '', @@ -2510,7 +2510,7 @@ speechSynthesis.getVoices(); if (ref.$isDeleted === false && ref.$groupRef === null) { var group = this.cachedFavoriteGroupsByTypeName.get(ref.$groupKey); - if (group !== undefined) { + if (typeof group !== 'undefined') { ref.$groupRef = group; ++group.count; } @@ -2552,7 +2552,7 @@ speechSynthesis.getVoices(); continue; } var type = types[ref.type]; - if (type === undefined) { + if (typeof type === 'undefined') { continue; } if ((ref.type === 'avatar') && (!tags.includes(ref.tags[0]))) { @@ -2615,7 +2615,7 @@ speechSynthesis.getVoices(); API.applyFavoriteGroup = function (json) { var ref = this.cachedFavoriteGroups.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', ownerId: '', @@ -2702,7 +2702,7 @@ speechSynthesis.getVoices(); continue; } var groups = types[ref.type]; - if (groups === undefined) { + if (typeof groups === 'undefined') { continue; } for (var group of groups) { @@ -2730,7 +2730,7 @@ speechSynthesis.getVoices(); continue; } var groups = types[ref.type]; - if (groups === undefined) { + if (typeof groups === 'undefined') { continue; } for (var group of groups) { @@ -2760,7 +2760,7 @@ speechSynthesis.getVoices(); continue; } var group = this.cachedFavoriteGroupsByTypeName.get(ref.$groupKey); - if (group === undefined) { + if (typeof group === 'undefined') { continue; } ref.$groupRef = group; @@ -3400,7 +3400,7 @@ speechSynthesis.getVoices(); $app.methods.languageClass = function (language) { var style = {}; var mapping = languageMappings[language]; - if (mapping !== undefined) { + if (typeof mapping !== 'undefined') { style[mapping] = true; } return style; @@ -3670,8 +3670,8 @@ speechSynthesis.getVoices(); }; for (var userId of friends) { var ref = this.friends.get(userId); - var name = (ref !== undefined && ref.name) || ''; - var memo = (ref !== undefined && ref.memo) || ''; + var name = (typeof ref !== 'undefined' && ref.name) || ''; + var memo = (typeof ref !== 'undefined' && ref.memo) || ''; lines.push(`${_(userId)},${_(name)},${_(memo)}`); } this.exportFriendsListContent = lines.join('\n'); @@ -3715,7 +3715,7 @@ speechSynthesis.getVoices(); var credentialsToSave = { user: currentUser, loginParmas: this.saveCredentials }; savedCredentialsArray[currentUser.username] = credentialsToSave; delete this.saveCredentials; - } else if (savedCredentialsArray[currentUser.username] !== undefined) { + } else if (typeof savedCredentialsArray[currentUser.username] !== 'undefined') { savedCredentialsArray[currentUser.username].user = currentUser; } this.loginForm.savedCredentials = savedCredentialsArray; @@ -3757,7 +3757,7 @@ speechSynthesis.getVoices(); API.$on('AUTOLOGIN', function () { var user = $app.loginForm.savedCredentials[$app.loginForm.lastUserLoggedIn]; - if (user !== undefined) { + if (typeof user !== 'undefined') { $app.relogin({ username: user.loginParmas.username, password: user.loginParmas.password @@ -3924,7 +3924,7 @@ speechSynthesis.getVoices(); continue; } var user = API.cachedUsers.get(userId); - if (user !== undefined && + if (typeof user !== 'undefined' && user.status !== 'offline') { continue; } @@ -4034,9 +4034,9 @@ speechSynthesis.getVoices(); no: ++this.friendsNo, memo: this.loadMemo(id) }; - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = this.friendLog[id]; - if (ref !== undefined && + if (typeof ref !== 'undefined' && ref.displayName) { ctx.name = ref.displayName; } @@ -4067,7 +4067,7 @@ speechSynthesis.getVoices(); $app.methods.deleteFriend = function (id) { var ctx = this.friends.get(id); - if (ctx === undefined) { + if (typeof ctx === 'undefined') { return; } this.friends.delete(id); @@ -4090,12 +4090,12 @@ speechSynthesis.getVoices(); $app.methods.updateFriend = function (id, state, origin) { var ctx = this.friends.get(id); - if (ctx === undefined) { + if (typeof ctx === 'undefined') { return; } var ref = API.cachedUsers.get(id); var isVIP = API.cachedFavoritesByObjectId.has(id); - if (state === undefined || + if (typeof state === 'undefined' || ctx.state === state) { // this is should be: undefined -> user if (ctx.ref !== ref) { @@ -4137,7 +4137,7 @@ speechSynthesis.getVoices(); } } } - if (ref !== undefined && + if (typeof ref !== 'undefined' && ctx.name !== ref.displayName) { ctx.name = ref.displayName; if (ctx.state === 'online') { @@ -4155,7 +4155,7 @@ speechSynthesis.getVoices(); // FIXME: 도배 가능성 있음 if (origin && ctx.state !== 'online' && - ref !== undefined && + typeof ref !== 'undefined' && ref.location !== '' && ref.location !== 'offline') { API.getUser({ @@ -4186,7 +4186,7 @@ speechSynthesis.getVoices(); if (ctx.isVIP !== isVIP) { ctx.isVIP = isVIP; } - if (ref !== undefined) { + if (typeof ref !== 'undefined') { if (ctx.ref !== ref) { ctx.ref = ref; } @@ -4213,7 +4213,7 @@ speechSynthesis.getVoices(); this.friendsGroup3_.push(ctx); this.friendsGroupD_.unshift(ctx); } - if (ctx.ref !== undefined) { + if ('ref' in ctx) { if ((ctx.ref.$offline_for === '') && ((ctx.state === 'offline') && ctx.ref.state === '') || (((ctx.state === 'offline') || (ctx.state === 'active')) && @@ -4319,7 +4319,7 @@ speechSynthesis.getVoices(); $app.methods.userStatusClass = function (user) { var style = {}; - if (user !== undefined) { + if (typeof user !== 'undefined') { if (user.location === 'offline') { // Offline style.offline = true; @@ -4365,7 +4365,7 @@ speechSynthesis.getVoices(); if (query) { var QUERY = query.toUpperCase(); for (var ctx of this.friends.values()) { - if (ctx.ref === undefined) { + if (('ref' in ctx) === false) { continue; } var NAME = ctx.name.toUpperCase(); @@ -4780,7 +4780,7 @@ speechSynthesis.getVoices(); $app.methods.updateDiscord = function () { var ref = API.cachedUsers.get(API.currentUser.id); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { var myLocation = (this.isGameRunning === true) ? this.lastLocation : ''; @@ -4912,7 +4912,7 @@ speechSynthesis.getVoices(); var map = new Map(); for (var json of args.json) { var ref = API.cachedUsers.get(json.id); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { map.set(ref.id, ref); } } @@ -4997,7 +4997,7 @@ speechSynthesis.getVoices(); var map = new Map(); for (var json of args.json) { var ref = API.cachedWorlds.get(json.id); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { map.set(ref.id, ref); } } @@ -5048,7 +5048,7 @@ speechSynthesis.getVoices(); var map = new Map(); for (var json of args.json) { var ref = API.cachedAvatars.get(json.id); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { map.set(ref.id, ref); } } @@ -5100,9 +5100,9 @@ speechSynthesis.getVoices(); $app.methods.applyFavorite = function (type, objectId) { var favorite = API.cachedFavoritesByObjectId.get(objectId); var ctx = this.favoriteObjects.get(objectId); - if (favorite !== undefined) { + if (typeof favorite !== 'undefined') { var isTypeChanged = false; - if (ctx === undefined) { + if (typeof ctx === 'undefined') { ctx = { id: objectId, type, @@ -5113,9 +5113,9 @@ speechSynthesis.getVoices(); this.favoriteObjects.set(objectId, ctx); if (type === 'friend') { var ref = API.cachedUsers.get(objectId); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = this.friendLog[objectId]; - if (ref !== undefined && + if (typeof ref !== 'undefined' && ref.displayName) { ctx.name = ref.displayName; } @@ -5125,13 +5125,13 @@ speechSynthesis.getVoices(); } } else if (type === 'world') { var ref = API.cachedWorlds.get(objectId); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { ctx.ref = ref; ctx.name = ref.name; } } else if (type === 'avatar') { var ref = API.cachedAvatars.get(objectId); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { ctx.ref = ref; ctx.name = ref.name; } @@ -5151,7 +5151,7 @@ speechSynthesis.getVoices(); } if (type === 'friend') { var ref = API.cachedUsers.get(objectId); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { if (ctx.ref !== ref) { ctx.ref = ref; } @@ -5162,7 +5162,7 @@ speechSynthesis.getVoices(); } } else if (type === 'world') { var ref = API.cachedWorlds.get(objectId); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { if (ctx.ref !== ref) { ctx.ref = ref; } @@ -5173,7 +5173,7 @@ speechSynthesis.getVoices(); } } else if (type === 'avatar') { var ref = API.cachedAvatars.get(objectId); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { if (ctx.ref !== ref) { ctx.ref = ref; } @@ -5196,7 +5196,7 @@ speechSynthesis.getVoices(); this.sortFavoriteAvatars = true; } } - } else if (ctx !== undefined) { + } else if (typeof ctx !== 'undefined') { this.favoriteObjects.delete(objectId); if (type === 'friend') { removeFromArray(this.favoriteFriends_, ctx); @@ -5348,7 +5348,7 @@ speechSynthesis.getVoices(); API.$on('FRIEND:REQUEST', function (args) { var ref = this.cachedUsers.get(args.params.userId); - if (ref === undefined) { + if (typeof ref === 'undefined') { return; } $app.friendLogTable.data.push({ @@ -5362,7 +5362,7 @@ speechSynthesis.getVoices(); API.$on('FRIEND:REQUEST:CANCEL', function (args) { var ref = this.cachedUsers.get(args.params.userId); - if (ref === undefined) { + if (typeof ref === 'undefined') { return; } $app.friendLogTable.data.push({ @@ -5400,7 +5400,7 @@ speechSynthesis.getVoices(); id }; var user = API.cachedUsers.get(id); - if (user !== undefined) { + if (typeof user !== 'undefined') { ctx.displayName = user.displayName; ctx.trustLevel = user.$trustLevel; } @@ -5413,7 +5413,7 @@ speechSynthesis.getVoices(); }; $app.methods.addFriendship = function (id) { - if (this.friendLog[id] !== undefined) { + if (typeof this.friendLog[id] !== 'undefined') { return; } var ctx = { @@ -5423,7 +5423,7 @@ speechSynthesis.getVoices(); }; Vue.set(this.friendLog, id, ctx); var ref = API.cachedUsers.get(id); - if (ref !== undefined) { + if (typeof ref !== 'undefined') { ctx.displayName = ref.displayName; ctx.trustLevel = ref.$trustLevel; this.friendLogTable.data.push({ @@ -5439,7 +5439,7 @@ speechSynthesis.getVoices(); $app.methods.deleteFriendship = function (id) { var ctx = this.friendLog[id]; - if (ctx === undefined) { + if (typeof ctx === 'undefined') { return; } Vue.delete(this.friendLog, id); @@ -5468,7 +5468,7 @@ speechSynthesis.getVoices(); $app.methods.updateFriendship = function (ref) { var ctx = this.friendLog[ref.id]; - if (ctx === undefined) { + if (typeof ctx === 'undefined') { return; } if (ctx.displayName !== ref.displayName) { @@ -6309,7 +6309,7 @@ speechSynthesis.getVoices(); // 얘는 @DELETE가 오고나서 ACCEPT가 옴 // 따라서 $isDeleted라면 ref가 undefined가 됨 if (D.visible === false || - ref === undefined || + typeof ref === 'undefined' || ref.type !== 'friendRequest' || ref.senderUserId !== D.id) { return; @@ -6466,7 +6466,7 @@ speechSynthesis.getVoices(); D.$location = L; if (L.userId) { var ref = API.cachedUsers.get(L.userId); - if (ref === undefined) { + if (typeof ref === 'undefined') { API.getUser({ userId: L.userId }).then((args) => { @@ -6480,7 +6480,7 @@ speechSynthesis.getVoices(); var users = []; if (L.isOffline === false) { for (var { ref } of this.friends.values()) { - if (ref !== undefined && + if (typeof ref !== 'undefined' && ref.location === L.tag) { users.push(ref); } @@ -6489,7 +6489,7 @@ speechSynthesis.getVoices(); if (this.isGameRunning && this.lastLocation === L.tag) { var ref = API.cachedUsers.get(API.currentUser.id); - users.push((ref === undefined) + users.push((typeof ref === 'undefined') ? API.currentUser : ref); } @@ -6509,7 +6509,7 @@ speechSynthesis.getVoices(); } }; var ref = API.cachedWorlds.get(L.worldId); - if (ref === undefined) { + if (typeof ref === 'undefined') { API.getWorld({ worldId: L.worldId }).then((args) => { @@ -6576,7 +6576,7 @@ speechSynthesis.getVoices(); handle: (args) => { for (var json of args.json) { var $ref = API.cachedWorlds.get(json.id); - if ($ref !== undefined) { + if (typeof $ref !== 'undefined') { map.set($ref.id, $ref); } } @@ -6623,7 +6623,7 @@ speechSynthesis.getVoices(); handle: (args) => { for (var json of args.json) { var $ref = API.cachedAvatars.get(json.id); - if ($ref !== undefined) { + if (typeof $ref !== 'undefined') { map.set($ref.id, $ref); } } @@ -6985,7 +6985,7 @@ speechSynthesis.getVoices(); } var { instanceId } = D.$location; if (instanceId && - instances[instanceId] === undefined) { + typeof instances[instanceId] === 'undefined') { instances[instanceId] = { id: instanceId, occupants: 0, @@ -6993,14 +6993,14 @@ speechSynthesis.getVoices(); }; } for (var { ref } of this.friends.values()) { - if (ref === undefined || - ref.$location === undefined || + if (typeof ref === 'undefined' || + ('$location' in ref) === false || ref.$location.worldId !== D.id) { continue; } var { instanceId } = ref.$location; var instance = instances[instanceId]; - if (instance === undefined) { + if (typeof instance === 'undefined') { instance = { id: instanceId, occupants: 0, @@ -7014,7 +7014,7 @@ speechSynthesis.getVoices(); var lastLocation$ = API.parseLocation(this.lastLocation); if (lastLocation$.worldId === D.id) { var instance = instances[lastLocation$.instanceId]; - if (instance === undefined) { + if (typeof instance === 'undefined') { instance = { id: lastLocation$.instanceId, occupants: 1, @@ -7023,7 +7023,7 @@ speechSynthesis.getVoices(); instances[instance.id] = instance; } var ref = API.cachedUsers.get(API.currentUser.id); - instance.users.push((ref === undefined) + instance.users.push((typeof ref === 'undefined') ? API.currentUser : ref); } @@ -7037,7 +7037,7 @@ speechSynthesis.getVoices(); instance.$location = L; if (L.userId) { var ref = API.cachedUsers.get(L.userId); - if (ref === undefined) { + if (typeof ref === 'undefined') { API.getUser({ userId: L.userId }).then((args) => { diff --git a/html/src/vr.js b/html/src/vr.js index db1d82b1..0a0e6695 100644 --- a/html/src/vr.js +++ b/html/src/vr.js @@ -115,7 +115,7 @@ speechSynthesis.getVoices(); API.$emit = function (name, ...args) { // console.log(name, ...args); var handlers = this.eventHandlers.get(name); - if (handlers === undefined) { + if (typeof handlers === 'undefined') { return; } try { @@ -129,7 +129,7 @@ speechSynthesis.getVoices(); API.$on = function (name, handler) { var handlers = this.eventHandlers.get(name); - if (handlers === undefined) { + if (typeof handlers === 'undefined') { handlers = []; this.eventHandlers.set(name, handlers); } @@ -138,7 +138,7 @@ speechSynthesis.getVoices(); API.$off = function (name, handler) { var handlers = this.eventHandlers.get(name); - if (handlers === undefined) { + if (typeof handlers === 'undefined') { return; } var { length } = handlers; @@ -176,7 +176,7 @@ speechSynthesis.getVoices(); } // merge requests var req = this.pendingGetRequests.get(init.url); - if (req !== undefined) { + if (typeof req !== 'undefined') { return req; } } else { @@ -316,13 +316,13 @@ speechSynthesis.getVoices(); var text = []; if (code > 0) { var status = this.statusCodes[code]; - if (status === undefined) { + if (typeof status === 'undefined') { text.push(`${code}`); } else { text.push(`${code} ${status}`); } } - if (error !== undefined) { + if (typeof error !== 'undefined') { text.push(JSON.stringify(error)); } text = text.map((s) => escapeTag(s)).join('
'); @@ -462,7 +462,7 @@ speechSynthesis.getVoices(); this.text = 'Private'; } else if (L.worldId) { var ref = API.cachedWorlds.get(L.worldId); - if (ref === undefined) { + if (typeof ref === 'undefined') { API.getWorld({ worldId: L.worldId }).then((args) => { @@ -503,7 +503,7 @@ speechSynthesis.getVoices(); API.applyWorld = function (json) { var ref = this.cachedWorlds.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', name: '', @@ -577,7 +577,7 @@ speechSynthesis.getVoices(); API.applyUser = function (json) { var ref = this.cachedUsers.get(json.id); - if (ref === undefined) { + if (typeof ref === 'undefined') { ref = { id: '', username: '', @@ -659,7 +659,7 @@ speechSynthesis.getVoices(); API.getCachedUser = function (params) { return new Promise((resolve, reject) => { var ref = this.cachedUsers.get(params.userId); - if (ref === undefined) { + if (typeof ref === 'undefined') { this.getUser(params).catch(reject).then(resolve); } else { resolve({ @@ -810,7 +810,7 @@ speechSynthesis.getVoices(); if (feeds === null) { return; } - if ((this.lastFeedEntry !== undefined) && + if (('lastFeedEntry' in this) && (feeds[0].created_at === this.lastFeedEntry.created_at)) { return; } @@ -1156,7 +1156,7 @@ speechSynthesis.getVoices(); $app.methods.userStatusClass = function (user) { var style = {}; - if (user !== undefined) { + if (typeof user !== 'undefined') { if (user.location === 'offline') { // Offline style.offline = true; @@ -1186,7 +1186,7 @@ speechSynthesis.getVoices(); text = 'Private'; } else if (L.worldId) { var ref = API.cachedWorlds.get(L.worldId); - if (ref === undefined) { + if (typeof ref === 'undefined') { await API.getWorld({ worldId: L.worldId }).then((args) => {