mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
API.bulk() cleanup
This commit is contained in:
+5
-9
@@ -433,8 +433,7 @@ if (window.CefSharp) {
|
|||||||
throw new Error(text);
|
throw new Error(text);
|
||||||
};
|
};
|
||||||
|
|
||||||
API.bulk = function (options) {
|
API.$bulk = function (options, args) {
|
||||||
var handle = (args) => {
|
|
||||||
if (typeof options.handle === 'function') {
|
if (typeof options.handle === 'function') {
|
||||||
options.handle(args, options);
|
options.handle(args, options);
|
||||||
}
|
}
|
||||||
@@ -446,23 +445,20 @@ if (window.CefSharp) {
|
|||||||
: options.N < 0
|
: options.N < 0
|
||||||
? args.json.length
|
? args.json.length
|
||||||
: options.param.n === args.json.length)) {
|
: options.param.n === args.json.length)) {
|
||||||
this[options.fn](options.param).catch((err) => {
|
this.bulk(options);
|
||||||
if (typeof options.done === 'function') {
|
|
||||||
options.done(false, options);
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}).then(handle);
|
|
||||||
} else if (typeof options.done === 'function') {
|
} else if (typeof options.done === 'function') {
|
||||||
options.done(true, options);
|
options.done(true, options);
|
||||||
}
|
}
|
||||||
return args;
|
return args;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
API.bulk = function (options) {
|
||||||
this[options.fn](options.param).catch((err) => {
|
this[options.fn](options.param).catch((err) => {
|
||||||
if (typeof options.done === 'function') {
|
if (typeof options.done === 'function') {
|
||||||
options.done(false, options);
|
options.done(false, options);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}).then(handle);
|
}).then((args) => this.$bulk(options, args));
|
||||||
};
|
};
|
||||||
|
|
||||||
// API: Config
|
// API: Config
|
||||||
|
|||||||
Reference in New Issue
Block a user