Replace `arguments` keyword with rest parameter
This commit is contained in:
parent
0e9caa2d9c
commit
27dfbd9c04
|
@ -194,8 +194,8 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
|
||||||
* @ignore
|
* @ignore
|
||||||
* @type {?function(...*)}
|
* @type {?function(...*)}
|
||||||
*/
|
*/
|
||||||
onPrint: function () {
|
onPrint: function (...args) {
|
||||||
console.log.apply(console, Array.from(arguments)); // eslint-disable-line no-console
|
console.log.apply(console, ...args); // eslint-disable-line no-console
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* A callback function for handling the standard error stream. This method should usually only be used in debug pages.
|
* A callback function for handling the standard error stream. This method should usually only be used in debug pages.
|
||||||
|
@ -209,8 +209,8 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
|
||||||
* @ignore
|
* @ignore
|
||||||
* @type {?function(...*)}
|
* @type {?function(...*)}
|
||||||
*/
|
*/
|
||||||
onPrintError: function (var_args) {
|
onPrintError: function (...args) {
|
||||||
console.error.apply(console, Array.from(arguments)); // eslint-disable-line no-console
|
console.error.apply(console, ...args); // eslint-disable-line no-console
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ const GodotJSWrapper = {
|
||||||
godot_js_wrapper_create_cb: function (p_ref, p_func) {
|
godot_js_wrapper_create_cb: function (p_ref, p_func) {
|
||||||
const func = GodotRuntime.get_func(p_func);
|
const func = GodotRuntime.get_func(p_func);
|
||||||
let id = 0;
|
let id = 0;
|
||||||
const cb = function () {
|
const cb = function (...args) {
|
||||||
if (!GodotJSWrapper.get_proxied_value(id)) {
|
if (!GodotJSWrapper.get_proxied_value(id)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +223,6 @@ const GodotJSWrapper = {
|
||||||
// "godot_js_wrapper_object_set_cb_ret" upon calling the user function.
|
// "godot_js_wrapper_object_set_cb_ret" upon calling the user function.
|
||||||
// This is safe! JavaScript is single threaded (and using it in threads is not a good idea anyway).
|
// This is safe! JavaScript is single threaded (and using it in threads is not a good idea anyway).
|
||||||
GodotJSWrapper.cb_ret = null;
|
GodotJSWrapper.cb_ret = null;
|
||||||
const args = Array.from(arguments);
|
|
||||||
const argsProxy = new GodotJSWrapper.MyProxy(args);
|
const argsProxy = new GodotJSWrapper.MyProxy(args);
|
||||||
func(p_ref, argsProxy.get_id(), args.length);
|
func(p_ref, argsProxy.get_id(), args.length);
|
||||||
argsProxy.unref();
|
argsProxy.unref();
|
||||||
|
|
|
@ -40,12 +40,12 @@ const GodotRuntime = {
|
||||||
/*
|
/*
|
||||||
* Prints
|
* Prints
|
||||||
*/
|
*/
|
||||||
error: function () {
|
error: function (...args) {
|
||||||
err.apply(null, Array.from(arguments)); // eslint-disable-line no-undef
|
err.apply(null, ...args); // eslint-disable-line no-undef
|
||||||
},
|
},
|
||||||
|
|
||||||
print: function () {
|
print: function (...args) {
|
||||||
out.apply(null, Array.from(arguments)); // eslint-disable-line no-undef
|
out.apply(null, ...args); // eslint-disable-line no-undef
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue