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)](/doc/en/lb4/apidocs.context.invocationcontext._constructor_.html) Construct a new instance of `InvocationContext`

Properties

Property Modifiers Type Description
[args](/doc/en/lb4/apidocs.context.invocationcontext.args.html) `readonly` [InvocationArgs](/doc/en/lb4/apidocs.context.invocationargs.html)
[description](/doc/en/lb4/apidocs.context.invocationcontext.description.html) `readonly` string Description of the invocation
[methodName](/doc/en/lb4/apidocs.context.invocationcontext.methodname.html) `readonly` string
[source?](/doc/en/lb4/apidocs.context.invocationcontext.source.html) `readonly` [InvocationSource](/doc/en/lb4/apidocs.context.invocationsource.html)<unknown> \| undefined _(Optional)_
[target](/doc/en/lb4/apidocs.context.invocationcontext.target.html) `readonly` object
[targetClass](/doc/en/lb4/apidocs.context.invocationcontext.targetclass.html) `readonly` Function The target class, such as `OrderController`
[targetName](/doc/en/lb4/apidocs.context.invocationcontext.targetname.html) `readonly` string The target name, such as `OrderController.prototype.cancelOrder`

Methods

Method Modifiers Description
[assertMethodExists()](/doc/en/lb4/apidocs.context.invocationcontext.assertmethodexists.html) Assert the method exists on the target. An error will be thrown if otherwise.
[invokeTargetMethod(options)](/doc/en/lb4/apidocs.context.invocationcontext.invoketargetmethod.html) Invoke the target method with the given context
[toString()](/doc/en/lb4/apidocs.context.invocationcontext.tostring.html)