UNPKG

445 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class JobRegistry {
4 constructor() {
5 this.registry = new Map();
6 }
7 register(name, job) {
8 this.registry.set(name, job);
9 }
10 get(name) {
11 const job = this.registry.get(name);
12 if (!job) {
13 throw new Error(`Unhandled job type: '${name}'.`);
14 }
15 return job;
16 }
17}
18exports.JobRegistry = JobRegistry;