Files
TSinjex/types/types_Identifier.Identifier.html
2024-08-23 17:25:26 +00:00

23 lines
9.6 KiB
HTML

<!DOCTYPE html><html class="default" lang="en"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Identifier | ts-injex - v0.1.0</title><meta name="description" content="Documentation for ts-injex"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">ts-injex - v0.1.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../index.html">ts-injex</a></li><li><a href="../modules/types_Identifier.html">types/Identifier</a></li><li><a href="types_Identifier.Identifier.html">Identifier</a></li></ul><h1>Type Alias Identifier</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Identifier</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">symbol</span></div><div class="tsd-comment tsd-typography"><a id="md:the-dependency-identifier" class="tsd-anchor"></a><h2 class="tsd-anchor-link">The dependency identifier<a href="#md:the-dependency-identifier" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>You can use any string or Symbol as identifier. The identifier is used to
register a class in the TSinjex DI (Dependency Injection) container.
See <strong>Hierarchical identifiers</strong> for more information on <code>.</code> in identifiers.</p>
<a id="md:hierarchical-identifiers" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Hierarchical identifiers<a href="#md:hierarchical-identifiers" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>To create hierarchical identifiers, you can use a dot <code>.</code> as a separator.
E.g. <code>Parent.Child</code> or <code>Parent.Child.Grandchild</code>.</p>
<a id="md:merge-functionality" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Merge functionality<a href="#md:merge-functionality" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>You can merge multiple dependencies into one by resolving them with
a identifier that is a prefix of the actual identifiers.
E.g. <code>Parent</code> resolves <code>Parent.*</code> and returns a mixin of all children.
Merging will only work, if the main identifier is not registered.
Grandchildren are not included in the mixin but you can use something like
<code>Parent.Child.Grandchild</code> to merge all direct children of Grandchild,
e.g. <code>Parent.Child.Grandchild.*</code>.
If you don't want to allow merging, you must register the dependencies
with the full identifier. E.g. <code>Parent</code> or <code>Parent.Child.Grandchild</code>.</p>
<a id="md:naming-convention" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Naming convention<a href="#md:naming-convention" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><p>The name of a dependency should generally correspond to the interface that is implemented.
E.g. a class <code>ClassA</code> that implements the interface <code>IClassA</code> and is registered
as a dependent class is registered under the interface name <code>IClassA</code>.</p>
<p>The mixin parts of the class are registered under the interface name <code>IClassA.*</code>.
E.g. <code>IClassA.IClassZ</code>, <code>IClassA.IClassY</code>, etc.</p>
<a id="md:staticconstructor-identifier-naming" class="tsd-anchor"></a><h4 class="tsd-anchor-link">Static/Constructor Identifier naming<a href="#md:staticconstructor-identifier-naming" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>The identifier for a static or constructor dependency should be the same as the class name
postfixed with <code>_</code>. E.g. <code>IClassA_</code> for the the static or constructor interface of class <code>IClassA</code>.</p>
</div><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/PxaMMaxP/TSinjex/blob/099c8dbfa3c18825be9b07feded8c2ddf4cc9c1c/src/types/Identifier.ts#L35">src/types/Identifier.ts:35</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#md:the-dependency-identifier"><span>The dependency identifier</span></a><ul><li><a href="#md:hierarchical-identifiers"><span>Hierarchical identifiers</span></a></li><li><a href="#md:merge-functionality"><span>Merge functionality</span></a></li><li><a href="#md:naming-convention"><span>Naming convention</span></a></li><li><ul><li><a href="#md:staticconstructor-identifier-naming"><span>Static/<wbr/>Constructor <wbr/>Identifier naming</span></a></li></ul></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>ts-injex - v0.1.0</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer></footer><div class="overlay"></div></body></html>