callAsFunction method
- @JS('call')
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]);