diff --git a/@vates/task/.USAGE.md b/@vates/task/.USAGE.md index b513b4656b..9d9cef6566 100644 --- a/@vates/task/.USAGE.md +++ b/@vates/task/.USAGE.md @@ -2,7 +2,12 @@ import { Task } from '@vates/task' const task = new Task({ - name: 'my task', + // data in this object will be sent along the *start* event + // + // property names should be chosen as not to clash with properties used by `Task` or `combineEvents` + data: { + name: 'my task', + }, // if defined, a new detached task is created // diff --git a/@vates/task/README.md b/@vates/task/README.md index c6a2b5348f..8b27a14b37 100644 --- a/@vates/task/README.md +++ b/@vates/task/README.md @@ -18,7 +18,12 @@ npm install --save @vates/task import { Task } from '@vates/task' const task = new Task({ - name: 'my task', + // data in this object will be sent along the *start* event + // + // property names should be chosen as not to clash with properties used by `Task` or `combineEvents` + data: { + name: 'my task', + }, // if defined, a new detached task is created // diff --git a/@vates/task/index.js b/@vates/task/index.js index 47de942ca6..4ef1ff7043 100644 --- a/@vates/task/index.js +++ b/@vates/task/index.js @@ -84,8 +84,8 @@ exports.Task = class Task { return this.#status } - constructor({ name, onProgress }) { - this.#startData = { name } + constructor({ data = {}, onProgress }) { + this.#startData = data if (onProgress !== undefined) { this.#onProgress = onProgress