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