callAsFunction method

  1. @JS('call')
JSAny? callAsFunction([
  1. JSAny? thisArg,
  2. JSAny? arg1,
  3. JSAny? arg2,
  4. JSAny? arg3,
  5. JSAny? arg4,
])

Call this JSFunction using the JavaScript .call syntax and returns the result.

Takes at most 4 args for consistency with other APIs and relative brevity. If more are needed, you can declare your own external member with the same syntax.

Implementation

// We rename this function since declaring a `call` member makes a class
// callable in Dart. This is convenient, but unlike Dart functions, JavaScript
// functions explicitly take a `this` argument (which users can provide `null`
// for in the case where the function doesn't need it), which may lead to
// confusion.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call
@JS('call')
external JSAny? callAsFunction(
    [JSAny? thisArg, JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]);