1.0.11 • Published 1 year ago

@o.yilmaz/taskchain v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

taskchain

Installation

npm install @o.yilmaz/taskchain

Creating Tasks

import { AbstractTask } from '@o.yilmaz/taskchain'

export class Task1 extends AbstractTask {
	isRun = false

	// determines if this task's run method will be called
	shouldRun(parameters): boolean {
		return true
	}

	run(parameters) {
		this.isRun = true

		return {
			run: true
		}
	}
}

Processing Tasks

const task1 = new Task1()
const task2 = new Task2()
const task3 = new Task3()

// the parameters will be passed to 
// each task's `shouldRun` and `run` methods
const chain = new TaskChain({
	param1: true,
	param2: 'test'
})

chain
	.registerTask(task1)
	.registerTask(task2)
	.registerTask(task3)
	.processChain()
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago