createMatterKit(options?: CreateMatterKitOptions)

版本要求:
≥1.15.0

描述

创建 matter-kit 实例:提供 SDM 拦截器、Matter ↔ 标准 DP 转换工具与 Hook。

参数

参数类型必填说明
否工厂入参,字段含义见

返回值

类型:MatterKit
{MatterKit} matter-kit 实例

引用对象

typeDpValue功能点值类型,可能为 boolean、number、string
export type DpValue = boolean | number | string;

合法值

CreateMatterKitOptions.shouldConvert.params.action
值说明最低版本
init--
onDpDataChange--
onDeviceInfoUpdated--
dp-kit--

示例代码

示例

import { SmartDeviceModel, createMatterKit } from '@ray-js/panel-sdk';
import { defaultSchema } from '@/devices/schema';

type SmartDeviceSchema = typeof defaultSchema;

export const matterKit = createMatterKit({ debug: false });
export const devices = {
  common: new SmartDeviceModel<SmartDeviceSchema>({
    interceptors: matterKit.interceptors,
  }),
};