@live-change/task-service 0.9.164 → 0.9.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/task.ts +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/task-service",
3
- "version": "0.9.164",
3
+ "version": "0.9.166",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.9.164",
26
- "@live-change/relations-plugin": "^0.9.164"
25
+ "@live-change/framework": "^0.9.166",
26
+ "@live-change/relations-plugin": "^0.9.166"
27
27
  },
28
- "gitHead": "38f9fb8b01a9527d8f6036e174edd1fa41443301"
28
+ "gitHead": "e99ff5ce503d5dc894d0cfe954a58397683d12e0"
29
29
  }
package/task.ts CHANGED
@@ -201,22 +201,28 @@ function progressCounter(reportProgress) {
201
201
  const progressFunction = (current, total, action, opts) => {
202
202
  currentAcc = current
203
203
  totalAcc = total
204
- reportProgress(currentAcc, totalAcc, action, opts)
204
+ return reportProgress(currentAcc, totalAcc, action, opts)
205
205
  }
206
206
  progressFunction.increment = (action, by = 1, opts) => {
207
207
  currentAcc += by
208
- progressFunction(currentAcc, totalAcc, action, opts)
208
+ return progressFunction(currentAcc, totalAcc, action, opts)
209
209
  }
210
210
  progressFunction.incrementTotal = (action, by = 1, opts) => {
211
211
  totalAcc += by
212
- progressFunction(currentAcc, totalAcc, action, opts)
212
+ return progressFunction(currentAcc, totalAcc, action, opts)
213
+ }
214
+ progressFunction.action = (action, opts) => {
215
+ return progressFunction(currentAcc, totalAcc, action, opts)
216
+ }
217
+ progressFunction.done = (opts) => {
218
+ return progressFunction(totalAcc, totalAcc, undefined, opts)
213
219
  }
214
220
  progressFunction.slice = (sliceSize, factor = 1.0) => {
215
221
  const sliceStart = currentAcc
216
222
  const sliceEnd = sliceStart + sliceSize
217
223
  currentAcc = sliceEnd
218
224
  return progressCounter((current, total, action, opts) => {
219
- progressFunction(sliceStart + Math.min(current, sliceSize) * factor,
225
+ return progressFunction(sliceStart + Math.min(current, sliceSize) * factor,
220
226
  sliceEnd + Math.min(total, sliceSize) * factor, action, opts)
221
227
  })
222
228
  }