mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Fix no-useless-call todo
The linter is correct that `devObject[func].call(devObject, args)` is unnecessary because it's equivalent to `devObject[func](args)`. @tmickel probably either meant to allow passing an array of arguments to be applied, or to call the function with the provided argument. Since we probably want to be able to use multi-argument functions, use `apply` and fix the one place that uses `ioQuery` with an argument.
This commit is contained in:
parent
8f45045af0
commit
548aa6dd70
2 changed files with 2 additions and 7 deletions
|
@ -114,7 +114,7 @@ class Scratch3SensingBlocks {
|
|||
}
|
||||
|
||||
getKeyPressed (args, util) {
|
||||
return util.ioQuery('keyboard', 'getKeyIsDown', args.KEY_OPTION);
|
||||
return util.ioQuery('keyboard', 'getKeyIsDown', [args.KEY_OPTION]);
|
||||
}
|
||||
|
||||
daysSince2000 () {
|
||||
|
|
|
@ -202,12 +202,7 @@ const execute = function (sequencer, thread) {
|
|||
// Find the I/O device and execute the query/function call.
|
||||
if (runtime.ioDevices[device] && runtime.ioDevices[device][func]) {
|
||||
const devObject = runtime.ioDevices[device];
|
||||
// @todo Figure out why eslint complains about no-useless-call
|
||||
// no-useless-call can't tell if the call is useless for dynamic
|
||||
// expressions... or something. Not exactly sure why it
|
||||
// complains here.
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return devObject[func].call(devObject, args);
|
||||
return devObject[func].apply(devObject, args);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue