Package lock to 2.0.0 and removing other full keywords
[poolifier.git] / docs / classes / abstractworker.html
1 <!doctype html>
2 <html class="default no-js">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <title>AbstractWorker | 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>
11 </head>
12 <body>
13 <header>
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="..">
18 <div class="field">
19 <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20 <input id="tsd-search-field" type="text" />
21 </div>
22 <ul class="results">
23 <li class="state loading">Preparing search index...</li>
24 <li class="state failure">The search index is not available</li>
25 </ul>
26 <a href="../index.html" class="title">poolifier</a>
27 </div>
28 <div class="table-cell" id="tsd-widgets">
29 <div id="tsd-filter">
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>
38 </ul>
39 </div>
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>
44 </div>
45 </div>
46 <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47 </div>
48 </div>
49 </div>
50 </div>
51 <div class="tsd-page-title">
52 <div class="container">
53 <ul class="tsd-breadcrumb">
54 <li>
55 <a href="../index.html">poolifier</a>
56 </li>
57 <li>
58 <a href="abstractworker.html">AbstractWorker</a>
59 </li>
60 </ul>
61 <h1>Class AbstractWorker&lt;MainWorker, Data, Response&gt;</h1>
62 </div>
63 </div>
64 </header>
65 <div class="container container-main">
66 <div class="row">
67 <div class="col-8 col-content">
68 <section class="tsd-panel tsd-comment">
69 <div class="tsd-comment tsd-typography">
70 <div class="lead">
71 <p>Base class containing some shared logic for all poolifier workers.</p>
72 </div>
73 </div>
74 </section>
75 <section class="tsd-panel tsd-type-parameters">
76 <h3>Type parameters</h3>
77 <ul class="tsd-type-parameters">
78 <li>
79 <h4>MainWorker<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Worker</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">MessagePort</span></h4>
80 <div class="tsd-comment tsd-typography">
81 <div class="lead">
82 <p>Type of main worker.</p>
83 </div>
84 </div>
85 </li>
86 <li>
87 <h4>Data = <span class="tsd-signature-type">unknown</span></h4>
88 <div class="tsd-comment tsd-typography">
89 <div class="lead">
90 <p>Type of data this worker receives from pool&#39;s execution. This can only be serializable data.</p>
91 </div>
92 </div>
93 </li>
94 <li>
95 <h4>Response = <span class="tsd-signature-type">unknown</span></h4>
96 <div class="tsd-comment tsd-typography">
97 <div class="lead">
98 <p>Type of response the worker sends back to the main worker. This can only be serializable data.</p>
99 </div>
100 </div>
101 </li>
102 </ul>
103 </section>
104 <section class="tsd-panel tsd-hierarchy">
105 <h3>Hierarchy</h3>
106 <ul class="tsd-hierarchy">
107 <li>
108 <span class="tsd-signature-type">AsyncResource</span>
109 <ul class="tsd-hierarchy">
110 <li>
111 <span class="target">AbstractWorker</span>
112 <ul class="tsd-hierarchy">
113 <li>
114 <a href="clusterworker.html" class="tsd-signature-type" data-tsd-kind="Class">ClusterWorker</a>
115 </li>
116 <li>
117 <a href="threadworker.html" class="tsd-signature-type" data-tsd-kind="Class">ThreadWorker</a>
118 </li>
119 </ul>
120 </li>
121 </ul>
122 </li>
123 </ul>
124 </section>
125 <section class="tsd-panel-group tsd-index-group">
126 <h2>Index</h2>
127 <section class="tsd-panel tsd-index-panel">
128 <div class="tsd-index-content">
129 <section class="tsd-index-section ">
130 <h3>Constructors</h3>
131 <ul class="tsd-index-list">
132 <li class="tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter"><a href="abstractworker.html#constructor" class="tsd-kind-icon">constructor</a></li>
133 </ul>
134 </section>
135 <section class="tsd-index-section ">
136 <h3>Properties</h3>
137 <ul class="tsd-index-list">
138 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#async" class="tsd-kind-icon">async</a></li>
139 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#interval" class="tsd-kind-icon">interval</a></li>
140 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#killbehavior" class="tsd-kind-icon">kill<wbr>Behavior</a></li>
141 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#lasttask" class="tsd-kind-icon">last<wbr>Task</a></li>
142 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#mainworker" class="tsd-kind-icon">main<wbr>Worker</a></li>
143 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#maxinactivetime" class="tsd-kind-icon">max<wbr>Inactive<wbr>Time</a></li>
144 <li class="tsd-kind-property tsd-parent-kind-class"><a href="abstractworker.html#opts" class="tsd-kind-icon">opts</a></li>
145 </ul>
146 </section>
147 <section class="tsd-index-section ">
148 <h3>Methods</h3>
149 <ul class="tsd-index-list">
150 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="abstractworker.html#asyncid" class="tsd-kind-icon">async<wbr>Id</a></li>
151 <li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external"><a href="abstractworker.html#bind" class="tsd-kind-icon">bind</a></li>
152 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#checkalive" class="tsd-kind-icon">check<wbr>Alive</a></li>
153 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><a href="abstractworker.html#checkfunctioninput" class="tsd-kind-icon">check<wbr>Function<wbr>Input</a></li>
154 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="abstractworker.html#emitdestroy" class="tsd-kind-icon">emit<wbr>Destroy</a></li>
155 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#getmainworker" class="tsd-kind-icon">get<wbr>Main<wbr>Worker</a></li>
156 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#handleerror" class="tsd-kind-icon">handle<wbr>Error</a></li>
157 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#run" class="tsd-kind-icon">run</a></li>
158 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#runasync" class="tsd-kind-icon">run<wbr>Async</a></li>
159 <li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external"><a href="abstractworker.html#runinasyncscope" class="tsd-kind-icon">run<wbr>InAsync<wbr>Scope</a></li>
160 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><a href="abstractworker.html#sendtomainworker" class="tsd-kind-icon">send<wbr>ToMain<wbr>Worker</a></li>
161 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-external"><a href="abstractworker.html#triggerasyncid" class="tsd-kind-icon">trigger<wbr>Async<wbr>Id</a></li>
162 <li class="tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static tsd-is-external"><a href="abstractworker.html#bind-1" class="tsd-kind-icon">bind</a></li>
163 </ul>
164 </section>
165 </div>
166 </section>
167 </section>
168 <section class="tsd-panel-group tsd-member-group ">
169 <h2>Constructors</h2>
170 <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter">
171 <a name="constructor" class="tsd-anchor"></a>
172 <h3>constructor</h3>
173 <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter">
174 <li class="tsd-signature tsd-kind-icon">new <wbr>Abstract<wbr>Worker&lt;MainWorker, Data, Response&gt;<span class="tsd-signature-symbol">(</span>type<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, isMain<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</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"> =&gt; </span><span class="tsd-signature-type">Response</span>, mainWorker<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">MainWorker</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="abstractworker.html" class="tsd-signature-type" data-tsd-kind="Class">AbstractWorker</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MainWorker</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">&gt;</span></li>
175 </ul>
176 <ul class="tsd-descriptions">
177 <li class="tsd-description">
178 <aside class="tsd-sources">
179 <ul>
180 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L42">src/worker/abstract-worker.ts:42</a></li>
181 </ul>
182 </aside>
183 <div class="tsd-comment tsd-typography">
184 <div class="lead">
185 <p>Constructs a new poolifier worker.</p>
186 </div>
187 </div>
188 <h4 class="tsd-type-parameters-title">Type parameters</h4>
189 <ul class="tsd-type-parameters">
190 <li>
191 <h4>MainWorker<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Worker</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">MessagePort</span></h4>
192 </li>
193 <li>
194 <h4>Data = <span class="tsd-signature-type">unknown</span></h4>
195 </li>
196 <li>
197 <h4>Response = <span class="tsd-signature-type">unknown</span></h4>
198 </li>
199 </ul>
200 <h4 class="tsd-parameters-title">Parameters</h4>
201 <ul class="tsd-parameters">
202 <li>
203 <h5>type: <span class="tsd-signature-type">string</span></h5>
204 <div class="tsd-comment tsd-typography">
205 <p>The type of async event.</p>
206 </div>
207 </li>
208 <li>
209 <h5>isMain: <span class="tsd-signature-type">boolean</span></h5>
210 <div class="tsd-comment tsd-typography">
211 <p>Whether this is the main worker or not.</p>
212 </div>
213 </li>
214 <li>
215 <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"> =&gt; </span><span class="tsd-signature-type">Response</span></h5>
216 <div class="tsd-comment tsd-typography">
217 <p>Function processed by the worker when the pool&#39;s <code>execution</code> function is invoked.</p>
218 </div>
219 <ul class="tsd-parameters">
220 <li class="tsd-parameter-signature">
221 <ul class="tsd-signatures tsd-kind-type-literal">
222 <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>
223 </ul>
224 <ul class="tsd-descriptions">
225 <li class="tsd-description">
226 <h4 class="tsd-parameters-title">Parameters</h4>
227 <ul class="tsd-parameters">
228 <li>
229 <h5>data: <span class="tsd-signature-type">Data</span></h5>
230 </li>
231 </ul>
232 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Response</span></h4>
233 </li>
234 </ul>
235 </li>
236 </ul>
237 </li>
238 <li>
239 <h5><span class="tsd-flag ts-flagOptional">Optional</span> mainWorker: <span class="tsd-signature-type">null</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">MainWorker</span></h5>
240 <div class="tsd-comment tsd-typography">
241 <p>Reference to main worker.</p>
242 </div>
243 </li>
244 <li>
245 <h5>opts: <a href="../interfaces/workeroptions.html" class="tsd-signature-type" data-tsd-kind="Interface">WorkerOptions</a><span class="tsd-signature-symbol"> = ...</span></h5>
246 <div class="tsd-comment tsd-typography">
247 <p>Options for the worker.</p>
248 </div>
249 </li>
250 </ul>
251 <h4 class="tsd-returns-title">Returns <a href="abstractworker.html" class="tsd-signature-type" data-tsd-kind="Class">AbstractWorker</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">MainWorker</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">&gt;</span></h4>
252 </li>
253 </ul>
254 </section>
255 </section>
256 <section class="tsd-panel-group tsd-member-group ">
257 <h2>Properties</h2>
258 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected">
259 <a name="async" class="tsd-anchor"></a>
260 <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> async</h3>
261 <div class="tsd-signature tsd-kind-icon">async<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div>
262 <aside class="tsd-sources">
263 <ul>
264 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L34">src/worker/abstract-worker.ts:34</a></li>
265 </ul>
266 </aside>
267 <div class="tsd-comment tsd-typography">
268 <div class="lead">
269 <p>Whether the worker is working asynchronously or not.</p>
270 </div>
271 </div>
272 </section>
273 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected">
274 <a name="interval" class="tsd-anchor"></a>
275 <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>
276 <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>
277 <aside class="tsd-sources">
278 <ul>
279 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L42">src/worker/abstract-worker.ts:42</a></li>
280 </ul>
281 </aside>
282 <div class="tsd-comment tsd-typography">
283 <div class="lead">
284 <p>Handler ID of the <code>interval</code> alive check.</p>
285 </div>
286 </div>
287 </section>
288 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected">
289 <a name="killbehavior" class="tsd-anchor"></a>
290 <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> kill<wbr>Behavior</h3>
291 <div class="tsd-signature tsd-kind-icon">kill<wbr>Behavior<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;SOFT&quot;</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">&quot;HARD&quot;</span></div>
292 <aside class="tsd-sources">
293 <ul>
294 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L30">src/worker/abstract-worker.ts:30</a></li>
295 </ul>
296 </aside>
297 <div class="tsd-comment tsd-typography">
298 <div class="lead">
299 <p>The kill behavior set as option on the Worker constructor or a default value.</p>
300 </div>
301 </div>
302 </section>
303 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected">
304 <a name="lasttask" class="tsd-anchor"></a>
305 <h3><span class="tsd-flag ts-flagProtected">Protected</span> last<wbr>Task</h3>
306 <div class="tsd-signature tsd-kind-icon">last<wbr>Task<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div>
307 <aside class="tsd-sources">
308 <ul>
309 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L38">src/worker/abstract-worker.ts:38</a></li>
310 </ul>
311 </aside>
312 <div class="tsd-comment tsd-typography">
313 <div class="lead">
314 <p>Timestamp of the last task processed by this worker.</p>
315 </div>
316 </div>
317 </section>
318 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected">
319 <a name="mainworker" class="tsd-anchor"></a>
320 <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagOptional">Optional</span> main<wbr>Worker</h3>
321 <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">MainWorker</span></div>
322 <aside class="tsd-sources">
323 </aside>
324 </section>
325 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class tsd-is-protected">
326 <a name="maxinactivetime" class="tsd-anchor"></a>
327 <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> max<wbr>Inactive<wbr>Time</h3>
328 <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>
329 <aside class="tsd-sources">
330 <ul>
331 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L26">src/worker/abstract-worker.ts:26</a></li>
332 </ul>
333 </aside>
334 <div class="tsd-comment tsd-typography">
335 <div class="lead">
336 <p>The maximum time to keep this worker alive while idle. The pool automatically checks and terminates this worker when the time expires.</p>
337 </div>
338 </div>
339 </section>
340 <section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
341 <a name="opts" class="tsd-anchor"></a>
342 <h3><span class="tsd-flag ts-flagReadonly">Readonly</span> opts</h3>
343 <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>
344 <aside class="tsd-sources">
345 </aside>
346 </section>
347 </section>
348 <section class="tsd-panel-group tsd-member-group ">
349 <h2>Methods</h2>
350 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
351 <a name="asyncid" class="tsd-anchor"></a>
352 <h3>async<wbr>Id</h3>
353 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
354 <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>
355 </ul>
356 <ul class="tsd-descriptions">
357 <li class="tsd-description">
358 <aside class="tsd-sources">
359 <ul>
360 <li>Defined in node_modules/@types/node/async_hooks.d.ts:159</li>
361 </ul>
362 </aside>
363 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
364 <p>the unique ID assigned to this AsyncResource instance.</p>
365 </li>
366 </ul>
367 </section>
368 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external">
369 <a name="bind" class="tsd-anchor"></a>
370 <h3>bind</h3>
371 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external">
372 <li class="tsd-signature tsd-kind-icon">bind&lt;Func&gt;<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"> &amp; </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>
373 </ul>
374 <ul class="tsd-descriptions">
375 <li class="tsd-description">
376 <aside class="tsd-sources">
377 <ul>
378 <li>Defined in node_modules/@types/node/async_hooks.d.ts:136</li>
379 </ul>
380 </aside>
381 <div class="tsd-comment tsd-typography">
382 <div class="lead">
383 <p>Binds the given function to execute to this <code>AsyncResource</code>&#39;s scope.</p>
384 </div>
385 </div>
386 <h4 class="tsd-type-parameters-title">Type parameters</h4>
387 <ul class="tsd-type-parameters">
388 <li>
389 <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"> =&gt; </span><span class="tsd-signature-type">any</span></h4>
390 </li>
391 </ul>
392 <h4 class="tsd-parameters-title">Parameters</h4>
393 <ul class="tsd-parameters">
394 <li>
395 <h5>fn: <span class="tsd-signature-type">Func</span></h5>
396 <div class="tsd-comment tsd-typography">
397 <p>The function to bind to the current <code>AsyncResource</code>.</p>
398 </div>
399 </li>
400 </ul>
401 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol"> &amp; </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>
402 </li>
403 </ul>
404 </section>
405 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
406 <a name="checkalive" class="tsd-anchor"></a>
407 <h3><span class="tsd-flag ts-flagProtected">Protected</span> check<wbr>Alive</h3>
408 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
409 <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>
410 </ul>
411 <ul class="tsd-descriptions">
412 <li class="tsd-description">
413 <aside class="tsd-sources">
414 <ul>
415 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L130">src/worker/abstract-worker.ts:130</a></li>
416 </ul>
417 </aside>
418 <div class="tsd-comment tsd-typography">
419 <div class="lead">
420 <p>Check to see if the worker should be terminated, because its living too long.</p>
421 </div>
422 </div>
423 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
424 </li>
425 </ul>
426 </section>
427 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-private">
428 <a name="checkfunctioninput" class="tsd-anchor"></a>
429 <h3><span class="tsd-flag ts-flagPrivate">Private</span> check<wbr>Function<wbr>Input</h3>
430 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-private">
431 <li class="tsd-signature tsd-kind-icon">check<wbr>Function<wbr>Input<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"> =&gt; </span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
432 </ul>
433 <ul class="tsd-descriptions">
434 <li class="tsd-description">
435 <aside class="tsd-sources">
436 <ul>
437 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L104">src/worker/abstract-worker.ts:104</a></li>
438 </ul>
439 </aside>
440 <div class="tsd-comment tsd-typography">
441 <div class="lead">
442 <p>Check if the <code>fn</code> parameter is passed to the constructor.</p>
443 </div>
444 </div>
445 <h4 class="tsd-parameters-title">Parameters</h4>
446 <ul class="tsd-parameters">
447 <li>
448 <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"> =&gt; </span><span class="tsd-signature-type">Response</span></h5>
449 <div class="tsd-comment tsd-typography">
450 <p>The function that should be defined.</p>
451 </div>
452 <ul class="tsd-parameters">
453 <li class="tsd-parameter-signature">
454 <ul class="tsd-signatures tsd-kind-type-literal">
455 <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>
456 </ul>
457 <ul class="tsd-descriptions">
458 <li class="tsd-description">
459 <h4 class="tsd-parameters-title">Parameters</h4>
460 <ul class="tsd-parameters">
461 <li>
462 <h5>data: <span class="tsd-signature-type">Data</span></h5>
463 </li>
464 </ul>
465 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Response</span></h4>
466 </li>
467 </ul>
468 </li>
469 </ul>
470 </li>
471 </ul>
472 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
473 </li>
474 </ul>
475 </section>
476 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
477 <a name="emitdestroy" class="tsd-anchor"></a>
478 <h3>emit<wbr>Destroy</h3>
479 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
480 <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>
481 </ul>
482 <ul class="tsd-descriptions">
483 <li class="tsd-description">
484 <aside class="tsd-sources">
485 <ul>
486 <li>Defined in node_modules/@types/node/async_hooks.d.ts:154</li>
487 </ul>
488 </aside>
489 <div class="tsd-comment tsd-typography">
490 <div class="lead">
491 <p>Call AsyncHooks destroy callbacks.</p>
492 </div>
493 </div>
494 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
495 </li>
496 </ul>
497 </section>
498 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
499 <a name="getmainworker" class="tsd-anchor"></a>
500 <h3><span class="tsd-flag ts-flagProtected">Protected</span> get<wbr>Main<wbr>Worker</h3>
501 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
502 <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">MainWorker</span></li>
503 </ul>
504 <ul class="tsd-descriptions">
505 <li class="tsd-description">
506 <aside class="tsd-sources">
507 <ul>
508 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L113">src/worker/abstract-worker.ts:113</a></li>
509 </ul>
510 </aside>
511 <div class="tsd-comment tsd-typography">
512 <div class="lead">
513 <p>Returns the main worker.</p>
514 </div>
515 </div>
516 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">MainWorker</span></h4>
517 <p>Reference to the main worker.</p>
518 </li>
519 </ul>
520 </section>
521 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
522 <a name="handleerror" class="tsd-anchor"></a>
523 <h3><span class="tsd-flag ts-flagProtected">Protected</span> handle<wbr>Error</h3>
524 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
525 <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>
526 </ul>
527 <ul class="tsd-descriptions">
528 <li class="tsd-description">
529 <aside class="tsd-sources">
530 <ul>
531 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L142">src/worker/abstract-worker.ts:142</a></li>
532 </ul>
533 </aside>
534 <div class="tsd-comment tsd-typography">
535 <div class="lead">
536 <p>Handle an error and convert it to a string so it can be sent back to the main worker.</p>
537 </div>
538 </div>
539 <h4 class="tsd-parameters-title">Parameters</h4>
540 <ul class="tsd-parameters">
541 <li>
542 <h5>e: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Error</span></h5>
543 <div class="tsd-comment tsd-typography">
544 <p>The error raised by the worker.</p>
545 </div>
546 </li>
547 </ul>
548 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
549 <p>Message of the error.</p>
550 </li>
551 </ul>
552 </section>
553 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
554 <a name="run" class="tsd-anchor"></a>
555 <h3><span class="tsd-flag ts-flagProtected">Protected</span> run</h3>
556 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
557 <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"> =&gt; </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">&lt;</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">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
558 </ul>
559 <ul class="tsd-descriptions">
560 <li class="tsd-description">
561 <aside class="tsd-sources">
562 <ul>
563 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L152">src/worker/abstract-worker.ts:152</a></li>
564 </ul>
565 </aside>
566 <div class="tsd-comment tsd-typography">
567 <div class="lead">
568 <p>Run the given function synchronously.</p>
569 </div>
570 </div>
571 <h4 class="tsd-parameters-title">Parameters</h4>
572 <ul class="tsd-parameters">
573 <li>
574 <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"> =&gt; </span><span class="tsd-signature-type">Response</span></h5>
575 <div class="tsd-comment tsd-typography">
576 <p>Function that will be executed.</p>
577 </div>
578 <ul class="tsd-parameters">
579 <li class="tsd-parameter-signature">
580 <ul class="tsd-signatures tsd-kind-type-literal">
581 <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>
582 </ul>
583 <ul class="tsd-descriptions">
584 <li class="tsd-description">
585 <h4 class="tsd-parameters-title">Parameters</h4>
586 <ul class="tsd-parameters">
587 <li>
588 <h5><span class="tsd-flag ts-flagOptional">Optional</span> data: <span class="tsd-signature-type">Data</span></h5>
589 </li>
590 </ul>
591 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Response</span></h4>
592 </li>
593 </ul>
594 </li>
595 </ul>
596 </li>
597 <li>
598 <h5>value: <span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol">&lt;</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">&gt;</span></h5>
599 <div class="tsd-comment tsd-typography">
600 <p>Input data for the given function.</p>
601 </div>
602 </li>
603 </ul>
604 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
605 </li>
606 </ul>
607 </section>
608 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
609 <a name="runasync" class="tsd-anchor"></a>
610 <h3><span class="tsd-flag ts-flagProtected">Protected</span> run<wbr>Async</h3>
611 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
612 <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"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">&gt;</span>, value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol">&lt;</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">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
613 </ul>
614 <ul class="tsd-descriptions">
615 <li class="tsd-description">
616 <aside class="tsd-sources">
617 <ul>
618 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L173">src/worker/abstract-worker.ts:173</a></li>
619 </ul>
620 </aside>
621 <div class="tsd-comment tsd-typography">
622 <div class="lead">
623 <p>Run the given function asynchronously.</p>
624 </div>
625 </div>
626 <h4 class="tsd-parameters-title">Parameters</h4>
627 <ul class="tsd-parameters">
628 <li>
629 <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"> =&gt; </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">&gt;</span></h5>
630 <div class="tsd-comment tsd-typography">
631 <p>Function that will be executed.</p>
632 </div>
633 <ul class="tsd-parameters">
634 <li class="tsd-parameter-signature">
635 <ul class="tsd-signatures tsd-kind-type-literal">
636 <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">&lt;</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">&gt;</span></li>
637 </ul>
638 <ul class="tsd-descriptions">
639 <li class="tsd-description">
640 <h4 class="tsd-parameters-title">Parameters</h4>
641 <ul class="tsd-parameters">
642 <li>
643 <h5><span class="tsd-flag ts-flagOptional">Optional</span> data: <span class="tsd-signature-type">Data</span></h5>
644 </li>
645 </ul>
646 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">Response</span><span class="tsd-signature-symbol">&gt;</span></h4>
647 </li>
648 </ul>
649 </li>
650 </ul>
651 </li>
652 <li>
653 <h5>value: <span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol">&lt;</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">&gt;</span></h5>
654 <div class="tsd-comment tsd-typography">
655 <p>Input data for the given function.</p>
656 </div>
657 </li>
658 </ul>
659 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
660 </li>
661 </ul>
662 </section>
663 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external">
664 <a name="runinasyncscope" class="tsd-anchor"></a>
665 <h3>run<wbr>InAsync<wbr>Scope</h3>
666 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external">
667 <li class="tsd-signature tsd-kind-icon">run<wbr>InAsync<wbr>Scope&lt;This, Result&gt;<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"> =&gt; </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>
668 </ul>
669 <ul class="tsd-descriptions">
670 <li class="tsd-description">
671 <aside class="tsd-sources">
672 <ul>
673 <li>Defined in node_modules/@types/node/async_hooks.d.ts:149</li>
674 </ul>
675 </aside>
676 <div class="tsd-comment tsd-typography">
677 <div class="lead">
678 <p>Call the provided function with the provided arguments in the
679 execution context of the async resource. This will establish the
680 context, trigger the AsyncHooks before callbacks, call the function,
681 trigger the AsyncHooks after callbacks, and then restore the original
682 execution context.</p>
683 </div>
684 </div>
685 <h4 class="tsd-type-parameters-title">Type parameters</h4>
686 <ul class="tsd-type-parameters">
687 <li>
688 <h4>This</h4>
689 </li>
690 <li>
691 <h4>Result</h4>
692 </li>
693 </ul>
694 <h4 class="tsd-parameters-title">Parameters</h4>
695 <ul class="tsd-parameters">
696 <li>
697 <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"> =&gt; </span><span class="tsd-signature-type">Result</span></h5>
698 <div class="tsd-comment tsd-typography">
699 <p>The function to call in the execution context of this
700 async resource.</p>
701 </div>
702 <ul class="tsd-parameters">
703 <li class="tsd-parameter-signature">
704 <ul class="tsd-signatures tsd-kind-type-literal tsd-is-external">
705 <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>
706 </ul>
707 <ul class="tsd-descriptions">
708 <li class="tsd-description">
709 <h4 class="tsd-parameters-title">Parameters</h4>
710 <ul class="tsd-parameters">
711 <li>
712 <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>
713 </li>
714 </ul>
715 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Result</span></h4>
716 </li>
717 </ul>
718 </li>
719 </ul>
720 </li>
721 <li>
722 <h5><span class="tsd-flag ts-flagOptional">Optional</span> thisArg: <span class="tsd-signature-type">This</span></h5>
723 <div class="tsd-comment tsd-typography">
724 <p>The receiver to be used for the function call.</p>
725 </div>
726 </li>
727 <li>
728 <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>
729 <div class="tsd-comment tsd-typography">
730 <p>Optional arguments to pass to the function.</p>
731 </div>
732 </li>
733 </ul>
734 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Result</span></h4>
735 </li>
736 </ul>
737 </section>
738 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-protected">
739 <a name="sendtomainworker" class="tsd-anchor"></a>
740 <h3><span class="tsd-flag ts-flagProtected">Protected</span> <span class="tsd-flag ts-flagAbstract">Abstract</span> send<wbr>ToMain<wbr>Worker</h3>
741 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-protected">
742 <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">&lt;</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">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
743 </ul>
744 <ul class="tsd-descriptions">
745 <li class="tsd-description">
746 <aside class="tsd-sources">
747 <ul>
748 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/5d4101b/src/worker/abstract-worker.ts#L125">src/worker/abstract-worker.ts:125</a></li>
749 </ul>
750 </aside>
751 <div class="tsd-comment tsd-typography">
752 <div class="lead">
753 <p>Send a message to the main worker.</p>
754 </div>
755 </div>
756 <h4 class="tsd-parameters-title">Parameters</h4>
757 <ul class="tsd-parameters">
758 <li>
759 <h5>message: <span class="tsd-signature-type">MessageValue</span><span class="tsd-signature-symbol">&lt;</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">&gt;</span></h5>
760 <div class="tsd-comment tsd-typography">
761 <p>The response message.</p>
762 </div>
763 </li>
764 </ul>
765 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
766 </li>
767 </ul>
768 </section>
769 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-external">
770 <a name="triggerasyncid" class="tsd-anchor"></a>
771 <h3>trigger<wbr>Async<wbr>Id</h3>
772 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-external">
773 <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>
774 </ul>
775 <ul class="tsd-descriptions">
776 <li class="tsd-description">
777 <aside class="tsd-sources">
778 <ul>
779 <li>Defined in node_modules/@types/node/async_hooks.d.ts:164</li>
780 </ul>
781 </aside>
782 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">number</span></h4>
783 <p>the trigger ID for this AsyncResource instance.</p>
784 </li>
785 </ul>
786 </section>
787 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static tsd-is-external">
788 <a name="bind-1" class="tsd-anchor"></a>
789 <h3><span class="tsd-flag ts-flagStatic">Static</span> bind</h3>
790 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static tsd-is-external">
791 <li class="tsd-signature tsd-kind-icon">bind&lt;Func&gt;<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"> &amp; </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>
792 </ul>
793 <ul class="tsd-descriptions">
794 <li class="tsd-description">
795 <aside class="tsd-sources">
796 <ul>
797 <li>Defined in node_modules/@types/node/async_hooks.d.ts:130</li>
798 </ul>
799 </aside>
800 <div class="tsd-comment tsd-typography">
801 <div class="lead">
802 <p>Binds the given function to the current execution context.</p>
803 </div>
804 </div>
805 <h4 class="tsd-type-parameters-title">Type parameters</h4>
806 <ul class="tsd-type-parameters">
807 <li>
808 <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"> =&gt; </span><span class="tsd-signature-type">any</span></h4>
809 </li>
810 </ul>
811 <h4 class="tsd-parameters-title">Parameters</h4>
812 <ul class="tsd-parameters">
813 <li>
814 <h5>fn: <span class="tsd-signature-type">Func</span></h5>
815 <div class="tsd-comment tsd-typography">
816 <p>The function to bind to the current execution context.</p>
817 </div>
818 </li>
819 <li>
820 <h5><span class="tsd-flag ts-flagOptional">Optional</span> type: <span class="tsd-signature-type">string</span></h5>
821 <div class="tsd-comment tsd-typography">
822 <p>An optional name to associate with the underlying <code>AsyncResource</code>.</p>
823 </div>
824 </li>
825 </ul>
826 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Func</span><span class="tsd-signature-symbol"> &amp; </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>
827 </li>
828 </ul>
829 </section>
830 </section>
831 </div>
832 <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
833 <nav class="tsd-navigation primary">
834 <ul>
835 <li class=" ">
836 <a href="../index.html">Exports</a>
837 </li>
838 </ul>
839 </nav>
840 <nav class="tsd-navigation secondary menu-sticky">
841 <ul class="before-current">
842 </ul>
843 <ul class="current">
844 <li class="current tsd-kind-class tsd-has-type-parameter">
845 <a href="abstractworker.html" class="tsd-kind-icon">Abstract<wbr>Worker</a>
846 <ul>
847 <li class=" tsd-kind-constructor tsd-parent-kind-class tsd-has-type-parameter">
848 <a href="abstractworker.html#constructor" class="tsd-kind-icon">constructor</a>
849 </li>
850 <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-protected">
851 <a href="abstractworker.html#async" class="tsd-kind-icon">async</a>
852 </li>
853 <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-protected">
854 <a href="abstractworker.html#interval" class="tsd-kind-icon">interval</a>
855 </li>
856 <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-protected">
857 <a href="abstractworker.html#killbehavior" class="tsd-kind-icon">kill<wbr>Behavior</a>
858 </li>
859 <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-protected">
860 <a href="abstractworker.html#lasttask" class="tsd-kind-icon">last<wbr>Task</a>
861 </li>
862 <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-protected">
863 <a href="abstractworker.html#mainworker" class="tsd-kind-icon">main<wbr>Worker</a>
864 </li>
865 <li class=" tsd-kind-property tsd-parent-kind-class tsd-is-protected">
866 <a href="abstractworker.html#maxinactivetime" class="tsd-kind-icon">max<wbr>Inactive<wbr>Time</a>
867 </li>
868 <li class=" tsd-kind-property tsd-parent-kind-class">
869 <a href="abstractworker.html#opts" class="tsd-kind-icon">opts</a>
870 </li>
871 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
872 <a href="abstractworker.html#asyncid" class="tsd-kind-icon">async<wbr>Id</a>
873 </li>
874 <li class=" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external">
875 <a href="abstractworker.html#bind" class="tsd-kind-icon">bind</a>
876 </li>
877 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
878 <a href="abstractworker.html#checkalive" class="tsd-kind-icon">check<wbr>Alive</a>
879 </li>
880 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-private">
881 <a href="abstractworker.html#checkfunctioninput" class="tsd-kind-icon">check<wbr>Function<wbr>Input</a>
882 </li>
883 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
884 <a href="abstractworker.html#emitdestroy" class="tsd-kind-icon">emit<wbr>Destroy</a>
885 </li>
886 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
887 <a href="abstractworker.html#getmainworker" class="tsd-kind-icon">get<wbr>Main<wbr>Worker</a>
888 </li>
889 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
890 <a href="abstractworker.html#handleerror" class="tsd-kind-icon">handle<wbr>Error</a>
891 </li>
892 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
893 <a href="abstractworker.html#run" class="tsd-kind-icon">run</a>
894 </li>
895 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
896 <a href="abstractworker.html#runasync" class="tsd-kind-icon">run<wbr>Async</a>
897 </li>
898 <li class=" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-external">
899 <a href="abstractworker.html#runinasyncscope" class="tsd-kind-icon">run<wbr>InAsync<wbr>Scope</a>
900 </li>
901 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-protected">
902 <a href="abstractworker.html#sendtomainworker" class="tsd-kind-icon">send<wbr>ToMain<wbr>Worker</a>
903 </li>
904 <li class=" tsd-kind-method tsd-parent-kind-class tsd-is-external">
905 <a href="abstractworker.html#triggerasyncid" class="tsd-kind-icon">trigger<wbr>Async<wbr>Id</a>
906 </li>
907 <li class=" tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static tsd-is-external">
908 <a href="abstractworker.html#bind-1" class="tsd-kind-icon">bind</a>
909 </li>
910 </ul>
911 </li>
912 </ul>
913 <ul class="after-current">
914 <li class=" tsd-kind-class tsd-has-type-parameter">
915 <a href="clusterworker.html" class="tsd-kind-icon">Cluster<wbr>Worker</a>
916 </li>
917 <li class=" tsd-kind-class tsd-has-type-parameter">
918 <a href="dynamicclusterpool.html" class="tsd-kind-icon">Dynamic<wbr>Cluster<wbr>Pool</a>
919 </li>
920 <li class=" tsd-kind-class tsd-has-type-parameter">
921 <a href="dynamicthreadpool.html" class="tsd-kind-icon">Dynamic<wbr>Thread<wbr>Pool</a>
922 </li>
923 <li class=" tsd-kind-class tsd-has-type-parameter">
924 <a href="fixedclusterpool.html" class="tsd-kind-icon">Fixed<wbr>Cluster<wbr>Pool</a>
925 </li>
926 <li class=" tsd-kind-class tsd-has-type-parameter">
927 <a href="fixedthreadpool.html" class="tsd-kind-icon">Fixed<wbr>Thread<wbr>Pool</a>
928 </li>
929 <li class=" tsd-kind-class tsd-has-type-parameter">
930 <a href="threadworker.html" class="tsd-kind-icon">Thread<wbr>Worker</a>
931 </li>
932 <li class=" tsd-kind-interface">
933 <a href="../interfaces/clusterpooloptions.html" class="tsd-kind-icon">Cluster<wbr>Pool<wbr>Options</a>
934 </li>
935 <li class=" tsd-kind-interface tsd-has-type-parameter">
936 <a href="../interfaces/ipool.html" class="tsd-kind-icon">IPool</a>
937 </li>
938 <li class=" tsd-kind-interface">
939 <a href="../interfaces/iworker.html" class="tsd-kind-icon">IWorker</a>
940 </li>
941 <li class=" tsd-kind-interface tsd-has-type-parameter">
942 <a href="../interfaces/pooloptions.html" class="tsd-kind-icon">Pool<wbr>Options</a>
943 </li>
944 <li class=" tsd-kind-interface">
945 <a href="../interfaces/workeroptions.html" class="tsd-kind-icon">Worker<wbr>Options</a>
946 </li>
947 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
948 <a href="../index.html#errorhandler" class="tsd-kind-icon">Error<wbr>Handler</a>
949 </li>
950 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
951 <a href="../index.html#exithandler" class="tsd-kind-icon">Exit<wbr>Handler</a>
952 </li>
953 <li class=" tsd-kind-type-alias">
954 <a href="../index.html#killbehavior" class="tsd-kind-icon">Kill<wbr>Behavior</a>
955 </li>
956 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
957 <a href="../index.html#onlinehandler" class="tsd-kind-icon">Online<wbr>Handler</a>
958 </li>
959 <li class=" tsd-kind-type-alias">
960 <a href="../index.html#threadworkerwithmessagechannel" class="tsd-kind-icon">Thread<wbr>Worker<wbr>With<wbr>Message<wbr>Channel</a>
961 </li>
962 <li class=" tsd-kind-type-alias">
963 <a href="../index.html#workerchoicestrategy" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategy</a>
964 </li>
965 <li class=" tsd-kind-variable">
966 <a href="../index.html#killbehaviors" class="tsd-kind-icon">Kill<wbr>Behaviors</a>
967 </li>
968 <li class=" tsd-kind-variable">
969 <a href="../index.html#workerchoicestrategies" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategies</a>
970 </li>
971 </ul>
972 </nav>
973 </div>
974 </div>
975 </div>
976 <footer class="with-border-bottom">
977 <div class="container">
978 <h2>Legend</h2>
979 <div class="tsd-legend-group">
980 <ul class="tsd-legend">
981 <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
982 <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
983 </ul>
984 <ul class="tsd-legend">
985 <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
986 <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
987 </ul>
988 <ul class="tsd-legend">
989 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
990 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
991 </ul>
992 <ul class="tsd-legend">
993 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
994 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
995 </ul>
996 <ul class="tsd-legend">
997 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
998 </ul>
999 </div>
1000 </div>
1001 </footer>
1002 <div class="container tsd-generator">
1003 <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
1004 </div>
1005 <div class="overlay"></div>
1006 <script src="../assets/js/main.js"></script>
1007 </body>
1008 </html>