handleShortcut
操作快捷方式,包括添加和移除, 仅 iOS
引入
import { handleShortcut } from '@ray-js/ray';
需引入
BizKit
,且在>=3.1.1
版本才可使用。
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
type | number | 是 | 操作类型。0-添加、1-移除 | |
sceneId | string | 是 | 场景 ID | |
name | string | 是 | 场景名称 | |
iconUrl | string | 否 | 场景 Logo | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
operationStep | number | 操作步骤,0-添加、1-移除、2-更新、3-取消 |
operationStatus | boolean | 操作状态,YES,表示成功;NO,表示失败 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
函数定义示例
/**
* 操作快捷方式,包括添加和移除, 仅 iOS
*/
export function handleShortcut(params: {
/** 操作类型。0-添加、1-移除 */
type: number;
/** 场景 ID */
sceneId: string;
/** 场景名称 */
name: string;
/** 场景 Logo */
iconUrl?: string;
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: {
/** 操作步骤,0-添加、1-移除、2-更新、3-取消 */
operationStep: number;
/** 操作状态,YES,表示成功;NO,表示失败 */
operationStatus: boolean;
}) => void;
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
isAssociatedShortcut
获取是否关联 siri 状态, 仅 iOS
引入
import { isAssociatedShortcut } from '@ray-js/ray';
需引入
BizKit
,且在>=3.1.1
版本才可使用。
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
sceneId | string | 是 | 场景 ID | |
name | string | 否 | 场景名称 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
isAssociated | boolean | 是否已关联 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
函数定义示例
/**
* 获取是否关联 Siri 状态, 仅 iOS
*/
export function isAssociatedShortcut(params: {
/** 场景 ID */
sceneId: string;
/** 场景名称 */
name?: string;
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: {
/** 是否已关联 */
isAssociated: boolean;
}) => void;
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
isSupportedShortcut
是否支持 Siri, 仅 iOS
引入
import { isSupportedShortcut } from '@ray-js/ray';
需引入
BizKit
,且在>=3.1.1
版本才可使用。
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
isSupported | boolean | 是否支持 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
函数定义示例
/**
* 是否支持 Siri, 仅 iOS
*/
export function isSupportedShortcut(params?: {
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?: () => void;
/** 接口调用成功的回调函数 */
success?: (params: {
/** 是否支持 */
isSupported: boolean;
}) => void;
/** 接口调用失败的回调函数 */
fail?: (params: {
errorMsg: string;
errorCode: string | number;
innerError: {
errorCode: string | number;
errorMsg: string;
};
}) => void;
}): void;
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。