mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
34 lines
33 KiB
HTML
34 lines
33 KiB
HTML
![]() |
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>EventEmitterReferencingAsyncResource | trilium</title><meta name="description" content="Documentation for trilium"/><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><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">trilium</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/Backend_Script_API.html">Backend Script API</a></li><li><a href="../modules/Backend_Script_API._internal_.html"><internal></a></li><li><a href="../modules/Backend_Script_API._internal_.EventEmitter.html">EventEmitter</a></li><li><a href="" aria-current="page">EventEmitterReferencingAsyncResource</a></li></ul><h1>Interface EventEmitterReferencingAsyncResource</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>The class <code>AsyncResource</code> is designed to be extended by the embedder's async
|
|||
|
resources. Using this, users can easily trigger the lifetime events of their
|
|||
|
own resources.</p>
|
|||
|
<p>The <code>init</code> hook will trigger when an <code>AsyncResource</code> is instantiated.</p>
|
|||
|
<p>The following is an overview of the <code>AsyncResource</code> API.</p>
|
|||
|
<pre><code class="js"><span class="hl-4">import</span><span class="hl-1"> { </span><span class="hl-5">AsyncResource</span><span class="hl-1">, </span><span class="hl-5">executionAsyncId</span><span class="hl-1"> } </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-3">'node:async_hooks'</span><span class="hl-1">;</span><br/><br/><span class="hl-6">// AsyncResource() is meant to be extended. Instantiating a</span><br/><span class="hl-6">// new AsyncResource() also triggers init. If triggerAsyncId is omitted then</span><br/><span class="hl-6">// async_hook.executionAsyncId() is used.</span><br/><span class="hl-2">const</span><span class="hl-1"> </span><span class="hl-7">asyncResource</span><span class="hl-1"> = </span><span class="hl-2">new</span><span class="hl-1"> </span><span class="hl-0">AsyncResource</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-5">type</span><span class="hl-1">, { </span><span class="hl-5">triggerAsyncId:</span><span class="hl-1"> </span><span class="hl-0">executionAsyncId</span><span class="hl-1">(), </span><span class="hl-5">requireManualDestroy:</span><span class="hl-1"> </span><span class="hl-2">false</span><span class="hl-1"> },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-6">// Run a function in the execution context of the resource. This will</span><br/><span class="hl-6">// * establish the context of the resource</span><br/><span class="hl-6">// * trigger the AsyncHooks before callbacks</span><br/><span class="hl-6">// * call the provided function `fn` with the supplied arguments</span><br/><span class="hl-6">// * trigger the AsyncHooks after callbacks</span><br/><span class="hl-6">// * restore the original execution context</span><br/><span class="hl-5">asyncResource</span><span class="hl-1">.</span><span class="hl-0">runInAsyncScope</span><span class="hl-1">(</span><span class="hl-5">fn</span><span class="hl-1">, </span><span class="hl-5">thisArg</span><span class="hl-1">, ...</span><span class="hl-5">args</span><span class="hl-1">);</span><br/><br/><span class="hl-6">// Call AsyncHooks destroy callbacks.</span><br/><span class="hl-5">asyncResource</span><span class="hl-1">.</span><span class="hl-0">emitDestroy</span><span class="hl-1">();</span><br/><br/><span class="hl-6">// Return the unique ID assigned to the AsyncResource instance.</span><br/><span class="hl-5">asyncResource</span><span class="hl-1">.</span><span class="hl-0">asyncId</span><span class="hl-1">();</span><br/><br/><span class="hl-6">// Return the trigger ID for the AsyncResource instance.</span><br/><span class="hl-5">asyncResource</span><span class="hl-1">.</span><span class="hl-0">triggerAsyncId</span><span class="hl-1">();</span>
|
|||
|
</code><button type="button">Copy</button></pre>
|
|||
|
|
|||
|
</div><div class="tsd-comment tsd-typography"></div></section><div class="tsd-signature"><span class="tsd-signature-keyword">interface</span> <span class="tsd-kind-interface">EventEmitterReferencingAsyncResource</span> <span class="tsd-signature-symbol">{</span><br/> <a class="tsd-kind-property" href="#eventemitter">eventEmitter</a><span class="tsd-signature-symbol">:</span> <a href="../classes/Backend_Script_API._internal_.EventEmitter.EventEmitterAsyncResource.html" class="tsd-signature-type tsd-kind-class">EventEmitterAsyncResource</a><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#asyncid-1">asyncId</a><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#bind-1">bind</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#emitdestroy-1">emitDestroy</a><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><span class="tsd-signature-symbol">;</span><br/> <a class="tsd-kind-call-signature" href="#runinasyncscope-1">runInAsyncScope</a><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">fn</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">this</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">thisArg</span><span class="tsd-signature-symbol">?:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">)</span><span class="ts
|
|||
|
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="#asyncid" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>async<wbr/>Id</span></a>
|
|||
|
<a href="#bind" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>bind</span></a>
|
|||
|
<a href="#emitdestroy" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>emit<wbr/>Destroy</span></a>
|
|||
|
<a href="#runinasyncscope" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>run<wbr/>In<wbr/>Async<wbr/>Scope</span></a>
|
|||
|
<a href="#triggerasyncid" class="tsd-index-link tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>trigger<wbr/>Async<wbr/>Id</span></a>
|
|||
|
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Properties</h2></summary><section><section class="tsd-panel tsd-member tsd-is-external"><h3 class="tsd-anchor-link" id="eventemitter"><code class="tsd-tag">Readonly</code><span>event<wbr/>Emitter</span><a href="#eventemitter" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">eventEmitter</span><span class="tsd-signature-symbol">:</span> <a href="../classes/Backend_Script_API._internal_.EventEmitter.EventEmitterAsyncResource.html" class="tsd-signature-type tsd-kind-class">EventEmitterAsyncResource</a></div><aside class="tsd-sources"><ul><li>Defined in node_modules/@types/node/events.d.ts:512</li></ul></aside></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Methods</h2></summary><section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="asyncid"><span>async<wbr/>Id</span><a href="#asyncid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="asyncid-1"><span class="tsd-kind-call-signature">asyncId</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#asyncid-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The unique <code>asyncId</code> assigned to the resource.</p>
|
|||
|
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="../classes/Backend_Script_API._internal_.AsyncResource.html">AsyncResource</a>.<a href="../classes/Backend_Script_API._internal_.AsyncResource.html#asyncid">asyncId</a></p><ul><li>Defined in node_modules/@types/node/async_hooks.d.ts:317</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="bind"><span>bind</span><a href="#bind" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="bind-1"><span class="tsd-kind-call-signature">bind</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fn</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a><a href="#bind-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Binds the given function to execute to this <code>AsyncResource</code>'s scope.</p>
|
|||
|
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="bindfunc"><span class="tsd-kind-type-parameter">Func</span> <span class="tsd-signature-keyword">extends</span> <span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <span class="tsd-signature-type">any</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a></span><div class="tsd-comment tsd-typography"><p>The function to bind to the current <code>AsyncResource</code>.</p>
|
|||
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="#bindfunc">Func</a></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since">Since<a href="#since" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v14.8.0, v12.19.0</p>
|
|||
|
</div></div><aside class="tsd-sources"><p>Inherited from <a href="../classes/Backend_Script_API._internal_.AsyncResource.html">AsyncResource</a>.<a href="../classes/Backend_Script_API._internal_.AsyncResource.html#bind">bind</a></p><ul><li>Defined in node_modules/@types/node/async_hooks.d.ts:290</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="emitdestroy"><span>emit<wbr/>Destroy</span><a href="#emitdestroy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="emitdestroy-1"><span class="tsd-kind-call-signature">emitDestroy</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">this</span><a href="#emitdestroy-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Call all <code>destroy</code> hooks. This should only ever be called once. An error will
|
|||
|
be thrown if it is called more than once. This <strong>must</strong> be manually called. If
|
|||
|
the resource is left to be collected by the GC then the <code>destroy</code> hooks will
|
|||
|
never be called.</p>
|
|||
|
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><p>A reference to <code>asyncResource</code>.</p>
|
|||
|
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="../classes/Backend_Script_API._internal_.AsyncResource.html">AsyncResource</a>.<a href="../classes/Backend_Script_API._internal_.AsyncResource.html#emitdestroy">emitDestroy</a></p><ul><li>Defined in node_modules/@types/node/async_hooks.d.ts:313</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="runinasyncscope"><span>run<wbr/>In<wbr/>Async<wbr/>Scope</span><a href="#runinasyncscope" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="runinasyncscope-1"><span class="tsd-kind-call-signature">runInAsyncScope</span><span class="tsd-signature-symbol"><</span><a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">fn</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">this</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">thisArg</span><span class="tsd-signature-symbol">?:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a><a href="#runinasyncscope-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Call the provided function with the provided arguments in the execution context
|
|||
|
of the async resource. This will establish the context, trigger the AsyncHooks
|
|||
|
before callbacks, call the function, trigger the AsyncHooks after callbacks, and
|
|||
|
then restore the original execution context.</p>
|
|||
|
</div><section class="tsd-panel"><h4>Type Parameters</h4><ul class="tsd-type-parameter-list"><li><span id="runinasyncscopethis"><span class="tsd-kind-type-parameter">This</span></span></li><li><span id="runinasyncscoperesult"><span class="tsd-kind-type-parameter">Result</span></span></li></ul></section><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fn</span>: <span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">this</span><span class="tsd-signature-symbol">:</span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a><span class="tsd-signature-symbol">,</span> <span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">)</span> <span class="tsd-signature-symbol">=></span> <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a></span><div class="tsd-comment tsd-typography"><p>The function to call in the execution context of this async resource.</p>
|
|||
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">thisArg</span>: <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscopethis">This</a></span><div class="tsd-comment tsd-typography"><p>The receiver to be used for the function call.</p>
|
|||
|
</div><div class="tsd-comment tsd-typography"></div></li><li><span><span class="tsd-signature-symbol">...</span><span class="tsd-kind-parameter">args</span>: <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">[]</span></span><div class="tsd-comment tsd-typography"><p>Optional arguments to pass to the function.</p>
|
|||
|
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a class="tsd-signature-type tsd-kind-type-parameter" href="#runinasyncscoperesult">Result</a></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-since"><h4 class="tsd-anchor-link" id="since-1">Since<a href="#since-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>v9.6.0</p>
|
|||
|
</div></div><aside class="tsd-sources"><p>Inherited from <a href="../classes/Backend_Script_API._internal_.AsyncResource.html">AsyncResource</a>.<a href="../classes/Backend_Script_API._internal_.AsyncResource.html#runinasyncscope">runInAsyncScope</a></p><ul><li>Defined in node_modules/@types/node/async_hooks.d.ts:301</li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member tsd-is-inherited tsd-is-external"><h3 class="tsd-anchor-link" id="triggerasyncid"><span>trigger<wbr/>Async<wbr/>Id</span><a href="#triggerasyncid" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures tsd-is-inherited tsd-is-external"><li class="tsd-is-inherited tsd-is-external"><div class="tsd-signature tsd-anchor-link" id="triggerasyncid-1"><span class="tsd-kind-call-signature">triggerAsyncId</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><a href="#triggerasyncid-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4><p>The same <code>triggerAsyncId</code> that is passed to the <code>AsyncResource</code> constructor.</p>
|
|||
|
<div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><p>Inherited from <a href="../classes/Backend_Script_API._internal_.AsyncResource.html">AsyncResource</a>.<a href="../classes/Backend_Script_API._internal_.AsyncResource.html#triggerasyncid">triggerAsyncId</a></p><ul><li>Defined in node_modules/@types/node/async_hooks.d.ts:321</li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>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-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"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Properties"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Properties</summary><div><a href="#eventemitter" class="tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Property"><use href="../assets/icons.svg#icon-1024"></use></svg><span>event<wbr/>Emitter</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#asyncid" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>async<wbr/>Id</span></a><a href="#bind" class="tsd-is-inherited tsd-is-external"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><
|