Page Contents

Home > @loopback/context > InvocationContext

InvocationContext class

InvocationContext represents the context to invoke interceptors for a method. The context can be used to access metadata about the invocation as well as other dependencies.

Signature:

export declare class InvocationContext extends Context 

Extends: Context

Constructors

Constructor Modifiers Description
(constructor)(parent, target, methodName, args, source)   Construct a new instance of InvocationContext

Properties

Property Modifiers Type Description
args readonly InvocationArgs  
description readonly string Description of the invocation
methodName readonly string  
source? readonly InvocationSource<unknown> | undefined (Optional)
target readonly object  
targetClass readonly Function The target class, such as OrderController
targetName readonly string The target name, such as OrderController.prototype.cancelOrder

Methods

Method Modifiers Description
assertMethodExists()   Assert the method exists on the target. An error will be thrown if otherwise.
invokeTargetMethod(options)   Invoke the target method with the given context
toString()