What means curly braces around signal?
const controller = new AbortController();
const signal = controller.signal;
readFile(fileInfo[0].name, **{ signal }**, (err, buf) => {
...
Thanks.
What means curly braces around signal?
const controller = new AbortController();
const signal = controller.signal;
readFile(fileInfo[0].name, **{ signal }**, (err, buf) => {
...
Thanks.
If you read the documentation you'll note that the second argument to readfile
is options
which is an object, one property of which is signal
.
In ES6/ES2015 It's an object property value shorthand:
if you have a variable named signal
const signal = "test"
const ob = {signal};
console.log(ob.signal); // "test"
is equal to ES5's
const signal = "test"
const ob = {signal: signal};
console.log(ob.signal); // "test"