Offload tasks to a pool of workers on node.js and in the browser
Overall
score
95%
{
"context": "This criteria evaluates how well the engineer uses workerpool's dedicated worker script capabilities, specifically focusing on worker function registration, event emission for progress reporting, and pool management for executing worker tasks.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Worker function registration",
"description": "The worker script (imageWorker.js) uses workerpool.worker() to register the grayscale and adjustBrightness functions. Both functions should be registered in a single workerpool.worker() call with an object containing both methods.",
"max_score": 25
},
{
"name": "Progress event emission",
"description": "Worker functions emit progress events using workerpool.workerEmit() or this.emit() with the correct structure { type: 'progress', operation: '<name>', percent: <number> }. The grayscale function should emit at 25% intervals and adjustBrightness at 20% intervals.",
"max_score": 20
},
{
"name": "Pool creation with script",
"description": "The main application creates a worker pool using workerpool.pool() with the path to the worker script file (imageWorker.js) as the first argument, enabling execution of registered worker functions.",
"max_score": 15
},
{
"name": "Named method execution",
"description": "The application uses pool.exec() to execute named worker methods (e.g., pool.exec('grayscale', [imageData])) rather than passing inline functions. This correctly leverages the dedicated worker script pattern.",
"max_score": 20
},
{
"name": "Event listener setup",
"description": "The processImage function uses the options parameter of pool.exec() to set up an event listener via the 'on' callback option (e.g., pool.exec('grayscale', [imageData], { on: function(event) {...} })) to receive progress events from workers.",
"max_score": 15
},
{
"name": "Pool termination",
"description": "The application properly terminates the worker pool using pool.terminate() when processing is complete, ensuring clean resource cleanup.",
"max_score": 5
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-workerpoolevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10