nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/Sm4Utils.ets | arkts | encrypt | 加密
@param data
@returns 返回16进制的字符串 | public static encrypt(data: string): string {
if (!data) {
return '';
}
return aegis.sm4EncTextHexSync(aegis.SM4Alg.SM4_CBC_PKCS5Padding, data, Sm4Utils.initKey());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left encrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Ri... | public static encrypt(data: string): string {
if (!data) {
return '';
}
return aegis.sm4EncTextHexSync(aegis.SM4Alg.SM4_CBC_PKCS5Padding, data, Sm4Utils.initKey());
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/Sm4Utils.ets#L65-L70 | ed8d7c82281ee2320f20786cf2cd194785b29255 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | toString | Converts this object to a string
@returns result of the conversion by radix 10 | public override toString(): String {
return Float.toString(this.value, 10);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): String {
return Float.toString(this.value, 10);
} | https://gitcode.com/iop123123/arkts-static-skills | bc41c51e6af69a4f0a3b144a5a91d83e8c2b8c74 | gitcode |
openharmony/applications_app_samples | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets | arkts | decodingOptionPictSetAux | 设置解码参数 | decodingOptionPictSetAux(): string {
let desiredType: image.AuxiliaryPictureType[] = [image.AuxiliaryPictureType.GAINMAP,
image.AuxiliaryPictureType.DEPTH_MAP,
image.AuxiliaryPictureType.UNREFOCUS_MAP];
let message = ndkTest.setDesiredAuxiliaryPictures(desiredType);
return this.logger.check_re... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decodingOptionPictSetAux AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A... | decodingOptionPictSetAux(): string {
let desiredType: image.AuxiliaryPictureType[] = [image.AuxiliaryPictureType.GAINMAP,
image.AuxiliaryPictureType.DEPTH_MAP,
image.AuxiliaryPictureType.UNREFOCUS_MAP];
let message = ndkTest.setDesiredAuxiliaryPictures(desiredType);
return this.logger.check_re... | https://github.com/openharmony/applications_app_samples | 6ecea24730799241bc92056445cbdba02c00d45d | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/DatabaseHelper.ets | arkts | getCategoryDao | 获取分类 Dao 实例 | public static getCategoryDao(): CategoryDao {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.categoryDao) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return DatabaseHelper.categoryDao;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCategoryDao AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public static getCategoryDao(): CategoryDao {
if (!DatabaseHelper.isInitialized || !DatabaseHelper.categoryDao) {
throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()');
}
return DatabaseHelper.categoryDao;
} | https://github.com/fuhhhhhhhh/openharmony | af95328bfec4dca0add9c1ef6b360e8e5f8a0282 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | hasActiveGcGamepad | 是否有活跃的 GCK 手柄连接
用于判断 D-pad 2012-2015 事件是否需要过滤
仅当 GCK 已启用 且 有手柄实际连接时返回 true | hasActiveGcGamepad(): boolean {
return this.useGameControllerKit && this.gcDeviceIdToSlot.size > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasActiveGcGamepad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#... | hasActiveGcGamepad(): boolean {
return this.useGameControllerKit && this.gcDeviceIdToSlot.size > 0;
} | https://github.com/AlkaidLab/moonlight-harmony | 2bee950627b5b412bc359667411d8e9d589cc247 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets | arkts | updateStrategy | 更新预加载策略 | private updateStrategy(): void {
const config = this.configManager.getPreloadConfig();
if (!config.enabled) {
this.currentStrategy = {
forwardRange: 0,
backwardRange: 0,
priority: 0,
reason: '预加载已禁用'
};
this.notifyListeners();
return;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#v... | private updateStrategy(): void {
const config = this.configManager.getPreloadConfig();
if (!config.enabled) {
this.currentStrategy = {
forwardRange: 0,
backwardRange: 0,
priority: 0,
reason: '预加载已禁用'
};
this.notifyListeners();
return;
}
... | https://github.com/DaLongZhuaZi/manxia | 18dfc853b334f42d8bd0cd7fdda4074595aa0806 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/FavoriteModelsService.ets | arkts | removeFavorite | 移除收藏
@param modelId 模型 ID
@param providerId 供应商 ID | async removeFavorite(modelId: string, providerId: string): Promise<void> {
const index = this.favoriteModels.findIndex(f => f.modelId === modelId && f.providerId === providerId)
if (index >= 0) {
this.favoriteModels.splice(index, 1)
await this.save()
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeFavorite AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left modelId AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async removeFavorite(modelId: string, providerId: string): Promise<void> {
const index = this.favoriteModels.findIndex(f => f.modelId === modelId && f.providerId === providerId)
if (index >= 0) {
this.favoriteModels.splice(index, 1)
await this.save()
}
} | https://github.com/LongLiveY96/chatcube | 5a0d441138de2d9eb6dbe7e97f42c1df67ad1a8f | github |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | startAudioSending | ============================================================
启停控制
============================================================
启动音频发送 | public async startAudioSending(): Promise<boolean> {
if (this.audioCapture !== null) {
await this.audioCapture.start();
}
LogUtil.info('[MediaStream] 音频发送已启动');
return true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left startAudioSending AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public async startAudioSending(): Promise<boolean> {
if (this.audioCapture !== null) {
await this.audioCapture.start();
}
LogUtil.info('[MediaStream] 音频发送已启动');
return true;
} | https://github.com/tdcare/tdwebrtc | 59c09bb927729cf164f0fbd300144e4ff3d6766b | github |
the-wwyang/kids-learning-app | src/main/ets/common/ErrorHandler.ets | arkts | validate | 验证数据并返回结果 | public static validate<T>(
data: T,
validator: (data: T) => boolean,
errorMessage: string,
context: string
): ErrorResult<T> {
try {
if (validator(data)) {
return {
success: true,
data: data
};
} else {
const errorInfo = this.handleError(
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left validate AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AS... | public static validate<T>(
data: T,
validator: (data: T) => boolean,
errorMessage: string,
context: string
): ErrorResult<T> {
try {
if (validator(data)) {
return {
success: true,
data: data
};
} else {
const errorInfo = this.handleError(
... | https://github.com/the-wwyang/kids-learning-app | cb2bcef4d6c392a3a885186e5a7003728f2f806d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | saveItemCategoryMap | 保存内容-分类映射 | private async saveItemCategoryMap(): Promise<void> {
try {
// 检查SettingsManager是否已初始化
if (!this.settingsManager.isInitialized()) {
logger.warn(TAG, '跳过保存映射:SettingsManager未初始化');
return;
}
const mapObj: Record<string, CategoryItem> = {};
this.itemCategoryMap.forEach((... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveItemCategoryMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private async saveItemCategoryMap(): Promise<void> {
try {
// 检查SettingsManager是否已初始化
if (!this.settingsManager.isInitialized()) {
logger.warn(TAG, '跳过保存映射:SettingsManager未初始化');
return;
}
const mapObj: Record<string, CategoryItem> = {};
this.itemCategoryMap.forEach((... | https://github.com/DaLongZhuaZi/manxia | d269949c6788769b1a99007d1c6c2967bdb413bf | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test10_original_index.ets | arkts | testNestedRecord | --- Nested Record types --- | function testNestedRecord(): string {
let person: Record<string, Record<string, number>> = {};
let address: Record<string, number> = {};
address['lat'] = 40;
address['lng'] = -74;
person['home'] = address;
let home: Record<string, number> = person['home'];
let lat: number = home['lat'];
return String(la... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedRecord AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testNestedRecord(): string {
let person: Record<string, Record<string, number>> = {};
let address: Record<string, number> = {};
address['lat'] = 40;
address['lng'] = -74;
person['home'] = address;
let home: Record<string, number> = person['home'];
let lat: number = home['lat'];
return String(la... | https://github.com/miaochiahao/ark-ghidra | 7626fe18da5a1af16615424975e8359cdc8aa842 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | hexDecodeToByteArray | Hex解码到字节数组 | hexDecodeToByteArray(hex: string): Uint8Array | null {
if (!hex) return null;
try {
const bytes = new Uint8Array(hex.length / 2);
for (let i = 0; i < hex.length; i += 2) {
bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
}
return bytes;
} catch (error) {
logger.warn(TAG... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left hexDecodeToByteArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | hexDecodeToByteArray(hex: string): Uint8Array | null {
if (!hex) return null;
try {
const bytes = new Uint8Array(hex.length / 2);
for (let i = 0; i < hex.length; i += 2) {
bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
}
return bytes;
} catch (error) {
logger.warn(TAG... | https://github.com/DaLongZhuaZi/manxia | 0918cfa915a9c73ad060eaa5647fb1020d0cb98d | github |
openharmony/applications_app_samples | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | parseImageQRCode | 解析图片二维码信息
@param canvasContext
@param imageSrc | async parseImageQRCode(imageSrc: string): Promise<DecodeResultAttribute> {
Logger.info(TAG, `parseImageQRCode start`);
let parseResult: DecodeResultAttribute = {
isSucess: false,
decodeResult: 'failed'
};
let width: number;
let height: number;
let pixelBytesNumber: number;
let ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left parseImageQRCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageSrc AST#identifier#Right AST#type_annotation#Lef... | async parseImageQRCode(imageSrc: string): Promise<DecodeResultAttribute> {
Logger.info(TAG, `parseImageQRCode start`);
let parseResult: DecodeResultAttribute = {
isSucess: false,
decodeResult: 'failed'
};
let width: number;
let height: number;
let pixelBytesNumber: number;
let ... | https://github.com/openharmony/applications_app_samples | 673ccc47e35b01bab4845e1ef36ccfab6a37c889 | github |
xblLab/HarmonyProjectTemplate | products/phone/src/main/ets/common/NetworkUtils.ets | arkts | unRegisterNetwork | 取消注册网络监听 | public static unRegisterNetwork() {
let networkInstance = NetworkUtil.getInstance();
networkInstance.unregister();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left unRegisterNetwork AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | public static unRegisterNetwork() {
let networkInstance = NetworkUtil.getInstance();
networkInstance.unregister();
} | https://github.com/xblLab/HarmonyProjectTemplate | 52085dc5caba1688fc3cdfe95f89afdddedad55b | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/Transformer.ets | arkts | pixelsToValue | Transforms the given array of touch positions (pixels) (x, y, x, y, ...)
into values on the chart.
@param pixels | public pixelsToValue(pixels: number[]) {
let tmp: Matrix = this.mPixelToValueMatrixBuffer;
tmp.reset();
// invert all matrixes to convert back to the original value
this.mMatrixOffset.invert(tmp);
tmp.mapPoints(pixels);
this.mViewPortHandler.getMatrixTouch().invert(tmp);
tmp.mapPoints(p... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pixelsToValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pixels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expres... | public pixelsToValue(pixels: number[]) {
let tmp: Matrix = this.mPixelToValueMatrixBuffer;
tmp.reset();
// invert all matrixes to convert back to the original value
this.mMatrixOffset.invert(tmp);
tmp.mapPoints(pixels);
this.mViewPortHandler.getMatrixTouch().invert(tmp);
tmp.mapPoints(p... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 06aace62c124a9beec859261b194a9fe3a260043 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | findLastIndex | Finds an index of the last element in the BigUint64Array that satisfies the condition
@param { function } fn - condition
@returns { int } - the index of the last element that satisfies fn, -1 otherwise
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLastIndex(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; i--) {
if (fn(new BigInt(this.getUnsafe(i)), i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): int {
for (let i = this.lengthInt - 1; i >= 0; i--) {
if (fn(new BigInt(this.getUnsafe(i)), i, this)) {
return i
}
}
return -1
} | https://gitcode.com/iop123123/arkts-static-skills | d07682bf94fc2f7d84706d446818a5ed3554406e | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/BreakpointSystem.ets | arkts | getWidthValueWithHeightSM | Like {@link getValue} but may return {@link heightSm} for SM width + MD height.
@param widthBp Current width breakpoint.
@param heightBp Current height breakpoint.
@returns Effective layout value. | public getWidthValueWithHeightSM(widthBp: WidthBreakpoint, heightBp: HeightBreakpoint): T {
if (heightBp === HeightBreakpoint.HEIGHT_MD && widthBp === WidthBreakpoint.WIDTH_SM) {
return this.heightSm !== undefined ? this.heightSm : this.sm;
}
return this.getValue(widthBp);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWidthValueWithHeightSM AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left widthBp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | public getWidthValueWithHeightSM(widthBp: WidthBreakpoint, heightBp: HeightBreakpoint): T {
if (heightBp === HeightBreakpoint.HEIGHT_MD && widthBp === WidthBreakpoint.WIDTH_SM) {
return this.heightSm !== undefined ? this.heightSm : this.sm;
}
return this.getValue(widthBp);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | e545370518034add8faddf2851e7d2ae2838f41f | gitcode |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | deleteCartItems | 删除购物车中已下单的商品
@returns {Promise<void>} Promise<void> | async deleteCartItems(): Promise<void> {
if (!this.cachedCarts || this.cachedCarts.length === 0) {
return;
}
for (const cart of this.cachedCarts) {
const goodsId = cart.goodsId;
// 获取该商品所有的规格ID
const specIds = new Set(cart.spec.map((s: CartGoodsSpec): number => s.id));
// ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteCartItems AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left... | async deleteCartItems(): Promise<void> {
if (!this.cachedCarts || this.cachedCarts.length === 0) {
return;
}
for (const cart of this.cachedCarts) {
const goodsId = cart.goodsId;
// 获取该商品所有的规格ID
const specIds = new Set(cart.spec.map((s: CartGoodsSpec): number => s.id));
// ... | https://github.com/Joker-x-dev/CoolMallArkTS | da7a6fc1f6f60c4bbed05ca00ecee65d86c90867 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new instance of Box with the specified initial value.
@param { T } value - The initial value to be wrapped
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(value: T) {
this.value = value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Ri... | public constructor(value: T) {
this.value = value;
} | https://gitcode.com/iop123123/arkts-static-skills | e84bf8dec8b81b739cb725265ab493cf50105b6b | gitcode |
xblLab/HarmonyProjectTemplate | commons/lib_common/src/main/ets/utils/PopViewUtils.ets | arkts | showSheet | 打开半模态弹窗
@param contentView
@param args
@param options | public static showSheet<T extends Object>(contentView: WrappedBuilder<[T]> | WrappedBuilder<[]>,
options?: SheetOptions, args?: T): void {
PopViewUtils.showSheetView(PopViewShowType.OPEN, contentView, args, options);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left showSheet AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type_iden... | public static showSheet<T extends Object>(contentView: WrappedBuilder<[T]> | WrappedBuilder<[]>,
options?: SheetOptions, args?: T): void {
PopViewUtils.showSheetView(PopViewShowType.OPEN, contentView, args, options);
} | https://github.com/xblLab/HarmonyProjectTemplate | e0c685f457ad187503853ed9476d3b2d2795e9fc | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | readableEncoding | Getter for the property encoding of a given Readable stream. The encoding property can be set using the
readable.setEncoding() method. | get readableEncoding(): string | null {
return this.readableEncodingInner;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left readableEncoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#ide... | get readableEncoding(): string | null {
return this.readableEncodingInner;
} | https://gitcode.com/iop123123/arkts-static-skills | 4ac49cdfa88e74ea5b22f446c641c2c2a9b9c2d4 | gitcode |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/model/SongDataSource.ets | arkts | notifyDataReload | Notifies all listeners that the whole data set was replaced. | public notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyDataReload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expre... | public notifyDataReload(): void {
this.listeners.forEach(listener => {
listener.onDataReloaded();
});
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 6deaf89952173a1e69f8dc49ccc2d4d1036827e5 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/common/src/main/ets/view/ContributorsPage.ets | arkts | build | 构建贡献者页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: "贡献者",
viewModel: this.vm
}) {
this.ContributorsContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "贡献者",
viewModel: this.vm
}) {
this.ContributorsContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS | 5e82ab2bfd3ac3539043560bfd0fb66f8ba98361 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/entryformability/EntryFormAbility.ets | arkts | getWidgetDataFromPrefs | 从Preferences读取卡片数据 | async function getWidgetDataFromPrefs(context: Context, formId: string): Promise<Record<string, string> | null> {
try {
const prefs = await preferences.getPreferences(context, PREFERENCES_NAME);
const key = WIDGET_DATA_PREFIX + formId;
const jsonData = prefs.getSync(key, '') as string;
if (jsonData) {... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getWidgetDataFromPrefs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Rig... | async function getWidgetDataFromPrefs(context: Context, formId: string): Promise<Record<string, string> | null> {
try {
const prefs = await preferences.getPreferences(context, PREFERENCES_NAME);
const key = WIDGET_DATA_PREFIX + formId;
const jsonData = prefs.getSync(key, '') as string;
if (jsonData) {... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 4b6778d212374969376834d062c6fa15e635f3ab | github |
richshaw2015/nds | ohos/entry/src/test/InputValidation.test.ets | arkts | validateMessage | 验证消息长度
消息最大长度为26个字符
@param message 消息字符串
@returns 验证结果对象 | function validateMessage(message: string): ValidationResult {
const MAX_MESSAGE_LENGTH = 26;
// 消息可以为空
if (message.length > MAX_MESSAGE_LENGTH) {
return { valid: false, error: `消息长度不能超过${MAX_MESSAGE_LENGTH}个字符` };
}
return { valid: true };
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left validateMessage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | function validateMessage(message: string): ValidationResult {
const MAX_MESSAGE_LENGTH = 26;
// 消息可以为空
if (message.length > MAX_MESSAGE_LENGTH) {
return { valid: false, error: `消息长度不能超过${MAX_MESSAGE_LENGTH}个字符` };
}
return { valid: true };
} | https://github.com/richshaw2015/nds | fa5761f7dd6658473c9ab269287d5cae9242e2f0 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/GuidePage.ets | arkts | setBackgroundColor | 设置引导页的背景色
@param backgroundColor 背景色,默认:#99000000
@returns 当前引导页 | public setBackgroundColor(backgroundColor: string): GuidePage {
this.backgroundColor = backgroundColor;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left backgroundColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | public setBackgroundColor(backgroundColor: string): GuidePage {
this.backgroundColor = backgroundColor;
return this;
} | https://github.com/wuba/omni-ui | 64c32ff5614bf7737df67a244cc754f4464c2d47 | github |
ibestservices/ibest-ui | library/src/main/ets/components/button/index.ets | arkts | getBtnTextColor | 获取按钮文字的颜色 | getBtnTextColor() {
if (this.fontColor) {
return this.fontColor
}
if (this.plain) {
return this.color ? this.color : this.type === COLOR_TYPE.DEFAULT ? IBestButtonColor.textColor : this.baseStyle[this.type]
}
return this.type === COLOR_TYPE.DEFAULT ? IBestButtonColor.textColor : IBestButtonColor.whiteC... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBtnTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | getBtnTextColor() {
if (this.fontColor) {
return this.fontColor
}
if (this.plain) {
return this.color ? this.color : this.type === COLOR_TYPE.DEFAULT ? IBestButtonColor.textColor : this.baseStyle[this.type]
}
return this.type === COLOR_TYPE.DEFAULT ? IBestButtonColor.textColor : IBestButtonColor.whiteC... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/button/index.ets#L242-L250 | 1e560c6ead7e2db3a89472eb9d7a9d4915274023 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an object of FixedArray<int>.
@param { FixedArray<int> } arr - An instance of the FixedArray type to convert to an array.
@returns { Uint32Array } - A new Uint32Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<int>): Uint32Array {
let result = new Uint32Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: FixedArray<int>): Uint32Array {
let result = new Uint32Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 9c311e01e30a66ec9439c4a596f255ca9a2a8a28 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Short.ets | arkts | mul | Performs shortegral multiplication of this instance with provided one, returns the result as new instance
@param other Right hand side of the multiplication
@returns Result of the multiplication | public mul(other: Short): Short {
return Short.valueOf((this.value * other.shortValue()) as short)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public mul(other: Short): Short {
return Short.valueOf((this.value * other.shortValue()) as short)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 14fbb395d44b68abbb1b82f2bd73ca4a4e89e390 | gitee |
PollenWang6/HiXD | entry/src/main/ets/services/ExperimentService.ets | arkts | fetchOtherExperimentsNoLogin | ===== 免登录拉取当前周实验 ===== | async fetchOtherExperimentsNoLogin(): Promise<ExperimentData[]> {
console.info(TAG, 'fetchOtherExperimentsNoLogin: start');
try {
return await this._fetchOtherExperimentsInner();
} catch (e) {
console.error(TAG, 'fetchOtherExperimentsNoLogin failed: ' + String(e));
return [];
}
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchOtherExperimentsNoLogin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left ... | async fetchOtherExperimentsNoLogin(): Promise<ExperimentData[]> {
console.info(TAG, 'fetchOtherExperimentsNoLogin: start');
try {
return await this._fetchOtherExperimentsInner();
} catch (e) {
console.error(TAG, 'fetchOtherExperimentsNoLogin failed: ' + String(e));
return [];
}
} | https://github.com/PollenWang6/HiXD | 8b8658d73297de11741bc875139dbb5caba462ea | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | sortMusicByRelevance | 按相关性排序 | private sortMusicByRelevance(musicList: MusicInfo[], keyword: string): MusicInfo[] {
const lowerKeyword = keyword.toLowerCase()
return musicList.sort((a, b) => {
const aScore = this.calculateRelevanceScore(a, lowerKeyword)
const bScore = this.calculateRelevanceScore(b, lowerKeyword)
return ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sortMusicByRelevance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left musicList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub... | private sortMusicByRelevance(musicList: MusicInfo[], keyword: string): MusicInfo[] {
const lowerKeyword = keyword.toLowerCase()
return musicList.sort((a, b) => {
const aScore = this.calculateRelevanceScore(a, lowerKeyword)
const bScore = this.calculateRelevanceScore(b, lowerKeyword)
return ... | https://github.com/cpdd5201314/harmonyOS-music-app | 7532597ce6326b4ec98b7445315e0135b28ff3a0 | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/BillStatisticsUtil.ets | arkts | getMonthlyStatistics | 获取指定年月的统计数据 | static getMonthlyStatistics(bills: BillModel[], year: string, month: string): BillStatistics {
const yearMonth = `${year}-${month.padStart(2, '0')}`;
const monthlyBills = bills.filter(bill => bill.getYearMonth() === yearMonth);
return BillStatisticsUtil.calculateStatistics(monthlyBills);
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMonthlyStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_... | static getMonthlyStatistics(bills: BillModel[], year: string, month: string): BillStatistics {
const yearMonth = `${year}-${month.padStart(2, '0')}`;
const monthlyBills = bills.filter(bill => bill.getYearMonth() === yearMonth);
return BillStatisticsUtil.calculateStatistics(monthlyBills);
... | https://github.com/qiuhaotc/HarmonyOSPlayground | 618c86a0583995afdc645b34b9d78f48e8a5d025 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/pages/CouponListPage.ets | arkts | getCouponColor | 获取优惠券颜色:可用粉色,已使用灰色,已过期红灰色 | getCouponColor(group: GroupedCoupon): string {
if (this.isExpired(group.coupon.expiryDate)) {
return '#BDBDBD'; // 已过期 - 灰色
} else if (group.unusedCount === 0) {
return '#BDBDBD'; // 已使用 - 灰色
}
return '#FF6B9D'; // 可用 - 粉色
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCouponColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GroupedCoupon AST#identifier#Right AST#)... | getCouponColor(group: GroupedCoupon): string {
if (this.isExpired(group.coupon.expiryDate)) {
return '#BDBDBD'; // 已过期 - 灰色
} else if (group.unusedCount === 0) {
return '#BDBDBD'; // 已使用 - 灰色
}
return '#FF6B9D'; // 可用 - 粉色
} | https://github.com/Harrisonls2004/WaterFlow | 26e1d7f7743d53fd63645532d3a609d1c1907720 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarDataSet.ets | arkts | setStackLabels | Sets labels for different values of bar-stacks, in case there are one.
@param labels | public setStackLabels(labels: string[]): void {
this.mStackLabels = labels;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setStackLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left labels AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre... | public setStackLabels(labels: string[]): void {
this.mStackLabels = labels;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 20138fbfc6c45b96aeb20ef8e73e2a84be88f2d5 | gitee |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/models/BillModel.ets | arkts | getYearMonth | 获取年月 格式: YYYY-MM | getYearMonth(): string {
return this.date.substring(0, 7);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getYearMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement... | getYearMonth(): string {
return this.date.substring(0, 7);
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 9582259d9a9a9cd8b1a81286fcba0c66574b69e2 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | favCatColor | Favcat slot id ('0'..'9', 'a', 'l') → its display color; '' for an out-of-range/empty slot. | static favCatColor(slot: string): string {
if (slot === 'a') {
return '#B5A4A4'
}
if (slot === 'l') {
return '#A99E68'
}
const i: number = Number.parseInt(slot, 10)
return i >= 0 && i < EhConstants.FAV_COLORS.length ? EhConstants.FAV_COLORS[i] : ''
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left favCatColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slot AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri... | static favCatColor(slot: string): string {
if (slot === 'a') {
return '#B5A4A4'
}
if (slot === 'l') {
return '#A99E68'
}
const i: number = Number.parseInt(slot, 10)
return i >= 0 && i < EhConstants.FAV_COLORS.length ? EhConstants.FAV_COLORS[i] : ''
} | https://github.com/erosTeam/NextE | 3a4d542e52930437ccf0bd2d6c92b8535eadd898 | github |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toRefund | 跳转到退款申请
@param {number} orderId - 订单 ID
@returns {void} 无返回值 | static toRefund(orderId: number): void {
const params: OrderIdParam = { orderId };
navigateTo(OrderRoutes.Refund, params);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toRefund AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orderId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right ... | static toRefund(orderId: number): void {
const params: OrderIdParam = { orderId };
navigateTo(OrderRoutes.Refund, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 144f549215b3638e5a10039dee608583bddf670e | github |
CLMC2025/Vignette | entry/src/main/ets/utils/SecureStorage.ets | arkts | saveApiKey | Save API key securely
@param apiKey The API key to save | async saveApiKey(apiKey: string): Promise<boolean> {
console.log('[SecureStorage] saveApiKey: Attempting to save API key');
if (!await this.ensureInitialized()) {
console.error('[SecureStorage] saveApiKey: Failed to initialize storage');
return false;
}
try {
if (!this.preferen... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveApiKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left apiKey AST#identifier#Right AST#type_annotation#Left AST#:#... | async saveApiKey(apiKey: string): Promise<boolean> {
console.log('[SecureStorage] saveApiKey: Attempting to save API key');
if (!await this.ensureInitialized()) {
console.error('[SecureStorage] saveApiKey: Failed to initialize storage');
return false;
}
try {
if (!this.preferen... | https://github.com/CLMC2025/Vignette | 3a099e5883333f2d2d9ea8d73d4799463035106f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | isLocalFilePath | [新增] 判断 URL 是否为本地文件路径 | private isLocalFilePath(url: string): boolean {
if (!url) {
return false;
}
// file:// 协议
if (url.startsWith('file://')) {
return true;
}
// 绝对路径 (Unix 风格)
if (url.startsWith('/')) {
return true;
}
// 特定的本地存储路径
if (url.startsWith('storage/') || url.startsWith(... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isLocalFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private isLocalFilePath(url: string): boolean {
if (!url) {
return false;
}
// file:// 协议
if (url.startsWith('file://')) {
return true;
}
// 绝对路径 (Unix 风格)
if (url.startsWith('/')) {
return true;
}
// 特定的本地存储路径
if (url.startsWith('storage/') || url.startsWith(... | https://github.com/DaLongZhuaZi/manxia | 27189b6e8da2d5f46d232023094587c14726169c | github |
mqxu/HarmonyOS_In_Action | examples/01_foundation/F002_state_management/entry/src/main/ets/utils/StateManager.ets | arkts | isInRange | 验证数字是否在指定范围内
@param value 要验证的值
@param min 最小值
@param max 最大值
@returns 是否在范围内 | static isInRange(value: number, min: number, max: number): boolean {
return value >= min && value <= max;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isInRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | static isInRange(value: number, min: number, max: number): boolean {
return value >= min && value <= max;
} | https://github.com/mqxu/HarmonyOS_In_Action | 55b27624cb6e7e7cbfc682ac977c77574e1194d7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | setNsfwScopeBookSource | 设置书源NSFW作用域 | public async setNsfwScopeBookSource(enabled: boolean): Promise<void> {
try {
await this.settingsManager.setBoolean(SettingKeys.NSFW_SCOPE_BOOK_SOURCE_ENABLED, enabled);
this.nsfwScopeBookSourceEnabled = enabled;
logger.info(TAG, `书源NSFW作用域已${enabled ? '启用' : '禁用'}`);
} catch (error) {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setNsfwScopeBookSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#... | public async setNsfwScopeBookSource(enabled: boolean): Promise<void> {
try {
await this.settingsManager.setBoolean(SettingKeys.NSFW_SCOPE_BOOK_SOURCE_ENABLED, enabled);
this.nsfwScopeBookSourceEnabled = enabled;
logger.info(TAG, `书源NSFW作用域已${enabled ? '启用' : '禁用'}`);
} catch (error) {
... | https://github.com/DaLongZhuaZi/manxia | 7285afc4c0147a78009cd2a092c54a688435d914 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | slice | Creates a slice of current Int8Array using range [begin, end)
{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sliceFromTo}
@param { int } [begin] - start index to be taken into slice
@param { int } [end] - last index to be taken into slice
@returns { Int8Array } - a ne... | public slice(begin?: int, end?: int): Int8Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#... | public slice(begin?: int, end?: int): Int8Array {
return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt)
} | https://gitcode.com/iop123123/arkts-static-skills | 28db368f84ade65b159401dd97148cf4f33b4dde | gitcode |
Joker-x-dev/CoolMallArkTS | feature/launch/src/main/ets/viewmodel/GuideViewModel.ets | arkts | onStartExperienceClick | 点击开始体验
@returns {void} 无返回值 | onStartExperienceClick(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onStartExperienceClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_exp... | onStartExperienceClick(): void {
} | https://github.com/Joker-x-dev/CoolMallArkTS | 138686d9f7b792deaec0115653ba0b550f914d3e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | extractTitleFromFileName | 从文件名提取书名 | protected extractTitleFromFileName(fileName: string): string {
// 移除文件扩展名
const nameWithoutExt = fileName.replace(/\.(txt|epub|mobi|azw|azw3|pdf)$/i, '');
// 移除可能的特殊字符和数字后缀
const cleanName = nameWithoutExt.replace(/[\[\]()()【】_-]+$/, '').trim();
return cleanName || '未知书名';
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left extractTitleFromFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Lef... | protected extractTitleFromFileName(fileName: string): string {
// 移除文件扩展名
const nameWithoutExt = fileName.replace(/\.(txt|epub|mobi|azw|azw3|pdf)$/i, '');
// 移除可能的特殊字符和数字后缀
const cleanName = nameWithoutExt.replace(/[\[\]()()【】_-]+$/, '').trim();
return cleanName || '未知书名';
} | https://github.com/DaLongZhuaZi/manxia | 372d7db56f17561aee06aa864a009075f5d69f0c | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/OmniPopup.ets | arkts | setBackgroundColor | 全局设置-设置弹窗背景
@param color | static setBackgroundColor(color: ResourceColor) {
Config.popupConfig.backgroundColor = color
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | static setBackgroundColor(color: ResourceColor) {
Config.popupConfig.backgroundColor = color
} | https://github.com/wuba/omni-ui | 24f66cadfa49feb0db0adbf344c3316387a80359 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | updateCategory | 更新分类
@param categoryId 分类ID
@param params 更新参数 | async updateCategory(categoryId: string, params: { name?: string; icon?: string; sortOrder?: number }): Promise<ApiResponse<KnowledgeCategory>> {
return this.client.put<KnowledgeCategory>(`/api/v1/knowledge/categories/${categoryId}`, params)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left categoryId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async updateCategory(categoryId: string, params: { name?: string; icon?: string; sortOrder?: number }): Promise<ApiResponse<KnowledgeCategory>> {
return this.client.put<KnowledgeCategory>(`/api/v1/knowledge/categories/${categoryId}`, params)
} | https://github.com/David8Idira/AI-OA | e815ecf1475988536b3e50adc9a13c1c6e420baf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | timeFormat | 时间格式化 | timeFormat(time: number): string {
const date = new Date(time);
return date.toLocaleString();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left timeFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#... | timeFormat(time: number): string {
const date = new Date(time);
return date.toLocaleString();
} | https://github.com/DaLongZhuaZi/manxia | 7ac2b093825ada6fd2cd63e0c55f2e2046a40701 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/deepseek/SiliconFlowClient.ets | arkts | createOrGetSession | 创建或获取对话会话 | createOrGetSession(sessionId: string, userId: string): ConversationSession {
let session = this.sessions.get(sessionId);
if (!session) {
session = {
sessionId,
userId,
messages: [],
createdAt: Date.now(),
lastActivityAt: Date.now()
};
this.sessions.se... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createOrGetSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left ,... | createOrGetSession(sessionId: string, userId: string): ConversationSession {
let session = this.sessions.get(sessionId);
if (!session) {
session = {
sessionId,
userId,
messages: [],
createdAt: Date.now(),
lastActivityAt: Date.now()
};
this.sessions.se... | https://github.com/LJ666-ui/harmony-health-care | 602e90d8fbd34605c47ef1e4646692140cdd8db1 | github |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/Logger.ets | arkts | decryptLogFile | 解密日志文件并将解密后的内容写入指定路径的文件中。
@param logPath 需要解密的日志文件路径。
@param encryptKey 用于解密的密钥,类型为Uint8Array。
@param decryptLogPath 解密后的日志文件存储路径。
@returns 如果解密和写入成功,返回true;否则返回false。 | async decryptLogFile(logPath: string, encryptKey: Uint8Array, decryptLogPath: string): Promise<boolean> {
return loggerFileUtil.decryptLogFile(logPath, encryptKey, decryptLogPath)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left decryptLogFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left logPath AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async decryptLogFile(logPath: string, encryptKey: Uint8Array, decryptLogPath: string): Promise<boolean> {
return loggerFileUtil.decryptLogFile(logPath, encryptKey, decryptLogPath)
} | https://github.com/chenchl/GMLogger-HarmonyOS | b4fa0f25811780960f3712a9fc9d7b94e4d7d912 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | padEnd | The padEnd() method pads the current string with a given string (repeated, if needed)
so that the resulting string reaches a given length.
The padding is applied from the end of the current string.
@param { int } end int
@param { char } ch char
@returns { String } string with the padString applied at the end of the cur... | public padEnd(end: int): String {
return this.padEnd(end, ' ')
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#id... | public padEnd(end: int): String {
return this.padEnd(end, ' ')
} | https://gitcode.com/iop123123/arkts-static-skills | ad0345e92ba94c6968711ca4379c200db96da339 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/storage/AchievementStorageService.ets | arkts | getLastSyncTime | 获取最后同步时间
@returns ISO时间字符串 | static async getLastSyncTime(): Promise<string> {
try {
return await dataStorage.getString(
AchievementStorageService.STORE_NAME,
AchievementStorageService.KEY_LAST_SYNC,
''
);
} catch (error) {
console.error('[AchievementStorage] Failed to get last sync time:', error... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getLastSyncTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | static async getLastSyncTime(): Promise<string> {
try {
return await dataStorage.getString(
AchievementStorageService.STORE_NAME,
AchievementStorageService.KEY_LAST_SYNC,
''
);
} catch (error) {
console.error('[AchievementStorage] Failed to get last sync time:', error... | https://github.com/the-wwyang/kids-learning-app | dee786c6cee30cac6725d55339995f81854daad5 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | transaction | 统一事务处理
自动处理事务的开启、提交和回滚
@param fn 要在事务中执行的函数
@param errorPrefix 错误消息前缀 | static async transaction(fn: () => Promise<void>, errorPrefix: string = '[DAO]'): Promise<void> {
const store = DatabaseManager.getDatabase();
await store.beginTransaction();
try {
await fn();
await store.commit();
} catch (error) {
await store.rollBack();
throw DAOHelper.toErr... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left transaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#... | static async transaction(fn: () => Promise<void>, errorPrefix: string = '[DAO]'): Promise<void> {
const store = DatabaseManager.getDatabase();
await store.beginTransaction();
try {
await fn();
await store.commit();
} catch (error) {
await store.rollBack();
throw DAOHelper.toErr... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cd4ab14cd17fb407375b802255520f47caae5834 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets | arkts | getFontScale | 获取字体缩放比例 | public static getFontScale(): number {
return ResponsiveLayoutHelper.getLayoutParams().fontScale;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getFontScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public static getFontScale(): number {
return ResponsiveLayoutHelper.getLayoutParams().fontScale;
} | https://github.com/DaLongZhuaZi/manxia | 6b57b8234f622215fd664dad0f89a870fca20a34 | github |
iop123123/arkts-static-skills | skills/arkts-auto-test/tests/bug-date-getyear.ets | arkts | main | Demonstrates: Date.getYear() returns full year (2024), not year-1900 (124)
JS spec: getYear() should return year - 1900
ArkTS-Sta impl: getYear() is aliased to getFullYear() | function main(): int {
const suite = new arktest.ArkTestsuite("date-getyear-bug");
suite.addTest("getYear returns full year instead of year-1900", () => {
const date = new Date(2024, 0, 1);
const actual = date.getYear();
const expectedBySpec = 2024 - 1900; // 124 per JS spec
cons... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left i... | function main(): int {
const suite = new arktest.ArkTestsuite("date-getyear-bug");
suite.addTest("getYear returns full year instead of year-1900", () => {
const date = new Date(2024, 0, 1);
const actual = date.getYear();
const expectedBySpec = 2024 - 1900; // 124 per JS spec
cons... | https://gitcode.com/iop123123/arkts-static-skills | d530083ba05e97c87e5bb5d24c1d7750747227eb | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Recorder/RecorderIndexPage.ets | arkts | startPlayingCount | 播放时间计时开始 | startPlayingCount(duration: number) {
this.isPlaying = true
// 定义变量来保存当前的时间
this.playingTime = 0
// 定义更新间隔,单位为毫秒
const interval = 200
clearInterval(this.playingTimerId)
this.playingTimerId = setInterval(() => {
// 获取当前时间
this.playingTime += interval
if (this.playingTime >... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startPlayingCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right... | startPlayingCount(duration: number) {
this.isPlaying = true
// 定义变量来保存当前的时间
this.playingTime = 0
// 定义更新间隔,单位为毫秒
const interval = 200
clearInterval(this.playingTimerId)
this.playingTimerId = setInterval(() => {
// 获取当前时间
this.playingTime += interval
if (this.playingTime >... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | cb407fb86db51c59d813bf68b45cff4656979979 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/AnomalyDetectionService.ets | arkts | detectBillAnomaly | 检测单条账单是否异常
@param bill 账单对象
@param userId 用户ID
@returns 异常检测结果 | static async detectBillAnomaly(bill: Bill, userId: number): Promise<AnomalyDetectionResult[]> {
try {
const results: AnomalyDetectionResult[] = [];
// 获取用户的消费基线
const baseline = await UserSpendingBaselineDAO.getByUserId(userId);
if (!baseline) {
// 如果没有基线,先创建基线
await Anoma... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left detectBillAnomaly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bill AST#identifier#Right AST#:#Left :... | static async detectBillAnomaly(bill: Bill, userId: number): Promise<AnomalyDetectionResult[]> {
try {
const results: AnomalyDetectionResult[] = [];
// 获取用户的消费基线
const baseline = await UserSpendingBaselineDAO.getByUserId(userId);
if (!baseline) {
// 如果没有基线,先创建基线
await Anoma... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 95bd802a3278ca3734a76530e87dc80ae7cc515e | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/AppStateManager.ets | arkts | getCurrentModelName | 获取当前模型名称 | getCurrentModelName(): string {
return this.currentModelName
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentModelName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#st... | getCurrentModelName(): string {
return this.currentModelName
} | https://github.com/LongLiveY96/chatcube | 422c3b530ce2ad45cd3037835232ea607f6c371d | github |
Jack-TCN/richEditor | src/main/ets/controller/RichEditorController.ets | arkts | reSelect | 重新选中状态
@param start
@param end | reSelect(start: number | undefined, end: number | undefined) {
if (start !== undefined && end !== undefined) {
if (end - start <= 0) {
return;
}
this.controller.setSelection(start, end);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left numb... | reSelect(start: number | undefined, end: number | undefined) {
if (start !== undefined && end !== undefined) {
if (end - start <= 0) {
return;
}
this.controller.setSelection(start, end);
}
} | https://github.com/Jack-TCN/richEditor | 376cd4cf254e07cc8544367c1e5c9f465029344b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NativeJsEngine.ets | arkts | setContext | 设置执行上下文 | private setContext(context: JsContext): void {
if (!jsvmEngine) {
return;
}
if (context.result !== undefined) {
jsvmEngine.setGlobalString(this.vmId, 'result', context.result);
}
if (context.baseUrl !== undefined) {
jsvmEngine.setGlobalString(this.vmId, 'baseUrl', context.baseUrl... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private setContext(context: JsContext): void {
if (!jsvmEngine) {
return;
}
if (context.result !== undefined) {
jsvmEngine.setGlobalString(this.vmId, 'result', context.result);
}
if (context.baseUrl !== undefined) {
jsvmEngine.setGlobalString(this.vmId, 'baseUrl', context.baseUrl... | https://github.com/DaLongZhuaZi/manxia | cdc67f6643e95e11e84da916a5bf9c1d7658bb15 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets | arkts | toByte | Returns value of this instance
@returns { byte }
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toByte(): byte {
return this.value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toByte AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left... | public override toByte(): byte {
return this.value;
} | https://gitcode.com/iop123123/arkts-static-skills | 578e38e620e7845b19e6c0fc1395b2d9828f08bb | gitcode |
CLMC2025/Vignette | entry/src/main/ets/utils/TimerManager.ets | arkts | clearTimeout | 清除指定定时器
@param timerId 定时器 ID | clearTimeout(timerId: TimerId): void {
if (timerId <= 0) {
return;
}
try {
clearTimeout(timerId);
} catch (e) {
// 忽略清除错误
}
this.timers.delete(timerId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timerId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TimerId AST#identifier#Right AST#)#Left ... | clearTimeout(timerId: TimerId): void {
if (timerId <= 0) {
return;
}
try {
clearTimeout(timerId);
} catch (e) {
// 忽略清除错误
}
this.timers.delete(timerId);
} | https://github.com/CLMC2025/Vignette | cb293c9539fd05f271e2e7f32dd0be224ab75f67 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | toLocaleTimeString | Gets a string with a language-sensitive representation of the time portion of the date with respect to locale.
@param locale
@returns a language-sensitive representation of the time portion of the date with respect to locale. | public toLocaleTimeString(locale: String): String {
return Date.getLocaleString("%EX", locale, this.ms, false);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleTimeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | public toLocaleTimeString(locale: String): String {
return Date.getLocaleString("%EX", locale, this.ms, false);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0a557a0a1947cbf990959538131e289a553ae02d | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | setAttributes | 设置节点属性集合
@param attributes 属性集合 | public setAttributes(attributes: Object): void {
this._formatResultObj[SVGAttrConstants.ATTR_KEY_ATTRIBUTES] = attributes;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAttributes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attributes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#i... | public setAttributes(attributes: Object): void {
this._formatResultObj[SVGAttrConstants.ATTR_KEY_ATTRIBUTES] = attributes;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 5dea20dedfb9405d0e1b8c91f44637e8c047dd22 | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | approvalAction | 审批操作(同意/拒绝/转交)
@param params 操作参数 | async approvalAction(params: ApprovalActionParams): Promise<ApiResponse<any>> {
return this.client.post<any>('/api/v1/approval/approvals/action', params)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left approvalAction AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async approvalAction(params: ApprovalActionParams): Promise<ApiResponse<any>> {
return this.client.post<any>('/api/v1/approval/approvals/action', params)
} | https://github.com/David8Idira/AI-OA | 9968fb4b167da8495371e220788d88c9da6cee7f | github |
JQHxx/codelabs | OxHornCampus/entry/src/main/ets/common/utils/Animation.ets | arkts | changeTitleIcon | Get the title icon accord to the offset sum.
@param pageThis | public static changeTitleIcon(animationItem: AnimationItem) {
let imageHeightVP = (animationItem.screenHeight * animationItem.imageHeight) / CommonConstants.FULL_PERCENT_NUMBER;
let firstStarLine = imageHeightVP + CommonConstants.SECOND_LIST_ITEM_HEIGHT +
CommonConstants.FIXED_ITEM_HEIGHT - CommonConstant... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left changeTitleIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left animationItem AST#identifier#Right AST#... | public static changeTitleIcon(animationItem: AnimationItem) {
let imageHeightVP = (animationItem.screenHeight * animationItem.imageHeight) / CommonConstants.FULL_PERCENT_NUMBER;
let firstStarLine = imageHeightVP + CommonConstants.SECOND_LIST_ITEM_HEIGHT +
CommonConstants.FIXED_ITEM_HEIGHT - CommonConstant... | https://github.com/JQHxx/codelabs | 56c69d7a9034c1a3d700562898824d1f3e6cac1d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | refreshCategories | 刷新分类列表 | private async refreshCategories(): Promise<void> {
this.bookshelfCategories = this.categoryManager.getCategories();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left refreshCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right... | private async refreshCategories(): Promise<void> {
this.bookshelfCategories = this.categoryManager.getCategories();
} | https://github.com/DaLongZhuaZi/manxia | e50dad57e7f282a47cc45a9d8712183880106468 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/network/QrShareService.ets | arkts | canFitInQr | 检查数据是否能放入 QR 码 | static canFitInQr(json: string): boolean {
return json.length <= QR_MAX_CHARS;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left canFitInQr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin... | static canFitInQr(json: string): boolean {
return json.length <= QR_MAX_CHARS;
} | https://github.com/AlkaidLab/moonlight-harmony | 799ed98e874ba6570392f486f1e198864cdab497 | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ResultSetUtils.ets | arkts | getColumnValues | 获取 ResultSet 中指定列的所有值
@param resultSet 查询结果集
@param columnName 列名
@param metadata 实体元数据(可选,用于类型判断)
@returns 值数组 | static getColumnValues(
resultSet: relationalStore.ResultSet,
columnName: string,
metadata?: EntityMetadata
): Array<DbValueType> {
const values: Array<DbValueType> = []
try {
const columnIndex = resultSet.getColumnIndex(columnName)
const columnType = metadata ? metadata.getColumnBy... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getColumnValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expr... | static getColumnValues(
resultSet: relationalStore.ResultSet,
columnName: string,
metadata?: EntityMetadata
): Array<DbValueType> {
const values: Array<DbValueType> = []
try {
const columnIndex = resultSet.getColumnIndex(columnName)
const columnType = metadata ? metadata.getColumnBy... | https://github.com/offlinecat-dev/OCNetORM | d944e518f349a9c7ec88b383f60cecc7364e2f84 | github |
offlinecat-dev/OCNetORM | src/main/ets/core/EntityMetadata.ets | arkts | getColumnByProperty | 根据属性名获取列元数据
@param propertyName ArkTS 属性名
@returns 列元数据,如果不存在返回 null | getColumnByProperty(propertyName: string): ColumnMetadata | null {
for (let i = 0; i < this.columns.length; i++) {
const col = this.columns[i]
if (col.propertyName === propertyName) {
return col
}
}
return null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getColumnByProperty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | getColumnByProperty(propertyName: string): ColumnMetadata | null {
for (let i = 0; i < this.columns.length; i++) {
const col = this.columns[i]
if (col.propertyName === propertyName) {
return col
}
}
return null
} | https://github.com/offlinecat-dev/OCNetORM | 4b06619736812467e9afbe84b6de80240ba7dd13 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets | arkts | writeToGrantResult | 授权或撤销成功后,将结果写入grantResult
@param permission 权限
@param callerAppInfo 调用方信息
@param state 权限状态
return | public writeToGrantResult(
permission: Permission, callerAppInfo: CallerAppInfo, state: abilityAccessCtrl.GrantStatus
): void {
callerAppInfo.reqPerms.forEach((reqPerm, index) => {
if (reqPerm === permission) {
callerAppInfo.grantResult[index] = state;
}
})
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeToGrantResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | public writeToGrantResult(
permission: Permission, callerAppInfo: CallerAppInfo, state: abilityAccessCtrl.GrantStatus
): void {
callerAppInfo.reqPerms.forEach((reqPerm, index) => {
if (reqPerm === permission) {
callerAppInfo.grantResult[index] = state;
}
})
} | https://gitee.com/openharmony/applications_permission_manager.git | 4c3f90e0fd3f2cef365a71e157f8544947cc8597 | gitee |
arkui-x/samples | CodeLab/Cases/feature/imagecompression/src/main/ets/view/ImageCompression.ets | arkts | compressFormatChange | 压缩后图片格式,仅用于自动化用例验证 | compressFormatChange() {
emitter.emit('ImageCompression1', {
data: {
showCompressFormat: this.showCompressFormat
}
});
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left compressFormatChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo... | compressFormatChange() {
emitter.emit('ImageCompression1', {
data: {
showCompressFormat: this.showCompressFormat
}
});
} | https://gitcode.com/arkui-x/samples | 332d53a107126c3894d3f73af191854592ee34c8 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | constructor | Creates a new CharBox instance with an initial value of null character (c'\0').
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.value = c'\0';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.value = c'\0';
} | https://gitcode.com/iop123123/arkts-static-skills | 7a1756bb078115b404ddc2510cecda7bb4a4dbbc | gitcode |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/HttpUtil.ets | arkts | getToken | 获取当前Token | static getToken(): string {
return HttpUtil.token;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string... | static getToken(): string {
return HttpUtil.token;
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 199fdbb0f75f144ecffe9263255a232c50989c09 | github |
openharmony/applications_call | entry/src/main/ets/model/CallManager.ets | arkts | openTimer | open timer
@param { Function } callBack - add updateCallTimeList callBack | openTimer() {
this.timer = setInterval(() => {
this.updateCallTimeList();
if (this.callData.callState === CallStateConst.CALL_STATUS_ACTIVE && this.callList.length === 1) {
clearInterval(this.timer);
}
}, TIMING);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST... | openTimer() {
this.timer = setInterval(() => {
this.updateCallTimeList();
if (this.callData.callState === CallStateConst.CALL_STATUS_ACTIVE && this.callList.length === 1) {
clearInterval(this.timer);
}
}, TIMING);
} | https://gitee.com/openharmony/applications_call.git | e01a23f801f66a0444ce4bb88aee08d3c3ce3dee | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeStateController.ets | arkts | smoothOpenMenu | 打开指定位置的菜单 | public smoothOpenMenu(position: number): void {
if (this._currentOpenPosition !== -1 && this._currentOpenPosition !== position) {
this.smoothCloseMenu();
}
const controller = this._itemControllers.get(position);
if (controller) {
controller.openMenu();
this.set(position);
} else... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left smoothOpenMenu AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public smoothOpenMenu(position: number): void {
if (this._currentOpenPosition !== -1 && this._currentOpenPosition !== position) {
this.smoothCloseMenu();
}
const controller = this._itemControllers.get(position);
if (controller) {
controller.openMenu();
this.set(position);
} else... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 0c3c412f0439b824b6a0ab05f130bf02410c1df1 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | exportToJSON | 导出数据为JSON字符串 | exportToJSON(
words: WordItem[],
definitions: ExportedDefinition[],
versionControl: VersionControl,
fsrsParamsJson: string = '',
userBooks: ExportedUserBook[] = [],
notebook: NotebookWordEntry[] = [],
texts: TextRow[] = [],
reviewEvents: ReviewEventRow[] = [],
dailyActivity: DailyA... | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left exportToJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left words AST#identifier#Right AST#:#Left : AST#:#Right AS... | exportToJSON(
words: WordItem[],
definitions: ExportedDefinition[],
versionControl: VersionControl,
fsrsParamsJson: string = '',
userBooks: ExportedUserBook[] = [],
notebook: NotebookWordEntry[] = [],
texts: TextRow[] = [],
reviewEvents: ReviewEventRow[] = [],
dailyActivity: DailyA... | https://github.com/CLMC2025/Vignette | 71aadd268fab9a20c746c151885228ceca0a8b80 | github |
arkui-x/samples | CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets | arkts | destroySession | 销毁AVSession实例
@returns {void} | destroySession(): void {
// TODO:知识点:注销AVSession事件
this.unRegisterListener();
// TODO:知识点:销毁AVSession实例
this.session?.destroy((err) => {
if (err) {
logger.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
logger.info('Destroy : SUCCESS');
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroySession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | destroySession(): void {
// TODO:知识点:注销AVSession事件
this.unRegisterListener();
// TODO:知识点:销毁AVSession实例
this.session?.destroy((err) => {
if (err) {
logger.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`);
} else {
logger.info('Destroy : SUCCESS');
... | https://gitcode.com/arkui-x/samples | 6b49db33586fa60d3f6199314efaaccc57ed7a63 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Queue.ets | arkts | length | Gets the number of elements in the Queue. | get length(): int {
return this.buffer.length.toInt();
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right... | get length(): int {
return this.buffer.length.toInt();
} | https://gitcode.com/iop123123/arkts-static-skills | 40d0f211d3733b288f89cd812f6f8ea5df2e53cc | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/AuthenticationHandler.ets | arkts | requiresLogin | 是否需要登录 | requiresLogin(): boolean {
return this.config.requiresLogin === true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left requiresLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state... | requiresLogin(): boolean {
return this.config.requiresLogin === true;
} | https://github.com/DaLongZhuaZi/manxia | 568fa27a74270bbe3448b2972f23f696326a16b2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets | arkts | isCanceled | Check current running task is canceled or not
@returns { boolean } true if current running task is canceled, false - otherwise | static isCanceled(): boolean {
let result: boolean = false;
let currentTask = getCurrentTask();
if (currentTask !== undefined) {
result = InternalTask.of(currentTask!).state.load() == (State.CANCELED.valueOf());
}
return result;
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isCanceled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo... | static isCanceled(): boolean {
let result: boolean = false;
let currentTask = getCurrentTask();
if (currentTask !== undefined) {
result = InternalTask.of(currentTask!).state.load() == (State.CANCELED.valueOf());
}
return result;
... | https://gitcode.com/iop123123/arkts-static-skills | 79efbe5e4ec66f0e390cd2e91125d9a42a460105 | gitcode |
openharmony/codelabs | ETSUI/CoinNote/entry/src/main/ets/component/CalendarView.ets | arkts | getDaysInMonth | 获取当月天数 | getDaysInMonth(year: number, month: number): number {
return new Date(year, month + 1, 0).getDate();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDaysInMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ... | getDaysInMonth(year: number, month: number): number {
return new Date(year, month + 1, 0).getDate();
} | https://gitcode.com/openharmony/codelabs | e1f292486c4d9f6d1d1912f10091912e3ef9c294 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | clearDirectory | 清理目录
[修复] 支持递归删除子目录 | private async clearDirectory(dirPath: string, options: ClearOptions): Promise<ClearResult> {
const result: ClearResult = {
success: true,
clearedSize: 0,
clearedCount: 0,
errors: []
};
try {
const files = await this.sandboxManager.listDirectory(dirPath);
const now = Da... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left clearDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Lef... | private async clearDirectory(dirPath: string, options: ClearOptions): Promise<ClearResult> {
const result: ClearResult = {
success: true,
clearedSize: 0,
clearedCount: 0,
errors: []
};
try {
const files = await this.sandboxManager.listDirectory(dirPath);
const now = Da... | https://github.com/DaLongZhuaZi/manxia | d0b98ed8b241b6a28fe5dea4fce9be596bd97099 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets | arkts | getHigh | Returns the upper shadows highest value.
@return | public getHigh(): number {
return this.mShadowHigh;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHigh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | public getHigh(): number {
return this.mShadowHigh;
} | https://gitee.com/openharmony/developtools_profiler.git | 6307539571006127e1bd81601faf195227b4e0f0 | gitee |
LongLiveY96/chatcube | entry/src/main/ets/services/IconDownloadCache.ets | arkts | getCachedIconUri | 同步获取已缓存的沙箱路径,未缓存返回空字符串 | getCachedIconUri(logoUrl: string): string {
if (!this.isInitialized) {
return ''
}
const hash = this.hashUrl(logoUrl)
const cached = this.memoryIndex.get(hash)
if (cached !== undefined) {
return cached
}
return ''
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCachedIconUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left logoUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | getCachedIconUri(logoUrl: string): string {
if (!this.isInitialized) {
return ''
}
const hash = this.hashUrl(logoUrl)
const cached = this.memoryIndex.get(hash)
if (cached !== undefined) {
return cached
}
return ''
} | https://github.com/LongLiveY96/chatcube | 082ca6d974d33b049b119858fbfcb97ecb993c8d | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/Option.ets | arkts | buildHasArg | 空参时,默认参数为true | public buildHasArg(hasArg ?: boolean): CliBulider {
this.argCount = hasArg ? 1 : CliOption.UNINITIALIZED;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left buildHasArg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hasArg AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Rig... | public buildHasArg(hasArg ?: boolean): CliBulider {
this.argCount = hasArg ? 1 : CliOption.UNINITIALIZED;
return this;
} | https://gitee.com/openharmony-sig/commons-cli.git | cb03a3d43d34a5629be432eea7182b90304f6852 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CloudSyncRecordDAO.ets | arkts | getByUserId | 查询用户的所有同步记录 | static async getByUserId(userId: number, limit: number | undefined = undefined): Promise<CloudSyncRecord[]> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
let sql: string = `SELECT * FROM ${CloudSyncRecord.tableName} WHERE user_id = ? ORDER BY created_at DESC`;
let params: (numbe... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST... | static async getByUserId(userId: number, limit: number | undefined = undefined): Promise<CloudSyncRecord[]> {
const store: relationalStore.RdbStore = DatabaseManager.getDatabase();
let sql: string = `SELECT * FROM ${CloudSyncRecord.tableName} WHERE user_id = ? ORDER BY created_at DESC`;
let params: (numbe... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fc0303683243235234832fe49bf1a1b8a43df77c | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | isLessEqualThan | Checks if this instance value is less than or equal to value of provided instance
@param other Right hand side of the comparison
@returns true if this value is less than or equal to provided, false otherwise | public isLessEqualThan(other: Float): boolean {
return this.value <= other.toFloat();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLessEqualThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public isLessEqualThan(other: Float): boolean {
return this.value <= other.toFloat();
} | https://gitcode.com/iop123123/arkts-static-skills | a2890f38185e3c5a970858a5c27c5cba71b24e0d | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setHorizontalAlignment | sets the horizontal alignment of the legend
@param value | public setHorizontalAlignment(value: LegendHorizontalAlignment): void {
this.mHorizontalAlignment = value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHorizontalAlignment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | public setHorizontalAlignment(value: LegendHorizontalAlignment): void {
this.mHorizontalAlignment = value;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 15f627a7907aa93015eb636e62a581f7ca2436ef | gitee |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | getCachedDefinition | Get cached definition | async getCachedDefinition(word: string): Promise<WordDefinition | null> {
this.ensureInitialized();
const normalizedWord = word.toLowerCase().trim();
const predicates = new relationalStore.RdbPredicates(TABLE_DEFINITIONS);
predicates.equalTo('word', normalizedWord);
const resultSet = await this.... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getCachedDefinition AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Lef... | async getCachedDefinition(word: string): Promise<WordDefinition | null> {
this.ensureInitialized();
const normalizedWord = word.toLowerCase().trim();
const predicates = new relationalStore.RdbPredicates(TABLE_DEFINITIONS);
predicates.equalTo('word', normalizedWord);
const resultSet = await this.... | https://github.com/CLMC2025/Vignette | 578b0fdca7f7705ee5103fc6345f271943532fe7 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TouchInputHandler.ets | arkts | sendRightClick | 发送右键点击 | sendRightClick(): void {
this.nativeInput.sendMouseButton(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
setTimeout(() => {
this.nativeInput.sendMouseButton(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
}, 50);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendRightClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | sendRightClick(): void {
this.nativeInput.sendMouseButton(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
setTimeout(() => {
this.nativeInput.sendMouseButton(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
}, 50);
} | https://github.com/AlkaidLab/moonlight-harmony | 821724b729093f580a7c398dbff282ea1d7bd73c | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/utils/EmojiResolver.ets | arkts | resolveFlairUrl | flair_url 解析:
- URL/相对路径:resolveUrl
- :emoji::按 emoji 解析
- 其它非 URL:视为 iconName(返回空,交由 UI 做最小 sys.symbol 映射兜底) | static resolveFlairUrl(flairUrl: string | null): string {
const raw: string = flairUrl !== null && flairUrl !== undefined ? flairUrl.toString().trim() : '';
if (raw.length === 0) return '';
if (EmojiResolver.isUrlLike(raw)) {
return UrlUtils.resolveUrl(raw);
}
if (raw.startsWith(':') && raw.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resolveFlairUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left flairUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#s... | static resolveFlairUrl(flairUrl: string | null): string {
const raw: string = flairUrl !== null && flairUrl !== undefined ? flairUrl.toString().trim() : '';
if (raw.length === 0) return '';
if (EmojiResolver.isUrlLike(raw)) {
return UrlUtils.resolveUrl(raw);
}
if (raw.startsWith(':') && raw.... | https://github.com/Amaz1ny/HarmonyDO-public | 2650e6bc3cb5980edb90c7288043597b1a374fdb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | localeCompare | Comparison between this String and another one based on locale and options.
The result is -1 if this string sorts before the another string,
0 if they are equal, and 1 otherwise.
@param { String } that String to compare with
@param { string | string[] } [locale] String representing the BCP47 language tag
@param { Intl.... | public localeCompare(that: String, locale?: string | string[], options?: Intl.CollatorOptions): int {
if (locale == undefined && options == undefined) {
if (String.localeCompareDefaultFastEnabled) {
const fastResult = this.tryLocaleCompareFast(that);
if (fastResul... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left localeCompare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left that AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left St... | public localeCompare(that: String, locale?: string | string[], options?: Intl.CollatorOptions): int {
if (locale == undefined && options == undefined) {
if (String.localeCompareDefaultFastEnabled) {
const fastResult = this.tryLocaleCompareFast(that);
if (fastResul... | https://gitcode.com/iop123123/arkts-static-skills | 0e96811a99a2111110f467f9e90b7130e3bf8e0b | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | log | Return a new Decimal whose value is the log of `n` to the base `base`, rounded to `precision`
significant digits using rounding mode `rounding`.
@param { Value } n {double | string | Decimal}
@param { Value } base {double | string | Decimal}
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Pre... | static log(n: Value, base: Value): Decimal {
return new Decimal(n).log(base);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri... | static log(n: Value, base: Value): Decimal {
return new Decimal(n).log(base);
} | https://gitcode.com/iop123123/arkts-static-skills | 836dfa28b82b42a984b7859df73f1af2ca002e18 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test29_original_index.ets | arkts | testNumberRadix | --- Number.toString radix --- | function testNumberRadix(): string {
let n: number = 255;
let hex: string = n.toString(16);
let bin: string = n.toString(2);
let oct: string = n.toString(8);
return hex + ',' + bin + ',' + oct;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNumberRadix AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_... | function testNumberRadix(): string {
let n: number = 255;
let hex: string = n.toString(16);
let bin: string = n.toString(2);
let oct: string = n.toString(8);
return hex + ',' + bin + ',' + oct;
} | https://github.com/miaochiahao/ark-ghidra | c4490e23f1be25974ace210d16b057d0b48d15f2 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets | arkts | setDeclaration | Sets the XML declaration for the current document.
@throws {BusinessError} Throws an error if the declaration is set in an illegal position. | public setDeclaration(): void {
if (this.iPos > 0) {
this.checkPosition();
}
let stringBuilder = new StringBuilder(`<?xml version=\"1.0\" encoding=\"${this.encoding}\"?>`);
this.type = XmlDynamicType.DECLARATION;
this.writeToBuffer(str... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDeclaration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void... | public setDeclaration(): void {
if (this.iPos > 0) {
this.checkPosition();
}
let stringBuilder = new StringBuilder(`<?xml version=\"1.0\" encoding=\"${this.encoding}\"?>`);
this.type = XmlDynamicType.DECLARATION;
this.writeToBuffer(str... | https://gitcode.com/iop123123/arkts-static-skills | 46772a2ee17614db25f3e40de15302761aa6061f | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/view/TnFormPage.ets | arkts | build | 构建表单展示页面 | build() {
AppNavDestination({
title: "表单",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
AppNavDestination({
title: "表单",
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.PageContent();
}
} | https://github.com/codelably/tuniao-ui | aba3ee87826464fa08579375713601b98732d78f | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/model/database/PreferencesHandler.ets | arkts | get | Get data in PreferencesHandler.
@param key string
@param defValue any
@return data about key | public async get(key: string) {
let data: string = '';
if (this.preferences != null) {
data = await this.preferences.get(key, this.defaultValue) as string;
}
return data;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AS... | public async get(key: string) {
let data: string = '';
if (this.preferences != null) {
data = await this.preferences.get(key, this.defaultValue) as string;
}
return data;
} | https://gitee.com/harmonyos/codelabs.git | 6dfa5653b3b021c4c3036195b6f3c2b8c88188ae | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_or_equal/less_or_equal_byte.ets | arkts | main | ---
desc: check less or equal operation for byte
--- | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a <= b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: byte = {{v.left}}
const b: byte = {{v.right}}
assert (a <= b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7e8376d2531c7c3e50c9510237f311bbf7e5595f | gitee |
erosTeam/NextE | shared/src/main/ets/parser/EhUconfigParser.ets | arkts | parseControlOptions | Every radio group + numeric <select> on the page, with its REAL option labels (so the UI shows EH's
actual current choices — e.g. correct resample resolutions — not a stale hard-coded list). Only the
options this account has are present, so permission/Hath gating is automatic. | private static parseControlOptions(html: string): Map<string, EhRadioOption[]> {
const map: Map<string, EhRadioOption[]> = new Map<string, EhRadioOption[]>()
const push = (code: string, value: number, label: string): void => {
let arr: EhRadioOption[] | undefined = map.get(code)
if (arr === undefi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseControlOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#... | private static parseControlOptions(html: string): Map<string, EhRadioOption[]> {
const map: Map<string, EhRadioOption[]> = new Map<string, EhRadioOption[]>()
const push = (code: string, value: number, label: string): void => {
let arr: EhRadioOption[] | undefined = map.get(code)
if (arr === undefi... | https://github.com/erosTeam/NextE | bb63597ce028ecb3c0e20facf8131f273b9682bc | github |
openharmony-sig/ohos_checksum | library/src/main/ets/sha1.ets | arkts | safe_add | Add integers, wrapping at 2^32. This uses 16-bit operations internally
to work around bugs in some JS interpreters.
将32位数拆成高16位和低16位分别进行相加,从而实现 MOD 2^32 的加法 | safe_add(x: number, y: number) {
let lsw = (x & 0xFFFF) + (y & 0xFFFF);
let msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left safe_add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#L... | safe_add(x: number, y: number) {
let lsw = (x & 0xFFFF) + (y & 0xFFFF);
let msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
} | https://gitee.com/openharmony-sig/ohos_checksum.git | 91ebf135e4e51782ed7fbd87f522911e4c7096db | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.