Functions
说明:
本模块首批接口从API version 12开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
此模块仅支持在ArkTS文件(文件后缀为.ets)中导入使用。
导入模块
import { ArkTSUtils } from '@kit.ArkTS'
ArkTSUtils.isSendable
isSendable(value: Object|null|undefined): boolean
该方法用于判断value是否为Sendable数据类型。
原子化服务API: 从API version 12开始,该接口支持在原子化服务中使用。
系统能力: SystemCapability.Utils.Lang
参数:
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| value | Object |null |undefined | 是 | 待校验的对象。 |
返回值:
| 类型 | 说明 |
|---|---|
| boolean | value是否为Sendable数据类型,true表示value是Sendable数据类型,否则为false。 |
示例:
import { ArkTSUtils } from '@kit.ArkTS';
@Sendable
function sendableFunc() {
console.info("sendableFunc");
}
if (ArkTSUtils.isSendable(sendableFunc)) {
console.info("sendableFunc is Sendable");
} else {
console.info("sendableFunc is not Sendable");
}
// 期望输出: 'SendableFunc is Sendable'
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 arkts-apis-arkts-collections-Float32Array
openharmony 鸿蒙 arkts-apis-arkts-collections-ArrayBuffer
openharmony 鸿蒙 js-apis-lightweightset
openharmony 鸿蒙 errorcode-source-obfuscation
openharmony 鸿蒙 arkts-apis-arkts-utils-ASON
openharmony 鸿蒙 arkts-apis-arkts-collections-Uint8ClampedArray