Last Updated on : 2021-08-27 11:07:11download
import {TYSdk} from "tuya-panel-kit";
const TYEvent = TYSdk.event;
/**
* @param {String} yourEventName-event name
* @param {Function} yourHandler-monitor the callback triggered successfully
*/
TYEvent.on(yourEventName, yourHandler); // start listening for events
TYEvent.off(yourEventName, yourHandler); // cancel listening event
deviceDataChange
: core event. This event is divided into three categories, distinguished by the type
field in the return value:
-dpData
: DP point status changes, that is, the device has reported the DP point status.
-devInfo
: Notification of device information changes, such as device name changes.
-deviceOnline
: Device online status changes.
Description: When componentWillUnmount is enabled, you need to cancel the monitoring event.
import {TYSdk} from "tuya-panel-kit";
const TYDevice = TYSdk.device;
/**
* @desc issues the DP point (the core method of interacting with the hardware side)
* @param {Object} data-DP point data
*/
TYDevice.putDeviceData(data);
import {TYSdk} from "tuya-panel-kit";
const TYNative = TYSdk.event;
/**
* @desc request API interface
* @param {Object}-request parameters
* @param {Function}-success callback
* @param {Function}-Failure callback
*/
TYDevice.apiRequest(
{
a: apiName,
v: apiVersion
postData: params,
},
d => successHandle(d),
e => errorHandle(e));
TYNative.DeviceEventEmitter.addListener('addMember', yourHandler)
TYNative.DeviceEventEmitter.removeListener('addMember', yourHandler)
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback