2 <html class=
"default no-js">
5 <meta http-equiv=
"X-UA-Compatible" content=
"IE=edge">
6 <title>IWorker | 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=
"iworker.html">IWorker
</a>
61 <h1>Interface IWorker
</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>Basic interface that describes the minimum required implementation of listener events for a pool-worker.
</p>
75 <section class=
"tsd-panel tsd-hierarchy">
77 <ul class=
"tsd-hierarchy">
79 <span class=
"target">IWorker
</span>
83 <section class=
"tsd-panel-group tsd-index-group">
85 <section class=
"tsd-panel tsd-index-panel">
86 <div class=
"tsd-index-content">
87 <section class=
"tsd-index-section ">
89 <ul class=
"tsd-index-list">
90 <li class=
"tsd-kind-method tsd-parent-kind-interface"><a href=
"iworker.html#on" class=
"tsd-kind-icon">on
</a></li>
91 <li class=
"tsd-kind-method tsd-parent-kind-interface"><a href=
"iworker.html#once" class=
"tsd-kind-icon">once
</a></li>
97 <section class=
"tsd-panel-group tsd-member-group ">
99 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
100 <a name=
"on" class=
"tsd-anchor"></a>
102 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-interface">
103 <li class=
"tsd-signature tsd-kind-icon">on
<span class=
"tsd-signature-symbol">(
</span>event
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">"error
"</span>, handler
<span class=
"tsd-signature-symbol">:
</span><a href=
"../index.html#errorhandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">ErrorHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><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>
104 <li class=
"tsd-signature tsd-kind-icon">on
<span class=
"tsd-signature-symbol">(
</span>event
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">"online
"</span>, handler
<span class=
"tsd-signature-symbol">:
</span><a href=
"../index.html#onlinehandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">OnlineHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><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>
105 <li class=
"tsd-signature tsd-kind-icon">on
<span class=
"tsd-signature-symbol">(
</span>event
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">"exit
"</span>, handler
<span class=
"tsd-signature-symbol">:
</span><a href=
"../index.html#exithandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">ExitHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><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>
107 <ul class=
"tsd-descriptions">
108 <li class=
"tsd-description">
109 <aside class=
"tsd-sources">
111 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L46">src/pools/abstract-pool.ts:
46</a></li>
114 <div class=
"tsd-comment tsd-typography">
116 <p>Register a listener to the error event.
</p>
119 <h4 class=
"tsd-parameters-title">Parameters
</h4>
120 <ul class=
"tsd-parameters">
122 <h5>event:
<span class=
"tsd-signature-type">"error
"</span></h5>
123 <div class=
"tsd-comment tsd-typography">
124 <p><code>'error
'</code>.
</p>
128 <h5>handler:
<a href=
"../index.html#errorhandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">ErrorHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><span class=
"tsd-signature-symbol">></span></h5>
129 <div class=
"tsd-comment tsd-typography">
130 <p>The error handler.
</p>
134 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
136 <li class=
"tsd-description">
137 <aside class=
"tsd-sources">
139 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L53">src/pools/abstract-pool.ts:
53</a></li>
142 <div class=
"tsd-comment tsd-typography">
144 <p>Register a listener to the online event.
</p>
147 <h4 class=
"tsd-parameters-title">Parameters
</h4>
148 <ul class=
"tsd-parameters">
150 <h5>event:
<span class=
"tsd-signature-type">"online
"</span></h5>
151 <div class=
"tsd-comment tsd-typography">
152 <p><code>'online
'</code>.
</p>
156 <h5>handler:
<a href=
"../index.html#onlinehandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">OnlineHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><span class=
"tsd-signature-symbol">></span></h5>
157 <div class=
"tsd-comment tsd-typography">
158 <p>The online handler.
</p>
162 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
164 <li class=
"tsd-description">
165 <aside class=
"tsd-sources">
167 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L60">src/pools/abstract-pool.ts:
60</a></li>
170 <div class=
"tsd-comment tsd-typography">
172 <p>Register a listener to the exit event.
</p>
175 <h4 class=
"tsd-parameters-title">Parameters
</h4>
176 <ul class=
"tsd-parameters">
178 <h5>event:
<span class=
"tsd-signature-type">"exit
"</span></h5>
179 <div class=
"tsd-comment tsd-typography">
180 <p><code>'exit
'</code>.
</p>
184 <h5>handler:
<a href=
"../index.html#exithandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">ExitHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><span class=
"tsd-signature-symbol">></span></h5>
185 <div class=
"tsd-comment tsd-typography">
186 <p>The exit handler.
</p>
190 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
194 <section class=
"tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
195 <a name=
"once" class=
"tsd-anchor"></a>
197 <ul class=
"tsd-signatures tsd-kind-method tsd-parent-kind-interface">
198 <li class=
"tsd-signature tsd-kind-icon">once
<span class=
"tsd-signature-symbol">(
</span>event
<span class=
"tsd-signature-symbol">:
</span><span class=
"tsd-signature-type">"exit
"</span>, handler
<span class=
"tsd-signature-symbol">:
</span><a href=
"../index.html#exithandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">ExitHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><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>
200 <ul class=
"tsd-descriptions">
201 <li class=
"tsd-description">
202 <aside class=
"tsd-sources">
204 <li>Defined in
<a href=
"https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L67">src/pools/abstract-pool.ts:
67</a></li>
207 <div class=
"tsd-comment tsd-typography">
209 <p>Register a listener to the exit event that will only performed once.
</p>
212 <h4 class=
"tsd-parameters-title">Parameters
</h4>
213 <ul class=
"tsd-parameters">
215 <h5>event:
<span class=
"tsd-signature-type">"exit
"</span></h5>
216 <div class=
"tsd-comment tsd-typography">
217 <p><code>'exit
'</code>.
</p>
221 <h5>handler:
<a href=
"../index.html#exithandler" class=
"tsd-signature-type" data-tsd-kind=
"Type alias">ExitHandler
</a><span class=
"tsd-signature-symbol"><</span><a href=
"iworker.html" class=
"tsd-signature-type" data-tsd-kind=
"Interface">IWorker
</a><span class=
"tsd-signature-symbol">></span></h5>
222 <div class=
"tsd-comment tsd-typography">
223 <p>The exit handler.
</p>
227 <h4 class=
"tsd-returns-title">Returns
<span class=
"tsd-signature-type">void
</span></h4>
233 <div class=
"col-4 col-menu menu-sticky-wrap menu-highlight">
234 <nav class=
"tsd-navigation primary">
237 <a href=
"../index.html">Exports
</a>
241 <nav class=
"tsd-navigation secondary menu-sticky">
242 <ul class=
"before-current">
243 <li class=
" tsd-kind-class tsd-has-type-parameter">
244 <a href=
"../classes/abstractworker.html" class=
"tsd-kind-icon">Abstract
<wbr>Worker
</a>
246 <li class=
" tsd-kind-class tsd-has-type-parameter">
247 <a href=
"../classes/clusterworker.html" class=
"tsd-kind-icon">Cluster
<wbr>Worker
</a>
249 <li class=
" tsd-kind-class tsd-has-type-parameter">
250 <a href=
"../classes/dynamicclusterpool.html" class=
"tsd-kind-icon">Dynamic
<wbr>Cluster
<wbr>Pool
</a>
252 <li class=
" tsd-kind-class tsd-has-type-parameter">
253 <a href=
"../classes/dynamicthreadpool.html" class=
"tsd-kind-icon">Dynamic
<wbr>Thread
<wbr>Pool
</a>
255 <li class=
" tsd-kind-class tsd-has-type-parameter">
256 <a href=
"../classes/fixedclusterpool.html" class=
"tsd-kind-icon">Fixed
<wbr>Cluster
<wbr>Pool
</a>
258 <li class=
" tsd-kind-class tsd-has-type-parameter">
259 <a href=
"../classes/fixedthreadpool.html" class=
"tsd-kind-icon">Fixed
<wbr>Thread
<wbr>Pool
</a>
261 <li class=
" tsd-kind-class tsd-has-type-parameter">
262 <a href=
"../classes/threadworker.html" class=
"tsd-kind-icon">Thread
<wbr>Worker
</a>
264 <li class=
" tsd-kind-interface">
265 <a href=
"clusterpooloptions.html" class=
"tsd-kind-icon">Cluster
<wbr>Pool
<wbr>Options
</a>
267 <li class=
" tsd-kind-interface tsd-has-type-parameter">
268 <a href=
"ipool.html" class=
"tsd-kind-icon">IPool
</a>
272 <li class=
"current tsd-kind-interface">
273 <a href=
"iworker.html" class=
"tsd-kind-icon">IWorker
</a>
275 <li class=
" tsd-kind-method tsd-parent-kind-interface">
276 <a href=
"iworker.html#on" class=
"tsd-kind-icon">on
</a>
278 <li class=
" tsd-kind-method tsd-parent-kind-interface">
279 <a href=
"iworker.html#once" class=
"tsd-kind-icon">once
</a>
284 <ul class=
"after-current">
285 <li class=
" tsd-kind-interface tsd-has-type-parameter">
286 <a href=
"pooloptions.html" class=
"tsd-kind-icon">Pool
<wbr>Options
</a>
288 <li class=
" tsd-kind-interface">
289 <a href=
"workeroptions.html" class=
"tsd-kind-icon">Worker
<wbr>Options
</a>
291 <li class=
" tsd-kind-type-alias tsd-has-type-parameter">
292 <a href=
"../index.html#errorhandler" class=
"tsd-kind-icon">Error
<wbr>Handler
</a>
294 <li class=
" tsd-kind-type-alias tsd-has-type-parameter">
295 <a href=
"../index.html#exithandler" class=
"tsd-kind-icon">Exit
<wbr>Handler
</a>
297 <li class=
" tsd-kind-type-alias">
298 <a href=
"../index.html#killbehavior" class=
"tsd-kind-icon">Kill
<wbr>Behavior
</a>
300 <li class=
" tsd-kind-type-alias tsd-has-type-parameter">
301 <a href=
"../index.html#onlinehandler" class=
"tsd-kind-icon">Online
<wbr>Handler
</a>
303 <li class=
" tsd-kind-type-alias">
304 <a href=
"../index.html#threadworkerwithmessagechannel" class=
"tsd-kind-icon">Thread
<wbr>Worker
<wbr>With
<wbr>Message
<wbr>Channel
</a>
306 <li class=
" tsd-kind-type-alias">
307 <a href=
"../index.html#workerchoicestrategy" class=
"tsd-kind-icon">Worker
<wbr>Choice
<wbr>Strategy
</a>
309 <li class=
" tsd-kind-variable">
310 <a href=
"../index.html#killbehaviors" class=
"tsd-kind-icon">Kill
<wbr>Behaviors
</a>
312 <li class=
" tsd-kind-variable">
313 <a href=
"../index.html#workerchoicestrategies" class=
"tsd-kind-icon">Worker
<wbr>Choice
<wbr>Strategies
</a>
320 <footer class=
"with-border-bottom">
321 <div class=
"container">
323 <div class=
"tsd-legend-group">
324 <ul class=
"tsd-legend">
325 <li class=
"tsd-kind-property tsd-parent-kind-interface"><span class=
"tsd-kind-icon">Property
</span></li>
326 <li class=
"tsd-kind-method tsd-parent-kind-interface"><span class=
"tsd-kind-icon">Method
</span></li>
328 <ul class=
"tsd-legend">
329 <li class=
"tsd-kind-property tsd-parent-kind-class"><span class=
"tsd-kind-icon">Property
</span></li>
330 <li class=
"tsd-kind-method tsd-parent-kind-class"><span class=
"tsd-kind-icon">Method
</span></li>
332 <ul class=
"tsd-legend">
333 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class=
"tsd-kind-icon">Inherited property
</span></li>
334 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class=
"tsd-kind-icon">Inherited method
</span></li>
336 <ul class=
"tsd-legend">
337 <li class=
"tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class=
"tsd-kind-icon">Protected property
</span></li>
338 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class=
"tsd-kind-icon">Protected method
</span></li>
340 <ul class=
"tsd-legend">
341 <li class=
"tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class=
"tsd-kind-icon">Private method
</span></li>
346 <div class=
"container tsd-generator">
347 <p>Generated using
<a href=
"https://typedoc.org/" target=
"_blank">TypeDoc
</a></p>
349 <div class=
"overlay"></div>
350 <script src=
"../assets/js/main.js"></script>