@wincc-oa/wui-oarxjs-data
v1.2.2
Published
WinCC Open Architecture Dashboard project.
Maintainers
Readme
WinCCOA WebComponent Dashboard — wui-oarxjs-data
This package is part of the workspace for the WinCC Open Architecture WebComponent Dashboard, built using Lit and managed with Nx.
Usage information and reference details can be found in the WinCC OA documentation.
Overview
Cached, reference-counted wrappers around the bare-metal OaRxJsApi (from @etm-professional-control/oa-rx-js-api). Pick the handlers in this package when the same data is consumed by more than one component or service — they share a single underlying server subscription per DP and emit cached values immediately on subscribe.
Use the underlying
OaRxJsApidirectly for one-off subscriptions or when you need its full feature surface; use the handlers here when you want subscription sharing, ref-counting, and immediate cached values. See@etm-professional-control/oa-rx-js-apiREADME for the underlying API.
Services
Resolved via tsyringe. Subscribe to one or more datapoints in a single call. Multiple subscribers to the same DP share one underlying connection.
import { DpConnectHandler } from '@wincc-oa/wui-oarxjs-data/dp-connect-handler.js';
import { container } from 'tsyringe';
const dpConnectHandler = container.resolve<DpConnectHandler>(DpConnectHandler);
dpConnectHandler.dpConnect(['System1:Dp1.', 'System1:Dp2.']).subscribe((values) => {
// emission shape: { 'System1:Dp1.': v1, 'System1:Dp2.': v2 } — keyed by dpName
const v1 = values['System1:Dp1.'] as number;
const v2 = values['System1:Dp2.'] as number;
});Options:
dpConnectHandler.dpConnect(dataPaths, {
throwErrorOnMissingDataPaths: true, // surface missing-DP errors instead of returning silent empties
throttle: true // sample updates to ~1/s via a central timer (default: false)
});| Aspect | OaRxJsApi.dpConnect | DpConnectHandler.dpConnect |
| -------------- | --------------------------------------------------------- | ----------------------------------------------------------------------- |
| Signature | dpName: string \| string[] | dataPaths: string[] (array only) |
| Emission shape | { dp: string[], value: unknown[] } (positional) | { [dpName: string]: unknown } (keyed by name) |
| Initial value | First emission when backend responds (use true 2nd arg) | From cache, immediately on subscribe |
| Sharing | One server connection per call | Reference-counted; subscribers share one underlying connection |
| Throttling | None | Optional throttle option |
| When to pick | One-off subscription, single owner | DP shared across components/services, or you want cached initial values |
Used by
wui-context-dpconnect(and otherwui-context-*elements that read DPs) — see@wincc-oa/wui-oarxjs-contextREADME- Long-lived shared services in the dashboard resolve
DpConnectHandlerrather than callingOaRxJsApi.dpConnectdirectly
License
MIT
