UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

129 lines (62 loc) 2.09 kB
--- lang: en title: 'API docs: context.invokemethod' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context permalink: /doc/en/lb4/apidocs.context.invokemethod.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [invokeMethod](./context.invokemethod.md) ## invokeMethod() function Invoke a method using dependency injection. Interceptors are invoked as part of the invocation. **Signature:** ```typescript export declare function invokeMethod(target: object, method: string, ctx: Context, nonInjectedArgs?: InvocationArgs, options?: InvocationOptions): ValueOrPromise<InvocationResult>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> target </td><td markdown="1"> object </td><td markdown="1"> Target of the method, it will be the class for a static method, and instance or class prototype for a prototype method </td></tr> <tr><td markdown="1"> method </td><td markdown="1"> string </td><td markdown="1"> Name of the method </td></tr> <tr><td markdown="1"> ctx </td><td markdown="1"> [Context](./context.context.md) </td><td markdown="1"> Context object </td></tr> <tr><td markdown="1"> nonInjectedArgs </td><td markdown="1"> [InvocationArgs](./context.invocationargs.md) </td><td markdown="1"> _(Optional)_ Optional array of args for non-injected parameters </td></tr> <tr><td markdown="1"> options </td><td markdown="1"> [InvocationOptions](./context.invocationoptions.md) </td><td markdown="1"> _(Optional)_ Options for the invocation </td></tr> </tbody></table> **Returns:** [ValueOrPromise](./context.valueorpromise.md)<!-- -->&lt;[InvocationResult](./context.invocationresult.md)<!-- -->&gt;