UNPKG

@loopback/docs

Version:

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

81 lines (41 loc) 1.41 kB
--- lang: en title: 'API docs: context.context.findorcreatebinding' 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.context.findorcreatebinding.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [Context](./context.context.md) &gt; [findOrCreateBinding](./context.context.findorcreatebinding.md) ## Context.findOrCreateBinding() method Find or create a binding for the given key **Signature:** ```typescript findOrCreateBinding<T>(key: BindingAddress<T>, policy?: BindingCreationPolicy): Binding<T>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td markdown="1"> key </td><td markdown="1"> [BindingAddress](./context.bindingaddress.md)<!-- -->&lt;T&gt; </td><td markdown="1"> Binding address </td></tr> <tr><td markdown="1"> policy </td><td markdown="1"> [BindingCreationPolicy](./context.bindingcreationpolicy.md) </td><td markdown="1"> _(Optional)_ Binding creation policy </td></tr> </tbody></table> **Returns:** [Binding](./context.binding.md)<!-- -->&lt;T&gt;