Skip to main content
Version: 3.27.2

handler.apply()

The handler.apply() method is a trap for a function call.

Syntax

new Proxy(target, {
apply(target, thisArg, argumentsList) {
}
});

Parameters

The following parameters are passed to the apply() method. this is bound to the handler.

  • target
    • : The target callable object.
  • thisArg
    • : The this argument for the call.
  • argumentsList
    • : The list of arguments for the call.

Return value

The apply() method can return any value.

Description

The handler.apply() method is a trap for a function call.

Interceptions

This trap can intercept these operations:

Or any other operation that invokes the [[Call]] internal method.

Invariants

If the following invariants are violated, the trap throws a TypeError when invoked.

  • The target must be a callable itself. That is, it must be a function object.