UNPKG

@loopback/docs

Version:
2,235 lines (1,457 loc) 126 kB
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/code-themes/sl-theme.css"> <link rel="stylesheet" href="css/main.css"> </head> <body> <div class="navbar navbar-inverse navbar-static-top" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/">docs.strongloop.com</a> </div> <div id="modules"></div> </div> <div class="row"> <div class="col-lg-3 column scroll-spy-target"> <ul class="nav nav-pills nav-stacked"> <div id="versions"></div> <li class="depth-3"> <a href="#Binding">Class: Binding</a> </li> <li class="depth-4"> <a href="#297">constructor</a> </li> <li class="depth-4"> <a href="#302">getValue</a> </li> <li class="depth-4"> <a href="#311">inScope</a> </li> <li class="depth-4"> <a href="#306">lock</a> </li> <li class="depth-4"> <a href="#308">tag</a> </li> <li class="depth-4"> <a href="#314">to</a> </li> <li class="depth-4"> <a href="#325">toClass</a> </li> <li class="depth-4"> <a href="#317">toDynamicValue</a> </li> <li class="depth-4"> <a href="#330">toJSON</a> </li> <li class="depth-4"> <a href="#322">toProvider</a> </li> <li class="depth-4"> <a href="#328">unlock</a> </li> <li class="depth-3"> <a href="#BindingKey">Class: BindingKey</a> </li> <li class="depth-4"> <a href="#12">deepProperty</a> </li> <li class="depth-4"> <a href="#10">toString</a> </li> <li class="depth-4"> <a href="#5">create</a> </li> <li class="depth-4"> <a href="#20">parseKeyWithPath</a> </li> <li class="depth-4"> <a href="#16">validate</a> </li> <li class="depth-3"> <a href="#BindingAddress">Type alias: BindingAddress</a> </li> <li class="depth-3"> <a href="#Context">Class: Context</a> </li> <li class="depth-4"> <a href="#169">constructor</a> </li> <li class="depth-4"> <a href="#173">bind</a> </li> <li class="depth-4"> <a href="#181">contains</a> </li> <li class="depth-4"> <a href="#193">find</a> </li> <li class="depth-4"> <a href="#203">findByTag</a> </li> <li class="depth-4"> <a href="#207">get</a> </li> <li class="depth-4"> <a href="#223">getBinding</a> </li> <li class="depth-4"> <a href="#189">getOwnerContext</a> </li> <li class="depth-4"> <a href="#215">getSync</a> </li> <li class="depth-4"> <a href="#233">getValueOrPromise</a> </li> <li class="depth-4"> <a href="#185">isBound</a> </li> <li class="depth-4"> <a href="#238">toJSON</a> </li> <li class="depth-4"> <a href="#177">unbind</a> </li> <li class="depth-3"> <a href="#73">Function: inject.context</a> </li> <li class="depth-3"> <a href="#61">Function: inject.getter</a> </li> <li class="depth-3"> <a href="#65">Function: inject.setter</a> </li> <li class="depth-3"> <a href="#69">Function: inject.tag</a> </li> <li class="depth-3"> <a href="#Injection">Interface: Injection</a> </li> <li class="depth-3"> <a href="#InjectionMetadata">Interface: InjectionMetadata</a> </li> <li class="depth-3"> <a href="#ResolverFunction">Interface: ResolverFunction</a> </li> <li class="depth-3"> <a href="#Getter">Type alias: Getter</a> </li> <li class="depth-3"> <a href="#Setter">Type alias: Setter</a> </li> <li class="depth-3"> <a href="#84">Function: describeInjectedArguments</a> </li> <li class="depth-3"> <a href="#93">Function: describeInjectedProperties</a> </li> <li class="depth-3"> <a href="#Provider">Interface: Provider</a> </li> <li class="depth-4"> <a href="#278">value</a> </li> <li class="depth-3"> <a href="#ResolutionSession">Class: ResolutionSession</a> </li> <li class="depth-4"> <a href="#144">getBindingPath</a> </li> <li class="depth-4"> <a href="#146">getInjectionPath</a> </li> <li class="depth-4"> <a href="#148">getResolutionPath</a> </li> <li class="depth-4"> <a href="#138">popBinding</a> </li> <li class="depth-4"> <a href="#128">popInjection</a> </li> <li class="depth-4"> <a href="#135">pushBinding</a> </li> <li class="depth-4"> <a href="#125">pushInjection</a> </li> <li class="depth-4"> <a href="#118">describeInjection</a> </li> <li class="depth-4"> <a href="#105">fork</a> </li> <li class="depth-4"> <a href="#108">runWithBinding</a> </li> <li class="depth-4"> <a href="#113">runWithInjection</a> </li> <li class="depth-3"> <a href="#BindingElement">Interface: BindingElement</a> </li> <li class="depth-3"> <a href="#InjectionElement">Interface: InjectionElement</a> </li> <li class="depth-3"> <a href="#ResolutionOptions">Interface: ResolutionOptions</a> </li> <li class="depth-3"> <a href="#ResolutionAction">Type alias: ResolutionAction</a> </li> <li class="depth-3"> <a href="#ResolutionElement">Type alias: ResolutionElement</a> </li> <li class="depth-3"> <a href="#244">Function: instantiateClass</a> </li> <li class="depth-3"> <a href="#264">Function: invokeMethod</a> </li> <li class="depth-3"> <a href="#257">Function: resolveInjectedArguments</a> </li> <li class="depth-3"> <a href="#270">Function: resolveInjectedProperties</a> </li> </ul> </div> <div class="col-lg-9 col-lg-offset-3 column" data-spy="scroll" data-target=".scroll-spy-target" data-offset="0"> <div class="readability"> <section class="code-doc "> <a name="Binding"></a> <h3 class="code-ref">Class: binding = new Binding()</h3> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </section> <section class="code-doc"> <div class="code-arguments-hdr">Properties</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">isLocked</strong> </td> <td class="code-arg-types"> <code>boolean</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code>string</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">scope</strong> </td> <td class="code-arg-types"> <code><a href="#BindingScope">BindingScope</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">tags</strong> </td> <td class="code-arg-types"> <code><a href="#Set">Set</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">type</strong> </td> <td class="code-arg-types"> <code><a href="#BindingType">BindingType</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">valueConstructor</strong> </td> <td class="code-arg-types"> <code><a href="#Constructor">Constructor</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> </table> </section> <section class="code-doc "> <a name="297"></a> <h4 class="code-ref">constructor(key: string, isLocked: boolean) : Binding</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code>string</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">isLocked</strong> </td> <td class="code-arg-types"> <code>boolean</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> </table> </section> <section class="code-doc "> <a name="302"></a> <h4 class="code-ref">getValue(ctx: <a href="#Context">Context</a>, session: <a href="#ResolutionSession">ResolutionSession</a>) : ValueOrPromise</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>This is an internal function optimized for performance. Users should use <code>@inject(key)</code> or <code>ctx.get(key)</code> instead.</p> </p> <p><p><p>Get the value bound to this key. Depending on <code>isSync</code>, this function returns either:</p></p> <p><ul></p> <p><li>the bound value</li></p> <p><li>a promise of the bound value</li> </ul></p> <p><p>Consumers wishing to consume sync values directly should use <code>isPromise</code> to check the type of the returned value to decide how to handle it.</p></p> <pre><code>const <span class="hljs-literal">result</span> = binding.getValue(ctx); <span class="hljs-keyword">if</span> (isPromise(<span class="hljs-literal">result</span>)) { <span class="hljs-literal">result</span>.<span class="hljs-keyword">then</span>(doSomething) } <span class="hljs-keyword">else</span> { doSomething(<span class="hljs-literal">result</span>); } </code></pre></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">ctx</strong> </td> <td class="code-arg-types"> <code><a href="#Context">Context</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>Context for the resolution</p> </p> </div> </td> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">session</strong> </td> <td class="code-arg-types"> <code><a href="#ResolutionSession">ResolutionSession</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>Optional session for binding and dependency resolution</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="311"></a> <h4 class="code-ref">inScope(scope: <a href="#BindingScope">BindingScope</a>) : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">scope</strong> </td> <td class="code-arg-types"> <code><a href="#BindingScope">BindingScope</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> </table> </section> <section class="code-doc "> <a name="306"></a> <h4 class="code-ref">lock() : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </section> <section class="code-doc "> <a name="308"></a> <h4 class="code-ref">tag(tagName: undefined) : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">tagName</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> </table> </section> <section class="code-doc "> <a name="314"></a> <h4 class="code-ref">to(value: T) : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Bind the key to a constant value. The value must be already available at binding time, it is not allowed to pass a Promise instance.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">value</strong> </td> <td class="code-arg-types"> <code>T</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>The bound value.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="325"></a> <h4 class="code-ref">toClass(ctor: <a href="#Constructor">Constructor</a>) : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Bind the key to an instance of the given class.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">ctor</strong> </td> <td class="code-arg-types"> <code><a href="#Constructor">Constructor</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>The class constructor to call. Any constructor arguments must be annotated with <code>@inject</code> so that we can resolve them from the context.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="317"></a> <h4 class="code-ref">toDynamicValue(factoryFn: () => ValueOrPromise) : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Bind the key to a computed (dynamic) value.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">factoryFn</strong> </td> <td class="code-arg-types"> <code>Function</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>The factory function creating the value. Both sync and async functions are supported.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="330"></a> <h4 class="code-ref">toJSON() : Object</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </section> <section class="code-doc "> <a name="322"></a> <h4 class="code-ref">toProvider(providerClass: <a href="#Constructor">Constructor</a>) : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Bind the key to a value computed by a Provider.</p> </p> <p><p><ul> <li>@example</li> </ul></p> <pre><code class="lang-ts">export class DateProvider implements Provider&lt;Date&gt; { constructor(@inject('stringDate') private param: String){} value(): Date { return new Date(param); } } </code></pre> </p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">providerClass</strong> </td> <td class="code-arg-types"> <code><a href="#Constructor">Constructor</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> </table> </section> <section class="code-doc "> <a name="328"></a> <h4 class="code-ref">unlock() : this</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </section> <section class="code-doc "> <a name="BindingKey"></a> <h3 class="code-ref">Class: bindingkey = new BindingKey()</h3> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </section> <section class="code-doc"> <div class="code-arguments-hdr">Properties</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">PROPERTY_SEPARATOR</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </td> </tr> </table> </section> <section class="code-doc "> <a name="12"></a> <h4 class="code-ref">deepProperty(propertyPath: string) : BindingKey</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Get a binding address for retrieving a deep property of the object bound to the current binding key.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">propertyPath</strong> </td> <td class="code-arg-types"> <code>string</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>A dot-separated path to a (deep) property, e.g. &quot;server.port&quot;.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="10"></a> <h4 class="code-ref">toString() : string</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> </section> <section class="code-doc "> <a name="5"></a> <h4 class="code-ref">create(key: string, propertyPath: undefined) : BindingKey</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Create a new key for a binding bound to a value of type <code>ValueType</code>.</p> </p> <p><p><p><strong>Example</strong></p></p> <pre><code class="lang-ts">BindingKey.create&lt;string&gt;('application.name'); BindingKey.create&lt;number&gt;('config', 'rest.port); BindingKey.create&lt;number&gt;('config#rest.port'); </code></pre> </p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code>string</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>The binding key. When propertyPath is not provided, the key is allowed to contain propertyPath as encoded via <code>BindingKey#toString()</code></p> </p> </div> </td> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">propertyPath</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>Optional path to a deep property of the bound value.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="20"></a> <h4 class="code-ref">parseKeyWithPath(keyWithPath: <a href="#BindingAddress">BindingAddress</a>) : BindingKey</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Parse a string containing both the binding key and the path to the deeply nested property to retrieve.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">keyWithPath</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>The key with an optional path, e.g. &quot;application.instance&quot; or &quot;config#rest.port&quot;.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="16"></a> <h4 class="code-ref">validate(key: <a href="#BindingAddress">BindingAddress</a>) : string</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Validate the binding key format. Please note that <code>#</code> is reserved. Returns a string representation of the binding key.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>Binding key, such as <code>a</code>, <code>a.b</code>, <code>a:b</code>, or <code>a/b</code></p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="Context"></a> <h3 class="code-ref">Class: context = new Context()</h3> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Context provides an implementation of Inversion of Control (IoC) container</p> </p> <p></p> </div> </section> <section class="code-doc"> <div class="code-arguments-hdr">Properties</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <a name=""></a> <strong class="code-arg-name">name</strong> </td> <td class="code-arg-types"> <code>string</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Name of the context</p> </p> <p></p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="169"></a> <h4 class="code-ref">constructor(_parent: undefined, name: undefined) : Context</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Create a new context</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">_parent</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>The optional parent context</p> </p> <p></p> </div> </td> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">name</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Create a new context</p> </p> <p></p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="173"></a> <h4 class="code-ref">bind(key: <a href="#BindingAddress">BindingAddress</a>) : Binding</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Create a binding with the given key in the context. If a locked binding already exists with the same key, an error will be thrown.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>Binding key</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="181"></a> <h4 class="code-ref">contains(key: <a href="#BindingAddress">BindingAddress</a>) : boolean</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Check if a binding exists with the given key in the local context without delegating to the parent context</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>Binding key</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="193"></a> <h4 class="code-ref">find(pattern: undefined) : </h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Find bindings using the key pattern</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">pattern</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p><p>A regexp or wildcard pattern with optional <code>*</code> and <code>?</code>. If it matches the binding key, the binding is included. For a wildcard:</p></p> <ul> <li><code>*</code> matches zero or more characters except <code>.</code> and <code>:</code></li> <li><code>?</code> matches exactly one character except <code>.</code> and <code>:</code></li> </ul> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="193"></a> <h4 class="code-ref">find(filter: (binding: <a href="#Readonly">Readonly</a>) => boolean) : </h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Find bindings using a filter function</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">filter</strong> </td> <td class="code-arg-types"> <code>Function</code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p>A function to test on the binding. It returns `true` to include the binding or `false` to exclude the binding. </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="203"></a> <h4 class="code-ref">findByTag(pattern: undefined) : </h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Find bindings using the tag pattern</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">pattern</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p><p>A regexp or wildcard pattern with optional <code>*</code> and <code>?</code>. If it matches one of the binding tags, the binding is included. For a wildcard:</p></p> <ul> <li><code>*</code> matches zero or more characters except <code>.</code> and <code>:</code></li> <li><code>?</code> matches exactly one character except <code>.</code> and <code>:</code></li> </ul> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="207"></a> <h4 class="code-ref">get(keyWithPath: <a href="#BindingAddress">BindingAddress</a>) : Promise</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Get the value bound to the given key, throw an error when no value was bound for the given key.</p> </p> <p></p> </div> Returns: <p><p>A promise of the bound value.</p> </p> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">keyWithPath</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p><p>The binding key, optionally suffixed with a path to the (deeply) nested property to retrieve.</p> </p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="207"></a> <h4 class="code-ref">get(keyWithPath: <a href="#BindingAddress">BindingAddress</a>, optionsOrSession: undefined) : Promise</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Get the value bound to the given key, optionally return a (deep) property of the bound value.</p> </p> <p></p> </div> Returns: <p><p>A promise of the bound value, or a promise of undefined when the optional binding was not found.</p> </p> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">keyWithPath</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p>The binding key, optionally suffixed with a path to the (deeply) nested property to retrieve.</p> </div> </td> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">optionsOrSession</strong> </td> <td class="code-arg-types"> <code></code> </td> <td class="code-arg-desc"> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p></p> <p>Options or session for resolution. An instance of `ResolutionSession` is accepted for backward compatibility.</p> </div> </td> </tr> </table> </section> <section class="code-doc "> <a name="223"></a> <h4 class="code-ref">getBinding(key: <a href="#BindingAddress">BindingAddress</a>) : Binding</h4> <!-- Used for displaying comments in Class, Interface, Properties Constructor, Function and Parameters of constructor or function. (Excludes Type alias). --> <div class="code-desc"> <p><p>Look up a binding by key in the context and its ancestors. If no matching binding is found, an error will be thrown.</p> </p> <p></p> </div> <div class="code-arguments-hdr">Arguments</div> <table class="params code-arguments"> <tr> <th class="hdr-name">Name</th> <th class="hdr-type">Type</th> <th class="hdr-desc">Description</th> </tr> <tr class="code-arg"> <td> <strong class="code-arg-name">key</strong> </td> <td class="code-arg-types"> <code><a href="#BindingAddress">BindingAddress</a></code> </td> <td class="code-ar