rename variable name

This commit is contained in:
pypy
2020-01-11 21:25:40 +09:00
parent ad7a38776b
commit 642c996283

View File

@@ -206,11 +206,11 @@ if (window.CefSharp) {
var API = {}; var API = {};
API.$eventHandlers = new Map(); API.eventHandlers = new Map();
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 (handlers === undefined) {
return; return;
} }
@@ -225,16 +225,16 @@ if (window.CefSharp) {
}; };
API.$on = function (name, fx) { API.$on = function (name, fx) {
var handlers = this.$eventHandlers.get(name); var handlers = this.eventHandlers.get(name);
if (handlers === undefined) { if (handlers === undefined) {
handlers = []; handlers = [];
this.$eventHandlers.set(name, handlers); this.eventHandlers.set(name, handlers);
} }
handlers.push(fx); handlers.push(fx);
}; };
API.$off = function (name, fx) { API.$off = function (name, fx) {
var handlers = this.$eventHandlers.get(name); var handlers = this.eventHandlers.get(name);
if (handlers === undefined) { if (handlers === undefined) {
return; return;
} }
@@ -244,14 +244,14 @@ if (window.CefSharp) {
if (length > 1) { if (length > 1) {
handlers.splice(i, 1); handlers.splice(i, 1);
} else { } else {
this.$eventHandlers.delete(name); this.eventHandlers.delete(name);
} }
break; break;
} }
} }
}; };
API.$pendingGetRequests = new Map(); API.pendingGetRequests = new Map();
API.call = function (endpoint, options) { API.call = function (endpoint, options) {
var input = `https://api.vrchat.cloud/api/1/${endpoint}`; var input = `https://api.vrchat.cloud/api/1/${endpoint}`;
@@ -276,7 +276,7 @@ if (window.CefSharp) {
} }
delete init.body; delete init.body;
// merge requests // merge requests
var request = this.$pendingGetRequests.get(input); var request = this.pendingGetRequests.get(input);
if (request) { if (request) {
return request; return request;
} }
@@ -324,15 +324,15 @@ if (window.CefSharp) {
if (isGetRequest) { if (isGetRequest) {
req.finally(() => { req.finally(() => {
this.$pendingGetRequests.delete(input); this.pendingGetRequests.delete(input);
}); });
this.$pendingGetRequests.set(input, req); this.pendingGetRequests.set(input, req);
} }
return req; return req;
}; };
API.$status = { API.statusCodes = {
100: 'Continue', 100: 'Continue',
101: 'Switching Protocols', 101: 'Switching Protocols',
102: 'Processing', 102: 'Processing',
@@ -410,7 +410,7 @@ if (window.CefSharp) {
API.$throw = function (code, error, extra) { API.$throw = function (code, error, extra) {
var text = []; var text = [];
if (code) { if (code) {
var status = this.$status[code]; var status = this.statusCodes[code];
if (status) { if (status) {
text.push(`${code} ${status}`); text.push(`${code} ${status}`);
} else { } else {