.call()
and .apply()
found JS-0095 9478 progressIndicatorMethod in this &&
9479 typeof this[progressIndicatorMethod] === "function"
9480 ) {
9481 this[progressIndicatorMethod].call(this); 9482 }
9483 };
9484
1798 ? i.call(e, t, n)
1799 : t.apply(void 0, [e].slice(r));
1800 } catch (e) {
1801 n.apply(void 0, [e]); 1802 }
1803 }
1804 (S.Callbacks = function (r) {
1798 ? i.call(e, t, n)
1799 : t.apply(void 0, [e].slice(r));
1800 } catch (e) {
1801 n.apply(void 0, [e]); 1802 }
1803 }
1804 (S.Callbacks = function (r) {
9975 progressIndicatorMethod in this &&
9976 typeof this[progressIndicatorMethod] === "function"
9977 ) {
9978 this[progressIndicatorMethod].call(this); 9979 }
9980 };
9981
1798 ? i.call(e, t, n)
1799 : t.apply(void 0, [e].slice(r));
1800 } catch (e) {
1801 n.apply(void 0, [e]); 1802 }
1803 }
1804 (S.Callbacks = function (r) {
Function invocation can be written by Function.prototype.call()
and Function.prototype.apply()
.
But Function.prototype.call()
and Function.prototype.apply()
are slower than the normal function invocation.
// These are same as `foo(1, 2, 3);`
foo.call(undefined, 1, 2, 3);
foo.apply(undefined, [1, 2, 3]);
foo.call(null, 1, 2, 3);
foo.apply(null, [1, 2, 3]);
// These are same as `obj.foo(1, 2, 3);`
obj.foo.call(obj, 1, 2, 3);
obj.foo.apply(obj, [1, 2, 3]);
// The `this` binding is different.
foo.call(obj, 1, 2, 3);
foo.apply(obj, [1, 2, 3]);
obj.foo.call(null, 1, 2, 3);
obj.foo.apply(null, [1, 2, 3]);
obj.foo.call(otherObj, 1, 2, 3);
obj.foo.apply(otherObj, [1, 2, 3]);
// The argument list is variadic.
// Those are warned by the `prefer-spread` rule.
foo.apply(undefined, args);
foo.apply(null, args);
obj.foo.apply(obj, args);