MCPcopy
hub / github.com/node-cron/node-cron / add

Method add

src/task-registry.ts:6–16  ·  view source on GitHub ↗
(task: ScheduledTask)

Source from the content-addressed store, hash-verified

4
5export class TaskRegistry {
6 add(task: ScheduledTask): void{
7 if(this.has(task.id)){
8 throw Error(`task ${task.id} already registered!`)
9 }
10
11 tasks.set(task.id, task);
12
13 task.on('task:destroyed', () => {
14 this.remove(task);
15 });
16 }
17
18 get(taskId: string): ScheduledTask | undefined {
19 return tasks.get(taskId);

Callers 3

createTaskFunction · 0.80
create-id.test.tsFile · 0.80

Calls 3

hasMethod · 0.95
removeMethod · 0.95
onMethod · 0.65

Tested by

no test coverage detected