Basic Capabilities

Import Cloud Capabilities

The SDK relies on cloud capabilities. In the MiniApp Developer Platform under Development Settings - Cloud Capabilities, authorize the cloud capability Door Lock Device Mini Program Control Capability.

Installation

Add to your project

yarn add @ray-js/lock-sdk

Usage

When entering the panel, you need to call the init API to initialize. After initialization is complete, you can use the SDK API normally


import { init as initLock } from '@ray-js/lock-sdk';


async onLaunch(object: any) {
    devices.common.init();
    // Initialize door lock SDK
    initLock({
        passwordDigitalBase: 10,
        passwordSupportZero: true,
        strictMode: false,
    });
    devices.common.onInitialized(device => dpKit.init(device));
    const systemInfo = getSystemInfoSync();
    const { theme } = systemInfo;

    dispatch(initializeSystemInfo(systemInfo));
    dispatch(updateThemeType(theme));
}