2 <html class=
"default no-js">
5 <meta http-equiv=
"X-UA-Compatible" content=
"IE=edge">
6 <title>ThreadWorker | poolifier
</title>
7 <meta name=
"description" content=
"Documentation for poolifier">
8 <meta name=
"viewport" content=
"width=device-width, initial-scale=1">
9 <link rel=
"stylesheet" href=
"../assets/css/main.css">
10 <script async
src=
"../assets/js/search.js" id=
"search-script"></script>
14 <div class=
"tsd-page-toolbar">
15 <div class=
"container">
16 <div class=
"table-wrap">
17 <div class=
"table-cell" id=
"tsd-search" data-index=
"../assets/js/search.json" data-base=
"..">
19 <label for=
"tsd-search-field" class=
"tsd-widget search no-caption">Search
</label>
20 <input id=
"tsd-search-field" type=
"text" />
23 <li class=
"state loading">Preparing search index...
</li>
24 <li class=
"state failure">The search index is not available
</li>
26 <a href=
"../index.html" class=
"title">poolifier
</a>
28 <div class=
"table-cell" id=
"tsd-widgets">
30 <a href=
"#" class=
"tsd-widget options no-caption" data-toggle=
"options">Options
</a>
31 <div class=
"tsd-filter-group">
32 <div class=
"tsd-select" id=
"tsd-filter-visibility">
33 <span class=
"tsd-select-label">All
</span>
34 <ul class=
"tsd-select-list">
35 <li data-value=
"public">Public
</li>
36 <li data-value=
"protected">Public/Protected
</li>
37 <li data-value=
"private" class=
"selected">All
</li>
40 <input type=
"checkbox" id=
"tsd-filter-inherited" checked
/>
41 <label class=
"tsd-widget" for=
"tsd-filter-inherited">Inherited
</label>
42 <input type=
"checkbox" id=
"tsd-filter-externals" checked
/>
43 <label class=
"tsd-widget" for=
"tsd-filter-externals">Externals
</label>
46 <a href=
"#" class=
"tsd-widget menu no-caption" data-toggle=
"menu">Menu
</a>
51 <div class=
"tsd-page-title">
52 <div class=
"container">
53 <ul class=
"tsd-breadcrumb">
55 <a href=
"../index.html">poolifier
</a>
58 <a href=
"threadworker.html">ThreadWorker
</a>
61 <h1>Class ThreadWorker
<Data, Response
></h1>
65 <div class=
"container container-main">
67 <div class=
"col-8 col-content">
68 <section class=
"tsd-panel tsd-comment">
69 <div class=
"tsd-comment tsd-typography">
71 <p>A thread worker used by a poolifier
<code>ThreadPool
</code>.
</p>
73 <p>When this worker is inactive for more than the given
<code>maxInactiveTime
</code>,
74 it will send a termination request to its main thread.
</p>
75 <p>If you use a
<code>DynamicThreadPool
</code> the extra workers that were created will be terminated,
76 but the minimum number of workers will be guaranteed.
</p>
77 <dl class=
"tsd-comment-tags">
79 <dd><p><a href=
"https://github.com/pioardi">Alessandro Pio Ardizio
</a></p>
87 <section class=
"tsd-panel tsd-type-parameters">
88 <h3>Type parameters
</h3>
89 <ul class=
"tsd-type-parameters">
91 <h4>Data =
<span class=
"tsd-signature-type">unknown
</span></h4>
92 <div class=
"tsd-comment tsd-typography">
94 <p>Type of data this worker receives from pool
's execution. This can only be serializable data.
</p>
99 <h4>Response =
<span class=
"tsd-signature-type">unknown
</span></h4>
100 <div class=
"tsd-comment tsd-typography">
102 <p>Type of response the worker sends back to the main thread. This can only be serializable data.
</p>
108 <section class=
"tsd-panel tsd-hierarchy">
110 <ul class=
"tsd-hierarchy">
112 <a href=
"abstractworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Class">AbstractWorker
</a><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">MessagePort
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span>
113 <ul class=
"tsd-hierarchy">
115 <span class=
"target">ThreadWorker
</span>
121 <section class=
"tsd-panel-group tsd-index-group">
123 <section class=
"tsd-panel tsd-index-panel">
124 <div class=
"tsd-index-content">
125 <section class=
"tsd-index-section ">
126 <h3>Constructors
</h3>
127 <ul class=
"tsd-index-list">
128 <li class=
"tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited"><a href=
"threadworker.html#constructor" class=
"tsd-kind-icon">constructor
</a></li>
131 <section class=
"tsd-index-section ">
133 <ul class=
"tsd-index-list">
134 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#async" class=
"tsd-kind-icon">async
</a></li>
135 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#interval" class=
"tsd-kind-icon">interval
</a></li>
136 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#killbehavior" class=
"tsd-kind-icon">kill
<wbr>Behavior
</a></li>
137 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#lasttask" class=
"tsd-kind-icon">last
<wbr>Task
</a></li>
138 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#mainworker" class=
"tsd-kind-icon">main
<wbr>Worker
</a></li>
139 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#maxinactivetime" class=
"tsd-kind-icon">max
<wbr>Inactive
<wbr>Time
</a></li>
140 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><a href=
"threadworker.html#opts" class=
"tsd-kind-icon">opts
</a></li>
143 <section class=
"tsd-index-section ">
145 <ul class=
"tsd-index-list">
146 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href=
"threadworker.html#asyncid" class=
"tsd-kind-icon">async
<wbr>Id
</a></li>
147 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"><a href=
"threadworker.html#bind" class=
"tsd-kind-icon">bind
</a></li>
148 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#checkalive" class=
"tsd-kind-icon">check
<wbr>Alive
</a></li>
149 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href=
"threadworker.html#emitdestroy" class=
"tsd-kind-icon">emit
<wbr>Destroy
</a></li>
150 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#getmainworker" class=
"tsd-kind-icon">get
<wbr>Main
<wbr>Worker
</a></li>
151 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#handleerror" class=
"tsd-kind-icon">handle
<wbr>Error
</a></li>
152 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#run" class=
"tsd-kind-icon">run
</a></li>
153 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected"><a href=
"threadworker.html#runasync" class=
"tsd-kind-icon">run
<wbr>Async
</a></li>
154 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external"><a href=
"threadworker.html#runinasyncscope" class=
"tsd-kind-icon">run
<wbr>InAsync
<wbr>Scope
</a></li>
155 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected"><a href=
"threadworker.html#sendtomainworker" class=
"tsd-kind-icon">send
<wbr>ToMain
<wbr>Worker
</a></li>
156 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external"><a href=
"threadworker.html#triggerasyncid" class=
"tsd-kind-icon">trigger
<wbr>Async
<wbr>Id
</a></li>
157 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external"><a href=
"threadworker.html#bind-1" class=
"tsd-kind-icon">bind
</a></li>
163 <section class=
"tsd-panel-group tsd-member-group ">
164 <h2>Constructors
</h2>
165 <section class=
"tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited">
166 <a name=
"constructor" class=
"tsd-anchor"></a>
168 <ul class=
"tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited">
169 <li class=
"tsd-signature tsd-kind-icon">new
<wbr>Thread
<wbr>Worker
<Data, Response
><span class=
"tsd-signature-symbol">(
</span>fn
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">Response
</span>, opts
<span class=
"tsd-signature-symbol">?:
</span><a href=
"../interfaces/workeroptions.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">WorkerOptions
</a><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><a href=
"threadworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Class">ThreadWorker
</a><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span></li>
171 <ul class=
"tsd-descriptions">
172 <li class=
"tsd-description">
173 <aside class=
"tsd-sources">
174 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#constructor">constructor
</a></p>
176 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/thread-worker.ts#L25">src/worker/thread-worker.ts:
25</a></li>
179 <div class=
"tsd-comment tsd-typography">
181 <p>Constructs a new poolifier thread worker.
</p>
184 <h4 class=
"tsd-type-parameters-title">Type parameters
</h4>
185 <ul class=
"tsd-type-parameters">
187 <h4>Data =
<span class=
"tsd-signature-type">unknown
</span></h4>
190 <h4>Response =
<span class=
"tsd-signature-type">unknown
</span></h4>
193 <h4 class=
"tsd-parameters-title">Parameters
</h4>
194 <ul class=
"tsd-parameters">
196 <h5>fn:
<span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">Response
</span></h5>
197 <div class=
"tsd-comment tsd-typography">
198 <p>Function processed by the worker when the pool
's
<code>execution
</code> function is invoked.
</p>
200 <ul class=
"tsd-parameters">
201 <li class=
"tsd-parameter-signature">
202 <ul class=
"tsd-signatures tsd-kind-type-literal">
203 <li class=
"tsd-signature tsd-kind-icon"><span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Response
</span></li>
205 <ul class=
"tsd-descriptions">
206 <li class=
"tsd-description">
207 <h4 class=
"tsd-parameters-title">Parameters
</h4>
208 <ul class=
"tsd-parameters">
210 <h5>data:
<span class=
"tsd-signature-type">Data
</span></h5>
213 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Response
</span></h4>
220 <h5>opts:
<a href=
"../interfaces/workeroptions.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">WorkerOptions
</a><span class=
"tsd-signature-symbol"> = ...
</span></h5>
221 <div class=
"tsd-comment tsd-typography">
222 <p>Options for the worker.
</p>
226 <h4 class=
"tsd-returns-title">Returns
<a href=
"threadworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Class">ThreadWorker
</a><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span></h4>
231 <section class=
"tsd-panel-group tsd-member-group ">
233 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
234 <a name=
"async" class=
"tsd-anchor"></a>
235 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> <span class=
"tsd-flag ts-flagReadonly">Readonly
</span> async
</h3>
236 <div class=
"tsd-signature tsd-kind-icon">async
<span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">boolean
</span></div>
237 <aside class=
"tsd-sources">
238 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#async">async
</a></p>
240 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L34">src/worker/abstract-worker.ts:
34</a></li>
243 <div class=
"tsd-comment tsd-typography">
245 <p>Whether the worker is working asynchronously or not.
</p>
249 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
250 <a name=
"interval" class=
"tsd-anchor"></a>
251 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> <span class=
"tsd-flag ts-flagOptional">Optional
</span> <span class=
"tsd-flag ts-flagReadonly">Readonly
</span> interval
</h3>
252 <div class=
"tsd-signature tsd-kind-icon">interval
<span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">undefined
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">Timeout
</span></div>
253 <aside class=
"tsd-sources">
254 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#interval">interval
</a></p>
256 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L42">src/worker/abstract-worker.ts:
42</a></li>
259 <div class=
"tsd-comment tsd-typography">
261 <p>Handler ID of the
<code>interval
</code> alive check.
</p>
265 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
266 <a name=
"killbehavior" class=
"tsd-anchor"></a>
267 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> <span class=
"tsd-flag ts-flagReadonly">Readonly
</span> kill
<wbr>Behavior
</h3>
268 <div class=
"tsd-signature tsd-kind-icon">kill
<wbr>Behavior
<span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">"SOFT
"</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">"HARD
"</span></div>
269 <aside class=
"tsd-sources">
270 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#killbehavior">killBehavior
</a></p>
272 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L30">src/worker/abstract-worker.ts:
30</a></li>
275 <div class=
"tsd-comment tsd-typography">
277 <p>The kill behavior set as option on the Worker constructor or a default value.
</p>
281 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
282 <a name=
"lasttask" class=
"tsd-anchor"></a>
283 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> last
<wbr>Task
</h3>
284 <div class=
"tsd-signature tsd-kind-icon">last
<wbr>Task
<span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">number
</span></div>
285 <aside class=
"tsd-sources">
286 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#lasttask">lastTask
</a></p>
288 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L38">src/worker/abstract-worker.ts:
38</a></li>
291 <div class=
"tsd-comment tsd-typography">
293 <p>Timestamp of the last task processed by this worker.
</p>
297 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
298 <a name=
"mainworker" class=
"tsd-anchor"></a>
299 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> <span class=
"tsd-flag ts-flagOptional">Optional
</span> main
<wbr>Worker
</h3>
300 <div class=
"tsd-signature tsd-kind-icon">main
<wbr>Worker
<span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">undefined
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">null
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">MessagePort
</span></div>
301 <aside class=
"tsd-sources">
302 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#mainworker">mainWorker
</a></p>
305 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
306 <a name=
"maxinactivetime" class=
"tsd-anchor"></a>
307 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> <span class=
"tsd-flag ts-flagReadonly">Readonly
</span> max
<wbr>Inactive
<wbr>Time
</h3>
308 <div class=
"tsd-signature tsd-kind-icon">max
<wbr>Inactive
<wbr>Time
<span class=
"tsd-signature-symbol">:
</span> <span class=
"tsd-signature-type">number
</span></div>
309 <aside class=
"tsd-sources">
310 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#maxinactivetime">maxInactiveTime
</a></p>
312 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L26">src/worker/abstract-worker.ts:
26</a></li>
315 <div class=
"tsd-comment tsd-typography">
317 <p>The maximum time to keep this worker alive while idle. The pool automatically checks and terminates this worker when the time expires.
</p>
321 <section class=
"tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
322 <a name=
"opts" class=
"tsd-anchor"></a>
323 <h3><span class=
"tsd-flag ts-flagReadonly">Readonly
</span> opts
</h3>
324 <div class=
"tsd-signature tsd-kind-icon">opts
<span class=
"tsd-signature-symbol">:
</span> <a href=
"../interfaces/workeroptions.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">WorkerOptions
</a><span class=
"tsd-signature-symbol"> = ...
</span></div>
325 <aside class=
"tsd-sources">
326 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#opts">opts
</a></p>
330 <section class=
"tsd-panel-group tsd-member-group ">
332 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
333 <a name=
"asyncid" class=
"tsd-anchor"></a>
334 <h3>async
<wbr>Id
</h3>
335 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
336 <li class=
"tsd-signature tsd-kind-icon">async
<wbr>Id
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">number
</span></li>
338 <ul class=
"tsd-descriptions">
339 <li class=
"tsd-description">
340 <aside class=
"tsd-sources">
341 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#asyncid">asyncId
</a></p>
343 <li>Defined in node_modules/@types/node/async_hooks.d.ts:
159</li>
346 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">number
</span></h4>
347 <p>the unique ID assigned to this AsyncResource instance.
</p>
351 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external">
352 <a name=
"bind" class=
"tsd-anchor"></a>
354 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external">
355 <li class=
"tsd-signature tsd-kind-icon">bind
<Func
><span class=
"tsd-signature-symbol">(
</span>fn
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Func
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Func
</span><span class=
"tsd-signature-symbol"> & </span><span class=
"tsd-signature-symbol">{
</span>asyncResource
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">AsyncResource
</span><span class=
"tsd-signature-symbol"> }
</span></li>
357 <ul class=
"tsd-descriptions">
358 <li class=
"tsd-description">
359 <aside class=
"tsd-sources">
360 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#bind">bind
</a></p>
362 <li>Defined in node_modules/@types/node/async_hooks.d.ts:
136</li>
365 <div class=
"tsd-comment tsd-typography">
367 <p>Binds the given function to execute to this
<code>AsyncResource
</code>'s scope.
</p>
370 <h4 class=
"tsd-type-parameters-title">Type parameters
</h4>
371 <ul class=
"tsd-type-parameters">
373 <h4>Func
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span>args
<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></h4>
376 <h4 class=
"tsd-parameters-title">Parameters
</h4>
377 <ul class=
"tsd-parameters">
379 <h5>fn:
<span class=
"tsd-signature-type">Func
</span></h5>
380 <div class=
"tsd-comment tsd-typography">
381 <p>The function to bind to the current
<code>AsyncResource
</code>.
</p>
385 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Func
</span><span class=
"tsd-signature-symbol"> & </span><span class=
"tsd-signature-symbol">{
</span>asyncResource
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">AsyncResource
</span><span class=
"tsd-signature-symbol"> }
</span></h4>
389 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
390 <a name=
"checkalive" class=
"tsd-anchor"></a>
391 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> check
<wbr>Alive
</h3>
392 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
393 <li class=
"tsd-signature tsd-kind-icon">check
<wbr>Alive
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
395 <ul class=
"tsd-descriptions">
396 <li class=
"tsd-description">
397 <aside class=
"tsd-sources">
398 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#checkalive">checkAlive
</a></p>
400 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L130">src/worker/abstract-worker.ts:
130</a></li>
403 <div class=
"tsd-comment tsd-typography">
405 <p>Check to see if the worker should be terminated, because its living too long.
</p>
408 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
412 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
413 <a name=
"emitdestroy" class=
"tsd-anchor"></a>
414 <h3>emit
<wbr>Destroy
</h3>
415 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
416 <li class=
"tsd-signature tsd-kind-icon">emit
<wbr>Destroy
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
418 <ul class=
"tsd-descriptions">
419 <li class=
"tsd-description">
420 <aside class=
"tsd-sources">
421 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#emitdestroy">emitDestroy
</a></p>
423 <li>Defined in node_modules/@types/node/async_hooks.d.ts:
154</li>
426 <div class=
"tsd-comment tsd-typography">
428 <p>Call AsyncHooks destroy callbacks.
</p>
431 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
435 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
436 <a name=
"getmainworker" class=
"tsd-anchor"></a>
437 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> get
<wbr>Main
<wbr>Worker
</h3>
438 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
439 <li class=
"tsd-signature tsd-kind-icon">get
<wbr>Main
<wbr>Worker
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">MessagePort
</span></li>
441 <ul class=
"tsd-descriptions">
442 <li class=
"tsd-description">
443 <aside class=
"tsd-sources">
444 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#getmainworker">getMainWorker
</a></p>
446 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L113">src/worker/abstract-worker.ts:
113</a></li>
449 <div class=
"tsd-comment tsd-typography">
451 <p>Returns the main worker.
</p>
454 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">MessagePort
</span></h4>
455 <p>Reference to the main worker.
</p>
459 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
460 <a name=
"handleerror" class=
"tsd-anchor"></a>
461 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> handle
<wbr>Error
</h3>
462 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
463 <li class=
"tsd-signature tsd-kind-icon">handle
<wbr>Error
<span class=
"tsd-signature-symbol">(
</span>e
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">Error
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">string
</span></li>
465 <ul class=
"tsd-descriptions">
466 <li class=
"tsd-description">
467 <aside class=
"tsd-sources">
468 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#handleerror">handleError
</a></p>
470 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L142">src/worker/abstract-worker.ts:
142</a></li>
473 <div class=
"tsd-comment tsd-typography">
475 <p>Handle an error and convert it to a string so it can be sent back to the main worker.
</p>
478 <h4 class=
"tsd-parameters-title">Parameters
</h4>
479 <ul class=
"tsd-parameters">
481 <h5>e:
<span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol"> |
</span><span class=
"tsd-signature-type">Error
</span></h5>
482 <div class=
"tsd-comment tsd-typography">
483 <p>The error raised by the worker.
</p>
487 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">string
</span></h4>
488 <p>Message of the error.
</p>
492 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
493 <a name=
"run" class=
"tsd-anchor"></a>
494 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> run
</h3>
495 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
496 <li class=
"tsd-signature tsd-kind-icon">run
<span class=
"tsd-signature-symbol">(
</span>fn
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">Response
</span>, value
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">MessageValue
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">unknown
</span><span class=
"tsd-signature-symbol">></span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
498 <ul class=
"tsd-descriptions">
499 <li class=
"tsd-description">
500 <aside class=
"tsd-sources">
501 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#run">run
</a></p>
503 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L152">src/worker/abstract-worker.ts:
152</a></li>
506 <div class=
"tsd-comment tsd-typography">
508 <p>Run the given function synchronously.
</p>
511 <h4 class=
"tsd-parameters-title">Parameters
</h4>
512 <ul class=
"tsd-parameters">
514 <h5>fn:
<span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">Response
</span></h5>
515 <div class=
"tsd-comment tsd-typography">
516 <p>Function that will be executed.
</p>
518 <ul class=
"tsd-parameters">
519 <li class=
"tsd-parameter-signature">
520 <ul class=
"tsd-signatures tsd-kind-type-literal">
521 <li class=
"tsd-signature tsd-kind-icon"><span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Response
</span></li>
523 <ul class=
"tsd-descriptions">
524 <li class=
"tsd-description">
525 <h4 class=
"tsd-parameters-title">Parameters
</h4>
526 <ul class=
"tsd-parameters">
528 <h5><span class=
"tsd-flag ts-flagOptional">Optional
</span> data:
<span class=
"tsd-signature-type">Data
</span></h5>
531 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Response
</span></h4>
538 <h5>value:
<span class=
"tsd-signature-type">MessageValue
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">unknown
</span><span class=
"tsd-signature-symbol">></span></h5>
539 <div class=
"tsd-comment tsd-typography">
540 <p>Input data for the given function.
</p>
544 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
548 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
549 <a name=
"runasync" class=
"tsd-anchor"></a>
550 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> run
<wbr>Async
</h3>
551 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
552 <li class=
"tsd-signature tsd-kind-icon">run
<wbr>Async
<span class=
"tsd-signature-symbol">(
</span>fn
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span>, value
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">MessageValue
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">unknown
</span><span class=
"tsd-signature-symbol">></span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
554 <ul class=
"tsd-descriptions">
555 <li class=
"tsd-description">
556 <aside class=
"tsd-sources">
557 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#runasync">runAsync
</a></p>
559 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/abstract-worker.ts#L173">src/worker/abstract-worker.ts:
173</a></li>
562 <div class=
"tsd-comment tsd-typography">
564 <p>Run the given function asynchronously.
</p>
567 <h4 class=
"tsd-parameters-title">Parameters
</h4>
568 <ul class=
"tsd-parameters">
570 <h5>fn:
<span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol"> =
> </span><span class=
"tsd-signature-type">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span></h5>
571 <div class=
"tsd-comment tsd-typography">
572 <p>Function that will be executed.
</p>
574 <ul class=
"tsd-parameters">
575 <li class=
"tsd-parameter-signature">
576 <ul class=
"tsd-signatures tsd-kind-type-literal">
577 <li class=
"tsd-signature tsd-kind-icon"><span class=
"tsd-signature-symbol">(
</span>data
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span></li>
579 <ul class=
"tsd-descriptions">
580 <li class=
"tsd-description">
581 <h4 class=
"tsd-parameters-title">Parameters
</h4>
582 <ul class=
"tsd-parameters">
584 <h5><span class=
"tsd-flag ts-flagOptional">Optional
</span> data:
<span class=
"tsd-signature-type">Data
</span></h5>
587 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Promise
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">></span></h4>
594 <h5>value:
<span class=
"tsd-signature-type">MessageValue
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Data
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">unknown
</span><span class=
"tsd-signature-symbol">></span></h5>
595 <div class=
"tsd-comment tsd-typography">
596 <p>Input data for the given function.
</p>
600 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
604 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external">
605 <a name=
"runinasyncscope" class=
"tsd-anchor"></a>
606 <h3>run
<wbr>InAsync
<wbr>Scope
</h3>
607 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external">
608 <li class=
"tsd-signature tsd-kind-icon">run
<wbr>InAsync
<wbr>Scope
<This, Result
><span class=
"tsd-signature-symbol">(
</span>fn
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span>args
<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">Result
</span>, thisArg
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">This
</span>,
<span class=
"tsd-signature-symbol">...
</span>args
<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">Result
</span></li>
610 <ul class=
"tsd-descriptions">
611 <li class=
"tsd-description">
612 <aside class=
"tsd-sources">
613 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#runinasyncscope">runInAsyncScope
</a></p>
615 <li>Defined in node_modules/@types/node/async_hooks.d.ts:
149</li>
618 <div class=
"tsd-comment tsd-typography">
620 <p>Call the provided function with the provided arguments in the
621 execution context of the async resource. This will establish the
622 context, trigger the AsyncHooks before callbacks, call the function,
623 trigger the AsyncHooks after callbacks, and then restore the original
624 execution context.
</p>
627 <h4 class=
"tsd-type-parameters-title">Type parameters
</h4>
628 <ul class=
"tsd-type-parameters">
636 <h4 class=
"tsd-parameters-title">Parameters
</h4>
637 <ul class=
"tsd-parameters">
639 <h5>fn:
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span>args
<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">Result
</span></h5>
640 <div class=
"tsd-comment tsd-typography">
641 <p>The function to call in the execution context of this
644 <ul class=
"tsd-parameters">
645 <li class=
"tsd-parameter-signature">
646 <ul class=
"tsd-signatures tsd-kind-type-literal tsd-is-external">
647 <li class=
"tsd-signature tsd-kind-icon"><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span>args
<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">Result
</span></li>
649 <ul class=
"tsd-descriptions">
650 <li class=
"tsd-description">
651 <h4 class=
"tsd-parameters-title">Parameters
</h4>
652 <ul class=
"tsd-parameters">
654 <h5><span class=
"tsd-flag ts-flagRest">Rest
</span> <span class=
"tsd-signature-symbol">...
</span>args:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5>
657 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Result
</span></h4>
664 <h5><span class=
"tsd-flag ts-flagOptional">Optional
</span> thisArg:
<span class=
"tsd-signature-type">This
</span></h5>
665 <div class=
"tsd-comment tsd-typography">
666 <p>The receiver to be used for the function call.
</p>
670 <h5><span class=
"tsd-flag ts-flagRest">Rest
</span> <span class=
"tsd-signature-symbol">...
</span>args:
<span class=
"tsd-signature-type">any
</span><span class=
"tsd-signature-symbol">[]
</span></h5>
671 <div class=
"tsd-comment tsd-typography">
672 <p>Optional arguments to pass to the function.
</p>
676 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Result
</span></h4>
680 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected">
681 <a name=
"sendtomainworker" class=
"tsd-anchor"></a>
682 <h3><span class=
"tsd-flag ts-flagProtected">Protected
</span> send
<wbr>ToMain
<wbr>Worker
</h3>
683 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected">
684 <li class=
"tsd-signature tsd-kind-icon">send
<wbr>ToMain
<wbr>Worker
<span class=
"tsd-signature-symbol">(
</span>message
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">MessageValue
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">unknown
</span><span class=
"tsd-signature-symbol">></span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">void
</span></li>
686 <ul class=
"tsd-descriptions">
687 <li class=
"tsd-description">
688 <aside class=
"tsd-sources">
689 <p>Overrides
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#sendtomainworker">sendToMainWorker
</a></p>
691 <li>Defined in
<a href=
"https://github.com/pioardi/poolifier/blob/36b71cf/src/worker/thread-worker.ts#L36">src/worker/thread-worker.ts:
36</a></li>
694 <h4 class=
"tsd-parameters-title">Parameters
</h4>
695 <ul class=
"tsd-parameters">
697 <h5>message:
<span class=
"tsd-signature-type">MessageValue
</span><span class=
"tsd-signature-symbol"><</span><span class=
"tsd-signature-type">Response
</span><span class=
"tsd-signature-symbol">,
</span><span class=
"tsd-signature-type">unknown
</span><span class=
"tsd-signature-symbol">></span></h5>
700 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
704 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
705 <a name=
"triggerasyncid" class=
"tsd-anchor"></a>
706 <h3>trigger
<wbr>Async
<wbr>Id
</h3>
707 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
708 <li class=
"tsd-signature tsd-kind-icon">trigger
<wbr>Async
<wbr>Id
<span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">number
</span></li>
710 <ul class=
"tsd-descriptions">
711 <li class=
"tsd-description">
712 <aside class=
"tsd-sources">
713 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#triggerasyncid">triggerAsyncId
</a></p>
715 <li>Defined in node_modules/@types/node/async_hooks.d.ts:
164</li>
718 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">number
</span></h4>
719 <p>the trigger ID for this AsyncResource instance.
</p>
723 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external">
724 <a name=
"bind-1" class=
"tsd-anchor"></a>
725 <h3><span class=
"tsd-flag ts-flagStatic">Static
</span> bind
</h3>
726 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external">
727 <li class=
"tsd-signature tsd-kind-icon">bind
<Func
><span class=
"tsd-signature-symbol">(
</span>fn
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Func
</span>, type
<span class=
"tsd-signature-symbol">?:
</span><span class=
"tsd-signature-type">string
</span><span class=
"tsd-signature-symbol">)
</span><span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">Func
</span><span class=
"tsd-signature-symbol"> & </span><span class=
"tsd-signature-symbol">{
</span>asyncResource
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">AsyncResource
</span><span class=
"tsd-signature-symbol"> }
</span></li>
729 <ul class=
"tsd-descriptions">
730 <li class=
"tsd-description">
731 <aside class=
"tsd-sources">
732 <p>Inherited from
<a href=
"abstractworker.html">AbstractWorker
</a>.
<a href=
"abstractworker.html#bind-1">bind
</a></p>
734 <li>Defined in node_modules/@types/node/async_hooks.d.ts:
130</li>
737 <div class=
"tsd-comment tsd-typography">
739 <p>Binds the given function to the current execution context.
</p>
742 <h4 class=
"tsd-type-parameters-title">Type parameters
</h4>
743 <ul class=
"tsd-type-parameters">
745 <h4>Func
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-symbol">(
</span><span class=
"tsd-signature-symbol">...
</span>args
<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></h4>
748 <h4 class=
"tsd-parameters-title">Parameters
</h4>
749 <ul class=
"tsd-parameters">
751 <h5>fn:
<span class=
"tsd-signature-type">Func
</span></h5>
752 <div class=
"tsd-comment tsd-typography">
753 <p>The function to bind to the current execution context.
</p>
757 <h5><span class=
"tsd-flag ts-flagOptional">Optional
</span> type:
<span class=
"tsd-signature-type">string
</span></h5>
758 <div class=
"tsd-comment tsd-typography">
759 <p>An optional name to associate with the underlying
<code>AsyncResource
</code>.
</p>
763 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">Func
</span><span class=
"tsd-signature-symbol"> & </span><span class=
"tsd-signature-symbol">{
</span>asyncResource
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">AsyncResource
</span><span class=
"tsd-signature-symbol"> }
</span></h4>
769 <div class=
"col-4 col-menu menu-sticky-wrap menu-highlight">
770 <nav class=
"tsd-navigation primary">
773 <a href=
"../index.html">Exports
</a>
777 <nav class=
"tsd-navigation secondary menu-sticky">
778 <ul class=
"before-current">
779 <li class=
" tsd-kind-class tsd-has-type-parameter">
780 <a href=
"abstractworker.html" class=
"tsd-kind-icon">Abstract
<wbr>Worker
</a>
782 <li class=
" tsd-kind-class tsd-has-type-parameter">
783 <a href=
"clusterworker.html" class=
"tsd-kind-icon">Cluster
<wbr>Worker
</a>
785 <li class=
" tsd-kind-class tsd-has-type-parameter">
786 <a href=
"dynamicclusterpool.html" class=
"tsd-kind-icon">Dynamic
<wbr>Cluster
<wbr>Pool
</a>
788 <li class=
" tsd-kind-class tsd-has-type-parameter">
789 <a href=
"dynamicthreadpool.html" class=
"tsd-kind-icon">Dynamic
<wbr>Thread
<wbr>Pool
</a>
791 <li class=
" tsd-kind-class tsd-has-type-parameter">
792 <a href=
"fixedclusterpool.html" class=
"tsd-kind-icon">Fixed
<wbr>Cluster
<wbr>Pool
</a>
794 <li class=
" tsd-kind-class tsd-has-type-parameter">
795 <a href=
"fixedthreadpool.html" class=
"tsd-kind-icon">Fixed
<wbr>Thread
<wbr>Pool
</a>
799 <li class=
"current tsd-kind-class tsd-has-type-parameter">
800 <a href=
"threadworker.html" class=
"tsd-kind-icon">Thread
<wbr>Worker
</a>
802 <li class=
" tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited">
803 <a href=
"threadworker.html#constructor" class=
"tsd-kind-icon">constructor
</a>
805 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
806 <a href=
"threadworker.html#async" class=
"tsd-kind-icon">async
</a>
808 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
809 <a href=
"threadworker.html#interval" class=
"tsd-kind-icon">interval
</a>
811 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
812 <a href=
"threadworker.html#killbehavior" class=
"tsd-kind-icon">kill
<wbr>Behavior
</a>
814 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
815 <a href=
"threadworker.html#lasttask" class=
"tsd-kind-icon">last
<wbr>Task
</a>
817 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
818 <a href=
"threadworker.html#mainworker" class=
"tsd-kind-icon">main
<wbr>Worker
</a>
820 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
821 <a href=
"threadworker.html#maxinactivetime" class=
"tsd-kind-icon">max
<wbr>Inactive
<wbr>Time
</a>
823 <li class=
" tsd-kind-property tsd-parent-kind-class tsd-is-inherited">
824 <a href=
"threadworker.html#opts" class=
"tsd-kind-icon">opts
</a>
826 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
827 <a href=
"threadworker.html#asyncid" class=
"tsd-kind-icon">async
<wbr>Id
</a>
829 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external">
830 <a href=
"threadworker.html#bind" class=
"tsd-kind-icon">bind
</a>
832 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
833 <a href=
"threadworker.html#checkalive" class=
"tsd-kind-icon">check
<wbr>Alive
</a>
835 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
836 <a href=
"threadworker.html#emitdestroy" class=
"tsd-kind-icon">emit
<wbr>Destroy
</a>
838 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
839 <a href=
"threadworker.html#getmainworker" class=
"tsd-kind-icon">get
<wbr>Main
<wbr>Worker
</a>
841 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
842 <a href=
"threadworker.html#handleerror" class=
"tsd-kind-icon">handle
<wbr>Error
</a>
844 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
845 <a href=
"threadworker.html#run" class=
"tsd-kind-icon">run
</a>
847 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-protected">
848 <a href=
"threadworker.html#runasync" class=
"tsd-kind-icon">run
<wbr>Async
</a>
850 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-external">
851 <a href=
"threadworker.html#runinasyncscope" class=
"tsd-kind-icon">run
<wbr>InAsync
<wbr>Scope
</a>
853 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-overwrite tsd-is-protected">
854 <a href=
"threadworker.html#sendtomainworker" class=
"tsd-kind-icon">send
<wbr>ToMain
<wbr>Worker
</a>
856 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-is-inherited tsd-is-external">
857 <a href=
"threadworker.html#triggerasyncid" class=
"tsd-kind-icon">trigger
<wbr>Async
<wbr>Id
</a>
859 <li class=
" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-inherited tsd-is-static tsd-is-external">
860 <a href=
"threadworker.html#bind-1" class=
"tsd-kind-icon">bind
</a>
865 <ul class=
"after-current">
866 <li class=
" tsd-kind-interface">
867 <a href=
"../interfaces/clusterpooloptions.html" class=
"tsd-kind-icon">Cluster
<wbr>Pool
<wbr>Options
</a>
869 <li class=
" tsd-kind-interface tsd-has-type-parameter">
870 <a href=
"../interfaces/ipool.html" class=
"tsd-kind-icon">IPool
</a>
872 <li class=
" tsd-kind-interface">
873 <a href=
"../interfaces/iworker.html" class=
"tsd-kind-icon">IWorker
</a>
875 <li class=
" tsd-kind-interface tsd-has-type-parameter">
876 <a href=
"../interfaces/pooloptions.html" class=
"tsd-kind-icon">Pool
<wbr>Options
</a>
878 <li class=
" tsd-kind-interface">
879 <a href=
"../interfaces/workeroptions.html" class=
"tsd-kind-icon">Worker
<wbr>Options
</a>
881 <li class=
" tsd-kind-type-alias tsd-has-type-parameter">
882 <a href=
"../index.html#errorhandler" class=
"tsd-kind-icon">Error
<wbr>Handler
</a>
884 <li class=
" tsd-kind-type-alias tsd-has-type-parameter">
885 <a href=
"../index.html#exithandler" class=
"tsd-kind-icon">Exit
<wbr>Handler
</a>
887 <li class=
" tsd-kind-type-alias">
888 <a href=
"../index.html#killbehavior" class=
"tsd-kind-icon">Kill
<wbr>Behavior
</a>
890 <li class=
" tsd-kind-type-alias tsd-has-type-parameter">
891 <a href=
"../index.html#onlinehandler" class=
"tsd-kind-icon">Online
<wbr>Handler
</a>
893 <li class=
" tsd-kind-type-alias">
894 <a href=
"../index.html#threadworkerwithmessagechannel" class=
"tsd-kind-icon">Thread
<wbr>Worker
<wbr>With
<wbr>Message
<wbr>Channel
</a>
896 <li class=
" tsd-kind-type-alias">
897 <a href=
"../index.html#workerchoicestrategy" class=
"tsd-kind-icon">Worker
<wbr>Choice
<wbr>Strategy
</a>
899 <li class=
" tsd-kind-variable">
900 <a href=
"../index.html#killbehaviors" class=
"tsd-kind-icon">Kill
<wbr>Behaviors
</a>
902 <li class=
" tsd-kind-variable">
903 <a href=
"../index.html#workerchoicestrategies" class=
"tsd-kind-icon">Worker
<wbr>Choice
<wbr>Strategies
</a>
910 <footer class=
"with-border-bottom">
911 <div class=
"container">
913 <div class=
"tsd-legend-group">
914 <ul class=
"tsd-legend">
915 <li class=
"tsd-kind-property tsd-parent-kind-interface"><span class=
"tsd-kind-icon">Property
</span></li>
916 <li class=
"tsd-kind-method tsd-parent-kind-interface"><span class=
"tsd-kind-icon">Method
</span></li>
918 <ul class=
"tsd-legend">
919 <li class=
"tsd-kind-property tsd-parent-kind-class"><span class=
"tsd-kind-icon">Property
</span></li>
920 <li class=
"tsd-kind-method tsd-parent-kind-class"><span class=
"tsd-kind-icon">Method
</span></li>
922 <ul class=
"tsd-legend">
923 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class=
"tsd-kind-icon">Inherited property
</span></li>
924 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class=
"tsd-kind-icon">Inherited method
</span></li>
926 <ul class=
"tsd-legend">
927 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class=
"tsd-kind-icon">Protected property
</span></li>
928 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class=
"tsd-kind-icon">Protected method
</span></li>
930 <ul class=
"tsd-legend">
931 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class=
"tsd-kind-icon">Private method
</span></li>
936 <div class=
"container tsd-generator">
937 <p>Generated using
<a href=
"https://typedoc.org/" target=
"_blank">TypeDoc
</a></p>
939 <div class=
"overlay"></div>
940 <script src=
"../assets/js/main.js"></script>