API.bulk() cleanup

This commit is contained in:
pypy
2020-01-11 20:52:13 +09:00
parent 98f5448d52
commit 541a978918
+5 -9
View File
@@ -433,8 +433,7 @@ if (window.CefSharp) {
throw new Error(text);
};
API.bulk = function (options) {
var handle = (args) => {
API.$bulk = function (options, args) {
if (typeof options.handle === 'function') {
options.handle(args, options);
}
@@ -446,23 +445,20 @@ if (window.CefSharp) {
: options.N < 0
? args.json.length
: options.param.n === args.json.length)) {
this[options.fn](options.param).catch((err) => {
if (typeof options.done === 'function') {
options.done(false, options);
}
throw err;
}).then(handle);
this.bulk(options);
} else if (typeof options.done === 'function') {
options.done(true, options);
}
return args;
};
API.bulk = function (options) {
this[options.fn](options.param).catch((err) => {
if (typeof options.done === 'function') {
options.done(false, options);
}
throw err;
}).then(handle);
}).then((args) => this.$bulk(options, args));
};
// API: Config