createDpKit(option?: CreateDpKitOptions)
Requires:
@ray-js/panel-sdk≥1.7.0
Description
Create a DP protocol suite that provides structured DP parsing, send interception, and enhancements such as throttling/debouncing
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| No | dp-kit configuration options |
Return Value
Type: CreateDpKitResult
dp-kit instance, including methods such as init, interceptors, and destroy
Referenced Types
type
CreateDpKitResultThe result of createDpKit, containing a set of interceptors that can be attached directly to SmartDeviceModel, plus the `init` / `destroy` lifecycle methods required to initialize structured DP state.| Property | Type | Description |
|---|---|---|
init | (device: any) => void | Initialize device state; when used with useStructuredProps, call after the device model has finished initializing. |
interceptors | Record<string, any> | dp-kit default interceptor configuration |
onDeviceInfoUpdated | (ctx: any) => (next: (data: any) => any) => (data: any) => any | dp-kit onDeviceInfoUpdated interceptor; can be used standalone if needed. |
onDpDataChange | (ctx: any) => (next: (data: any) => any) => (data: any) => any | dp-kit onDpDataChange interceptor; can be used standalone if needed. |
publishDps | (ctx: any) => (next: (dpState: Record<string, any>, options?: SendDpOption) => any) => (dpState: Record<string, any>, options?: SendDpOption) => any | dp-kit publishDps interceptor; can be used standalone if needed. |
destroy | () => void | Destroy dp-kit and clean up resources such as flush timers and throttling/debouncing maps. Should be called when SmartDeviceModel is destroyed (e.g., in SdmProvider's useEffect cleanup). |
type
DpValueDatapoint value type, which can be boolean, number, or string.