• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Functions
2<!--Kit: ArkTS-->
3<!--Subsystem: CommonLibrary-->
4<!--Owner: @lijiamin2025-->
5<!--Designer: @weng-changcheng-->
6<!--Tester: @kirl75; @zsw_zhushiwei-->
7<!--Adviser: @ge-yafang-->
8
9> **说明:**
10>
11> 本模块首批接口从API version 12开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
12>
13> 此模块仅支持在ArkTS文件(文件后缀为.ets)中导入使用。
14
15## 导入模块
16
17```ts
18import { ArkTSUtils } from '@kit.ArkTS'
19```
20
21## ArkTSUtils.isSendable
22
23isSendable(value: Object | null | undefined): boolean
24
25该方法用于判断value是否为Sendable数据类型。
26
27**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
28
29**系统能力:** SystemCapability.Utils.Lang
30
31**参数:**
32
33| 参数名 | 类型 | 必填 | 说明 |
34| -------- | -------- | -------- | -------- |
35| value | Object \| null \| undefined  | 是 | 待校验的对象。|
36
37**返回值:**
38
39| 类型 | 说明 |
40| -------- | -------- |
41| boolean | value是否为Sendable数据类型,true表示value是Sendable数据类型,否则为false。|
42
43**示例:**
44
45```ts
46import { ArkTSUtils } from '@kit.ArkTS';
47
48@Sendable
49function sendableFunc() {
50  console.info("sendableFunc");
51}
52
53if (ArkTSUtils.isSendable(sendableFunc)) {
54  console.info("sendableFunc is Sendable");
55} else {
56  console.info("sendableFunc is not Sendable");
57}
58// 期望输出: 'SendableFunc is Sendable'
59```