harmony 鸿蒙@arkts.lang (ArkTS Base Capability)

  • 2025-06-12
  • 浏览 (2)

@arkts.lang (ArkTS Base Capability)

The module provides the basic type definition of ArkTS. Currently, the ISendable interface is provided.

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 { lang } from '@kit.ArkTS';

lang.ISendable

Parent type of all sendable types except null and undefined. It does not have any necessary methods or properties.

An ISendable object is an instance of the Object type in ArkTS.

ISendable is mainly used when you want to customize the sendable data structure. Container types in the ArkTS common library implicitly inherit and implement ISendable.

Example

// Construct a custom sendable data structure.
@Sendable
class CustomData implements lang.ISendable {
    data1: number;
    data2: string;
    constructor(data1: number, data2: string) {
        this.data1 = data1;
        this.data2 = data2;
    }
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkTS

harmony 鸿蒙Compilation Toolchain Error Codes

harmony 鸿蒙TypeScript Compiler Error Codes

harmony 鸿蒙Utils Error Codes

harmony 鸿蒙js-apis-arkts-collections

harmony 鸿蒙@arkts.math.Decimal (High-Precision Math Library Decimal)

harmony 鸿蒙@arkts.utils (ArkTS Utils)

harmony 鸿蒙@ohos.util.ArrayList (Linear Container ArrayList)

harmony 鸿蒙@ohos.buffer (Buffer)

harmony 鸿蒙@ohos.convertxml (XML-to-JavaScript Conversion)

0  赞