@tradecanvas/core 1.23.0 → 1.24.0
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.
- package/README.md +5 -4
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +596 -583
- package/dist/index.js.map +1 -1
- package/dist/ui/ChartLegend.d.ts +2 -0
- package/dist/ui/ChartLegend.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -42,19 +42,20 @@ Indicator parameters are read through `getNumberParam` / `getIntParam` helpers,
|
|
|
42
42
|
|
|
43
43
|
Extensible via `IndicatorBase` for custom indicators.
|
|
44
44
|
|
|
45
|
-
###
|
|
45
|
+
### Indicator math in a worker
|
|
46
46
|
|
|
47
|
-
`IndicatorWorkerHost` wraps a `Worker` and exposes a Promise-based `calculate()
|
|
47
|
+
`IndicatorWorkerHost` wraps a `Worker` you create and exposes a Promise-based `calculate()`, with a per-request timeout and a `ping()` health check:
|
|
48
48
|
|
|
49
49
|
```ts
|
|
50
50
|
import { IndicatorWorkerHost } from '@tradecanvas/core'
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
// Your own worker, built from src/indicators/worker/indicator.worker.ts in the repository
|
|
53
|
+
const worker = new Worker(new URL('./indicator.worker.ts', import.meta.url), { type: 'module' })
|
|
53
54
|
const host = new IndicatorWorkerHost(worker)
|
|
54
55
|
const output = await host.calculate('rsi', config, bars)
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Pass `null` instead of a worker
|
|
58
|
+
Pass `null` instead of a worker to calculate synchronously (SSR, tests). The package does not ship a built worker script, and the chart computes its own indicators on the main thread; it does not route them through this host yet.
|
|
58
59
|
|
|
59
60
|
### Drawing Tools (24)
|
|
60
61
|
|