openTimerPage(params: Object)

Requires:
DeviceKit≥1.2.6@ray-js/ray≥0.6.23
Platforms:
iOSAndroid
import { device } from '@ray-js/ray';

const { openTimerPage } = device;

// Promise usage
try {
  const res = await openTimerPage({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Navigate to the timer screen

Parameters

PropertyTypeRequiredDescription
deviceIdstringYesdeviceId Device ID; at least one of deviceId or groupId is required
categorystringYescategory Timer category
repeatnumberNoNote: This field is deprecated
Yesdata DP data { "dpName": DP name, string "dpId": DP ID, string "selected": index of the DP default value, t.Integer "rangeKeys": value range of the DP, Array<object> "rangeValues": display range of the DP, Array<string> }
NotimerConfig UI configuration
complete() => voidNoCompletion callback (executed on both success and failure)
success() => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { device } from '@ray-js/ray'

device.openTimerPage({
  deviceId: "vdevo169137612787836",
  category: "1",
  data: [{
    dpId: 1,
    dpName: "Switch",
    rangeKeys: [1, 0],
    rangeValues: ["On", "Off"],
    selected: 0
  }],
  timerConfig: { background: "FFFFFF" },
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});