1.0.4 • Published 2 years ago

task-eater v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Task Eater

Description

Control task package with jobs

Examples

    // Simple job to change string to number
class StringToNumberJob implements IJob<string, number> {
    constructor() {}

    jobName: string = "StringToNumberJob";
    dispatch(input: string): Promise<number> {
    return new Promise((res, rej) => {
        res(parseInt(input, 10));
    });
    }
}

// Simple job get string to return same string
class StringJob implements IJob<string, string> {
    constructor(private initialValue: string) {}

    jobName: string = "StringJob";
    dispatch(input: string): Promise<string> {
    return new Promise((res, rej) => {
        res(input || this.initialValue);
    });
    }
}

const MyFirstTask = new Task({ name: "MyFirstTask" });
const result = await MyFirstTask.runJobs(
    new StringJob("81"),
    new StringToNumberJob(),
);
// expected result 81
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago