Functions
NOTE
The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
This module can be imported only to ArkTS files (with the file name extension .ets).
Modules to Import
import { ArkTSUtils } from '@kit.ArkTS'
ArkTSUtils.isSendable
isSendable(value: Object|null|undefined): boolean
Checks whether the passed-in value is of the sendable data type.
Atomic service API: This API can be used in atomic services since API version 12.
System capability: SystemCapability.Utils.Lang
Parameters
| Name | Type | Mandatory | Description |
|---|---|---|---|
| value | Object |null |undefined | Yes | Object to check. |
Return value
| Type | Description |
|---|---|
| boolean | Check result. The value true is returned if the passed-in value is of the sendable data type; otherwise, false is returned. |
Example
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");
}
// Expected output: '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