readyToSetupNativeChannel(params: Object)

Requires:
WearKit≥2.0.0@ray-js/ray≥1.7.82
Platforms:
iOSAndroid
import { wear } from '@ray-js/ray';

const { readyToSetupNativeChannel } = wear;

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

Description

Establish mini-program and client channel after opening mini-program.

Parameters

PropertyTypeRequiredDescription
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

Error Code

Error CodeError Message
10001Internal error

Examples

Basic usage

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

wear.readyToSetupNativeChannel({
  success: () => {
    console.log('readyToSetupNativeChannel success');
  },
  fail: error => {
    console.error(error);
  },
});