nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/StateManagement/entry/src/main/ets/segment/segment2.ets | arkts | Segment02Builder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function Segment02Builder() {
NavDestination(){
MyComponent()
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment02Builder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#containe... | @Builder
export function Segment02Builder() {
NavDestination(){
MyComponent()
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment2.ets#L15-L20 | 738c9aef10c7344130abf9ca907c7c6f3b74ea19 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | 窗口Stage创建时的回调
@param windowStage 窗口Stage | onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onWindowStageCreate');
this.windowStage = windowStage;
// 设置窗口属性
this.setupWindow(windowStage);
// 加载主页面
windowStage.loadContent('pages/Index', (er... | AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ... | onWindowStageCreate(windowStage: window.WindowStage): void {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '%{public}s', 'Ability onWindowStageCreate');
this.windowStage = windowStage;
this.setupWindow(windowStage);
windowStage.loadContent('pages/Index', (err) => {
if ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L44-L61 | 9f88fece619aa36f45bde301b0011d4eab5f273f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/view/CustomCalendarPickerDialog.ets | arkts | aboutToAppear | 获取当前月和下个月的日期数据 | aboutToAppear() {
this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear);
// 如果下个月是在下一年,则下个月是1月份,年份要+1
if (this.currentMonth === MONTHS) {
this.nextMonth = JANUARY;
this.nextYear = this.currentYear + 1;
}
// 如果下个月是还是当前年,则月份+1,年份不变
else {
this.nextMonth = this.... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . currentMonthDay AST#mem... | aboutToAppear() {
this.currentMonthDay = getMonthDate(this.currentMonth, this.currentYear);
if (this.currentMonth === MONTHS) {
this.nextMonth = JANUARY;
this.nextYear = this.currentYear + 1;
}
else {
this.nextMonth = this.currentMonth + 1;
this.nextYear = this.currentY... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customcalendarpickerdialog/src/main/ets/view/CustomCalendarPickerDialog.ets#L70-L98 | a3ca952439613ef70d25de4ab6381e9635585614 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/order/OrderNetworkDataSource.ets | arkts | @file 订单相关数据源接口
@author Joker.X | export interface OrderNetworkDataSource {
/**
* 发起支付宝 App 支付
* @param {Record<string, number>} params - 支付参数
* @returns {Promise<NetworkResponse<string>>} 支付签名结果
*/
alipayAppPay(params: Record<string, number>): Promise<NetworkResponse<string>>;
/**
* 更新订单信息
* @param {unknown} params - 订单更新参数
... | AST#export_declaration#Left export AST#interface_declaration#Left interface OrderNetworkDataSource AST#object_type#Left { /**
* 发起支付宝 App 支付
* @param {Record<string, number>} params - 支付参数
* @returns {Promise<NetworkResponse<string>>} 支付签名结果
*/ AST#type_member#Left alipayAppPay AST#parameter_list#Left ( AST... | export interface OrderNetworkDataSource {
alipayAppPay(params: Record<string, number>): Promise<NetworkResponse<string>>;
updateOrder(params: Unknown): Promise<NetworkResponse<Unknown>>;
refundOrder(params: RefundOrderRequest): Promise<NetworkResponse<boolean>>;
getOrderPage(params: OrderPageRequ... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSource.ets#L18-L87 | 7b3910dd00e1230d4be0f889702bb1fb0e023c21 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/Index.ets | arkts | GestureGroupExample | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { GestureGroupExample } from './src/main/ets/pages/Index' | AST#export_declaration#Left export { GestureGroupExample } from './src/main/ets/pages/Index' AST#export_declaration#Right | export { GestureGroupExample } from './src/main/ets/pages/Index' | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/Index.ets#L15-L15 | e3fc293f8203d5fe01eaa6437061a2ea4160c101 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets | arkts | cancelSandboxFile | 取消沙箱保留 | async cancelSandboxFile(docUris: Array<string>): Promise<void> {
try {
dlpPermission.cancelRetentionState(docUris); // 取消沙箱保留
} catch (err) {
Logger.error(TAG, 'cancelRetentionState error:' + (err as BusinessError).code + (err as BusinessError).message);
}
} | AST#method_declaration#Left async cancelSandboxFile AST#parameter_list#Left ( AST#parameter#Left docUris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#typ... | async cancelSandboxFile(docUris: Array<string>): Promise<void> {
try {
dlpPermission.cancelRetentionState(docUris);
} catch (err) {
Logger.error(TAG, 'cancelRetentionState error:' + (err as BusinessError).code + (err as BusinessError).message);
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L243-L249 | 968df8da8373c49b78b4489ee13db4aafe46fba7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageresizable/Index.ets | arkts | ProductWaterFlowPageComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { ProductWaterFlowPageComponent } from './src/main/ets/pages/ProductWaterFlowPage'; | AST#export_declaration#Left export { ProductWaterFlowPageComponent } from './src/main/ets/pages/ProductWaterFlowPage' ; AST#export_declaration#Right | export { ProductWaterFlowPageComponent } from './src/main/ets/pages/ProductWaterFlowPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageresizable/Index.ets#L16-L16 | b1c8f175efba51b3c50d18aa1a69010d5e42dec7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets | arkts | 设定需要动态监听的model,以便于添加评论时,实现数据的动态监听从而进行lazyForeach懒加载。 | export class NewsCommentData extends BasicDataSource {
// 懒加载数据
private comments: Array<NewsCommentModel> = [];
// 获取懒加载数据源的数据长度
totalCount(): number {
return this.comments.length;
}
// 获取指定数据项
getData(index: number): NewsCommentModel {
return this.comments[index];
}
// 获取指定数据项
getParentD... | AST#export_declaration#Left export AST#class_declaration#Left class NewsCommentData extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // 懒加载数据 AST#property_declaration#Left private comments : AST#type_annotation#Left AST#primary... | export class NewsCommentData extends BasicDataSource {
private comments: Array<NewsCommentModel> = [];
totalCount(): number {
return this.comments.length;
}
getData(index: number): NewsCommentModel {
return this.comments[index];
}
getParentData(parentId: string): NewsCommentModel | nu... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/model/NewsCommentModel.ets#L115-L151 | a6be27692ef07cdfca0fe0e6df446e34be65e27c | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/CartGoodsSpec.ets | arkts | @file 购物车商品规格
@author Joker.X | export class CartGoodsSpec {
/**
* ID
*/
id: number = 0;
/**
* 商品ID
*/
goodsId: number = 0;
/**
* 名称
*/
name: string = "";
/**
* 价格
*/
price: number = 0;
/**
* 库存
*/
stock: number = 0;
/**
* 购买数量
*/
count: number = 0;
/**
* 图片
*/
images?: string[] | ... | AST#export_declaration#Left export AST#class_declaration#Left class CartGoodsSpec AST#class_body#Left { /**
* ID
*/ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_... | export class CartGoodsSpec {
id: number = 0;
goodsId: number = 0;
name: string = "";
price: number = 0;
stock: number = 0;
count: number = 0;
images?: string[] | null = null;
constructor(init?: Partial<CartGoodsSpec>) {
if (!init) {
return;
}
this.id = init.id ?? ... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/CartGoodsSpec.ets#L5-L47 | ece50b7fe77cd710468ff2843d293b4cf813eb3e | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/MultiDeviceAppDev/MultiNavBar/entry/src/main/ets/model/StyleType.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CustomLength {
left?: number = 0;
right?: number = 0;
width?: number = 0;
height?: number = 0;
top?: number = 0;
bottom?: number = 0;
} | AST#export_declaration#Left export AST#class_declaration#Left class CustomLength AST#class_body#Left { AST#property_declaration#Left left ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Rig... | export class CustomLength {
left?: number = 0;
right?: number = 0;
width?: number = 0;
height?: number = 0;
top?: number = 0;
bottom?: number = 0;
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/MultiDeviceAppDev/MultiNavBar/entry/src/main/ets/model/StyleType.ets#L16-L23 | f5e1336d7613875438048bf1fea0c43bad010a7b | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | getUpcomingBirthdays | 获取即将到来的生日 | private async getUpcomingBirthdays(): Promise<{contact: Contact, daysUntil: number}[]> {
const contacts = await this.contactService.searchContacts({ pageSize: 1000 });
const today = new Date();
const advanceDays = this.settings?.notification.advanceDays || [1, 3, 7];
const upcomingBirthdays: {contact: C... | AST#method_declaration#Left private async getUpcomingBirthdays AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Promise AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left < AST#ERROR#Right AST#block_statement#Left { AST#statement#Left AST#expression_stat... | private async getUpcomingBirthdays(): Promise<{contact: Contact, daysUntil: number}[]> {
const contacts = await this.contactService.searchContacts({ pageSize: 1000 });
const today = new Date();
const advanceDays = this.settings?.notification.advanceDays || [1, 3, 7];
const upcomingBirthdays: {contact: C... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L303-L322 | 60db14decfd1096f976a19a423e63a0b2800ff3b | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_history_index_lite.ets | arkts | this_file_name | Returns the opened file name of this lite index.
@returns the file name | static this_file_name(): string {
return index_file_name_of_month(bunch_of_history_index_lite.this_year, bunch_of_history_index_lite.this_month);
} | AST#method_declaration#Left static this_file_name AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expr... | static this_file_name(): string {
return index_file_name_of_month(bunch_of_history_index_lite.this_year, bunch_of_history_index_lite.this_month);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_lite.ets#L28-L30 | 1e2504be31600c4910a80bd21b8b610e22bd31b5 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/CrashUtil.ets | arkts | getExceptionJson | 获取异常日志的JSON字符串。 | static async getExceptionJson(): Promise<string> {
const errorFilePath = CrashUtil.getFilePath();
if (FileUtil.accessSync(errorFilePath)) {
return await FileUtil.readText(errorFilePath);
}
return '';
} | AST#method_declaration#Left static async getExceptionJson AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right >... | static async getExceptionJson(): Promise<string> {
const errorFilePath = CrashUtil.getFilePath();
if (FileUtil.accessSync(errorFilePath)) {
return await FileUtil.readText(errorFilePath);
}
return '';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L131-L137 | 9366c47912e112f37b25c98f3e0e527eedc47670 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Bean.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class RectPosition {
x:number = 0;
y:number = 0;
width:number = 0;
height:number = 0;
} | AST#export_declaration#Left export AST#class_declaration#Left class RectPosition AST#class_body#Left { AST#property_declaration#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AS... | export class RectPosition {
x:number = 0;
y:number = 0;
width:number = 0;
height:number = 0;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/models/Bean.ets#L16-L21 | bb928c30cb1045fcc46fa78a9777f04bb304f72c | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | deleteDeviceId | 移除设备ID | static deleteDeviceId() {
DeviceUtil.deviceId = '';
if (AssetUtil.canIUse()) {
AssetUtil.removeSync(DEVICE_ID_KEY);
} else {
PreferencesUtil.deleteSync(DEVICE_ID_KEY);
}
} | AST#method_declaration#Left static deleteDeviceId AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left DeviceUtil AST#expression#Right . deviceId AST#member_ex... | static deleteDeviceId() {
DeviceUtil.deviceId = '';
if (AssetUtil.canIUse()) {
AssetUtil.removeSync(DEVICE_ID_KEY);
} else {
PreferencesUtil.deleteSync(DEVICE_ID_KEY);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L86-L93 | 59e6fb9d774adffd29c9be66e410a2355b9df467 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerInfoComp.ets | arkts | this | 监听媒体查询横屏切换 | this.landscapeListener.on('change', (mediaQueryResult: mediaquery.MediaQueryResult) => {
this.updateWithOrientation(mediaQueryResult);
} | AST#method_declaration#Left this AST#ERROR#Left . landscape List ener . on ( 'change' , AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left mediaQueryResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mediaquery . MediaQueryResult AST#qualified_type#Right AST#primary_type#Right AST... | this.landscapeListener.on('change', (mediaQueryResult: mediaquery.MediaQueryResult) => {
this.updateWithOrientation(mediaQueryResult);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/MusicPlayer/musicplayer/src/main/ets/components/MusicPlayerInfoComp.ets#L78-L80 | e94cb0283f3845ef01d2f8d2267e0e1608b58b1b | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/conditional_stmt/conditional_if_004_F.ets | arkts | Introduction 条件语句-else | export function conditional_if_004_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
if (false) {
} else {
taint.Sink(clean);
}
} | AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statemen... | export function conditional_if_004_F(taint_src : string) {
let _t = taint_src;
let clean = "_";
if (false) {
} else {
taint.Sink(clean);
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_004_F.ets#L6-L13 | fd397ff1ce18ca0a9f3b75ec7a772df54cfd68bd | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets | arkts | 应用约束:构造函数参数不声明字段(错误18) | constructor(file: Object, name?: string) {
if (name) {
this.setAttachment(file, name);
} else {
this._attach(file);
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left name ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | constructor(file: Object, name?: string) {
if (name) {
this.setAttachment(file, name);
} else {
this._attach(file);
}
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/Attachment.ets#L12-L18 | 9da10a9f4a8c40b65253430ce39aae48ac3a61b5 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/navigation/OrderGraph.ets | arkts | @file 订单模块导航图
@author Joker.X | export class OrderGraph implements RouteGraph {
/**
* 注册订单模块导航路由
*/
register(): void {
RouteBuild.register(OrderRoutes.List, wrapBuilder(OrderListNav));
RouteBuild.register(OrderRoutes.Confirm, wrapBuilder(OrderConfirmNav));
RouteBuild.register(OrderRoutes.Detail, wrapBuilder(OrderDetailNav));
... | AST#export_declaration#Left export AST#class_declaration#Left class OrderGraph AST#implements_clause#Left implements RouteGraph AST#implements_clause#Right AST#class_body#Left { /**
* 注册订单模块导航路由
*/ AST#method_declaration#Left register AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left... | export class OrderGraph implements RouteGraph {
register(): void {
RouteBuild.register(OrderRoutes.List, wrapBuilder(OrderListNav));
RouteBuild.register(OrderRoutes.Confirm, wrapBuilder(OrderConfirmNav));
RouteBuild.register(OrderRoutes.Detail, wrapBuilder(OrderDetailNav));
RouteBuild.register(Orde... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/navigation/OrderGraph.ets#L15-L28 | ba5b57b54963326c3cc270419666db845f524568 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets | arkts | pushData | 存储数据到懒加载数据源中 | pushData(data: CommentModel): void {
this.comments.push(data);
// 在数组头部添加数据
this.notifyDataAdd(this.comments.length - 1);
} | AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left CommentModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ... | pushData(data: CommentModel): void {
this.comments.push(data);
this.notifyDataAdd(this.comments.length - 1);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/model/TextFlowMode.ets#L140-L144 | 8ea1b11d745ff7409e3d0af21e9cc480602c9e5a | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets | arkts | MARK: - 录音数据结构 | export class RecordSound {
name : string | null = null
pronData : Uint8Array | null = null
} | AST#export_declaration#Left export AST#class_declaration#Left class RecordSound AST#class_body#Left { AST#property_declaration#Left name AST#ERROR#Left : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Ri... | export class RecordSound {
name : string | null = null
pronData : Uint8Array | null = null
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L24-L27 | ebb80fdbd70a1354acfb022707330212f59f83ef | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/ChatWithExpression.ets | arkts | aboutToAppear | 聊天信息最大宽度 | aboutToAppear() {
const displayData: display.Display = display.getDefaultDisplaySync();
this.screenWidth = px2vp(displayData.width);
// 根据设计稿及屏幕宽度计算fontsize及行间距
this.msgFontSize = this.screenWidth * 100 / DESIGN_WIDTH; // 100,百分比
logger.info(TAG, 'FontSize:' + this.msgFontSize.toString());
// 聊... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left displayData : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display AST#qualifi... | aboutToAppear() {
const displayData: display.Display = display.getDefaultDisplaySync();
this.screenWidth = px2vp(displayData.width);
this.msgFontSize = this.screenWidth * 100 / DESIGN_WIDTH;
logger.info(TAG, 'FontSize:' + this.msgFontSize.toString());
this.msgMaxWidth =
(this.scree... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/view/ChatWithExpression.ets#L86-L148 | a5460567e518dbd3a277d85cb449cc01b1e98bc2 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets | arkts | recycleNode | 回收子组件到复用池中 | public recycleNode(type: string, node: NodeItem) {
let nodeArray: Array<NodeItem> = this.nodePool.get(type);
if (!nodeArray) {
nodeArray = new Array();
this.nodePool.set(type, nodeArray);
}
nodeArray.push(node);
} | AST#method_declaration#Left public recycleNode AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left node : AST#type_annotation#Left AST#primary_type#Left NodeItem AST#primary_ty... | public recycleNode(type: string, node: NodeItem) {
let nodeArray: Array<NodeItem> = this.nodePool.get(type);
if (!nodeArray) {
nodeArray = new Array();
this.nodePool.set(type, nodeArray);
}
nodeArray.push(node);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L95-L102 | 3b68a5e06fb059e46c2cee158fce143f12f7a99c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets | arkts | animationInfoChange | 动画信息变化,用于自动化用例 | animationInfoChange() {
// 全屏播放页Y轴位置
let detailsPageYPosition = this.animationData?.screenHeight - this.animationData?.detailsPageOffsetY -
this.animationData?.miniDistanceToBottom;
// Mini条透明度
let miniPlayerOpacity = this.animationData?.miniPlayerOpacity;
// 全屏播放页透明度
let detailsPageOpacit... | AST#method_declaration#Left animationInfoChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 全屏播放页Y轴位置 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left detailsPageYPosition = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#mem... | animationInfoChange() {
let detailsPageYPosition = this.animationData?.screenHeight - this.animationData?.detailsPageOffsetY -
this.animationData?.miniDistanceToBottom;
let miniPlayerOpacity = this.animationData?.miniPlayerOpacity;
let detailsPageOpacity = this.animationData?.detailsPag... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/view/MiniPlayerAnimation.ets#L67-L97 | 4c41139a376e632236cbc57768ac4793db80088b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/constants/Constants.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class Constants {
static readonly ACTION_PICKER_CAMERA: string = 'ohos.want.action.imageCapture';
static readonly KEY_RESULT_PICKER_CAMERA: string = 'resourceUri';
} | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly ACTION_PICKER_CAMERA : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'ohos.want.action.imageCap... | export class Constants {
static readonly ACTION_PICKER_CAMERA: string = 'ohos.want.action.imageCapture';
static readonly KEY_RESULT_PICKER_CAMERA: string = 'resourceUri';
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/CameraSample/entry/src/main/ets/pages/constants/Constants.ets#L16-L19 | d730dc2147344fa038a8ce0baf5c8fbb6b03c232 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtaining the hard drive serial number.
@permission ohos.permission.ACCESS_DISK_PHY_INFO
@syscap SystemCapability.Startup.SystemInfo
@since 20
@arkts 1.2 | static get diskSN(): string; | AST#method_declaration#Left static get AST#ERROR#Left diskSN AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right | static get diskSN(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L477-L477 | 5a02681f4448d7efcca0ae2f5e4411d5cd27ccc3 | gitee |
RicardoWesleyli/HarmonyNEXT_Examples.git | 6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670 | Chapter2/entry/src/main/ets/pages/Index.ets | arkts | recommendFood | 推荐食物的方法 | recommendFood() {
const foods = ['猪脚饭','螺蛳粉','麻辣烫','拉面',
'寿司','披萨','汉堡']
const index = Math.floor(Math.random() * foods.length)
this.recommendedFood = foods[index]
} | AST#method_declaration#Left recommendFood AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left foods = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#array_literal#Left [ AST#expression... | recommendFood() {
const foods = ['猪脚饭','螺蛳粉','麻辣烫','拉面',
'寿司','披萨','汉堡']
const index = Math.floor(Math.random() * foods.length)
this.recommendedFood = foods[index]
} | https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter2/entry/src/main/ets/pages/Index.ets#L37-L42 | 53b2b4115b967bd115a5ea0b197983ea5dacdb46 | github |
SeaEpoch/SepWeather.git | e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c | entry/src/main/ets/common/database/tables/LocationTable.ets | arkts | insertData | 插入 | insertData(location: LocationData, callback: Function) {
const valueBucket: relationalStore.ValuesBucket = generateBucket(location);
this.locationTable.insertData(valueBucket, callback);
} | AST#method_declaration#Left insertData AST#parameter_list#Left ( AST#parameter#Left location : AST#type_annotation#Left AST#primary_type#Left LocationData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#prim... | insertData(location: LocationData, callback: Function) {
const valueBucket: relationalStore.ValuesBucket = generateBucket(location);
this.locationTable.insertData(valueBucket, callback);
} | https://github.com/SeaEpoch/SepWeather.git/blob/e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c/entry/src/main/ets/common/database/tables/LocationTable.ets#L22-L25 | 3ecda8883a16bf9d9c0570c72f91eacf2b6052a1 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/DailyCountManaer.ets | arkts | 扩展方法(为 enum 添加 getKeyWithToday) | export class DailyCountTypeHelper {
/**
* 获取带当天日期的 key,如:wordPron_2025-11-19
*/
static getKeyWithToday(type: DailyCountType): string {
const today: string = DateUtils.toDateString(new Date()) ?? "";
return `${type}_${today}`;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class DailyCountTypeHelper AST#class_body#Left { /**
* 获取带当天日期的 key,如:wordPron_2025-11-19
*/ AST#method_declaration#Left static getKeyWithToday AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DailyCoun... | export class DailyCountTypeHelper {
static getKeyWithToday(type: DailyCountType): string {
const today: string = DateUtils.toDateString(new Date()) ?? "";
return `${type}_${today}`;
}
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/DailyCountManaer.ets#L28-L37 | 14ea4ff70d89461f6217c097c7a471400e4e51fe | github | |
851432669/Smart-Home-ArkTs-Hi3861.git | 0451f85f072ed3281cc23d9cdc2843d79f60f975 | entry/src/main/ets/pages/EnvMonitorPage.ets | arkts | aboutToAppear(): void { new MQTTUtil().connect( (err: Error, data: MqttMessage) => { //如果没有出错就处理数据 if (!err) { //解析接收到的数据为EnvironmentViewModel对象 this.item = JSON.parse(String(data.payload)) as EnvironmentViewModel; //如果实例不为空就更新状态变量 if (!this.item) { this.item = new EnvironmentViewModel() } } } ) } | build() {
Stack({ alignContent: Alignment.Top }) {
// 背景
Column()
.width('100%')
.height('100%')
.backgroundImage($r('app.media.background'))
.backgroundImageSize(ImageSize.Cover)
.opacity(0.15)
Column() {
// 顶部栏
Stack({ alignContent: ... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right .... | build() {
Stack({ alignContent: Alignment.Top }) {
Column()
.width('100%')
.height('100%')
.backgroundImage($r('app.media.background'))
.backgroundImageSize(ImageSize.Cover)
.opacity(0.15)
Column() {
Stack({ alignContent: Alignment.C... | https://github.com/851432669/Smart-Home-ArkTs-Hi3861.git/blob/0451f85f072ed3281cc23d9cdc2843d79f60f975/entry/src/main/ets/pages/EnvMonitorPage.ets#L43-L201 | 9090e6ce512f7a55ee7c4e6a19f3e422c9645147 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Ability/StageAbility/entry/src/main/ets/common/utils/GlobalContext.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export class GlobalContext {
private constructor() { }
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instance... | AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat... | export class GlobalContext {
private constructor() { }
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instance... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/common/utils/GlobalContext.ets#L16-L35 | de6a29e21fccda9539d4b222f8e388389637d700 | gitee | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/data/src/main/ets/repository/TokenStoreRepository.ets | arkts | loadToken | 读取 Token
@returns {Promise<string>} Token,默认空字符串 | loadToken(): Promise<string> {
return this.dataSource.getToken();
} | AST#method_declaration#Left loadToken AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#... | loadToken(): Promise<string> {
return this.dataSource.getToken();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/TokenStoreRepository.ets#L34-L36 | ce72e261f79b44e927a7cc40040b3d868ed6ccc2 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/skeletondiagram/src/main/ets/common/CommonConstants.ets | arkts | SkeletonData for SkeletonView | export const SkeletonData: SkeletonType[] = [
{
isMine: false
},
{
isMine: false
},
{
isMine: false
},
{
isMine: true
},
{
isMine: false
},
{
isMine: true
},
{
isMine: true
},
{
isMine: false
},
{
isMine: false
},
{
isMine: false
},
{
... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SkeletonData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SkeletonType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#... | export const SkeletonData: SkeletonType[] = [
{
isMine: false
},
{
isMine: false
},
{
isMine: false
},
{
isMine: true
},
{
isMine: false
},
{
isMine: true
},
{
isMine: true
},
{
isMine: false
},
{
isMine: false
},
{
isMine: false
},
{
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/src/main/ets/common/CommonConstants.ets#L59-L102 | adbb1e373878a76d339e3557991673baf3ab251a | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/navigationparametertransfer/src/main/ets/components/UserBookingInfo.ets | arkts | 价格 | constructor(name: string, id: string, date: string) {
this.userName = name;
this.userID = id;
this.date = date;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | constructor(name: string, id: string, date: string) {
this.userName = name;
this.userID = id;
this.date = date;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationparametertransfer/src/main/ets/components/UserBookingInfo.ets#L23-L27 | 68b6a1c002643531fe1505cddb8121f194ccbd97 | gitee | |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/databaseability/DatabaseAbility.ets | arkts | 数据库连接基类 | export default class Rdb {
private rdbStore: relationalStore.RdbStore | null = null;
private tableName: string;
private sqlCreateTable: string;
private columns: Array<string>;
constructor(tableName: string, sqlCreateTable: string, columns: Array<string>) {
this.tableName = tableName;
this.sqlCreat... | AST#export_declaration#Left export default AST#class_declaration#Left class Rdb AST#class_body#Left { AST#property_declaration#Left private rdbStore : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right | A... | export default class Rdb {
private rdbStore: relationalStore.RdbStore | null = null;
private tableName: string;
private sqlCreateTable: string;
private columns: Array<string>;
constructor(tableName: string, sqlCreateTable: string, columns: Array<string>) {
this.tableName = tableName;
this.sqlCreat... | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/DatabaseAbility.ets#L5-L132 | d01db5f88ddb5dff4ebf5349513da39606584c45 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarService.ets | arkts | formatDateKey | 工具方法:格式化日期键 | private formatDateKey(date: Date): string {
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${month}-${day}`;
} | AST#method_declaration#Left private formatDateKey AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | private formatDateKey(date: Date): string {
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${month}-${day}`;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarService.ets#L376-L380 | 811891c6db64dbd16cd20d1ba8ffd1ea47dfe63a | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | getConvertKeyPair | 获取转换的非对称密钥KeyPair,异步
@param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)
@param pubKey 公钥字符串
@param priKey 私钥字符串
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
@returns | static async getConvertKeyPair(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding): Promise<cryptoFramework.KeyPair> {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyData... | AST#method_declaration#Left static async getConvertKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#prim... | static async getConvertKeyPair(algName: string, pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding): Promise<cryptoFramework.KeyPair> {
let pubKeyBlob: cryptoFramework.DataBlob | null = CryptoHelper.getKeyData... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L182-L189 | 9cc3ff4853afe39e8e25aee00e52e686a8dc39b0 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/components/SystemIcon.ets | arkts | 图标字符映射类型 | export type IconMappingType = Record<string, string>; | AST#export_declaration#Left export AST#type_declaration#Left type IconMappingType = AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#... | export type IconMappingType = Record<string, string>; | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/components/SystemIcon.ets#L10-L10 | b17f622b06145a9871e286b40ab876e74d07e6ae | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/llm/LLMService.ets | arkts | 大模型信息接口 | export interface LLMInfo {
provider: LLMProvider;
name: string;
description: string;
baseUrl: string;
models: string[];
defaultModel: string;
website?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LLMInfo AST#object_type#Left { AST#type_member#Left provider : AST#type_annotation#Left AST#primary_type#Left LLMProvider AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#L... | export interface LLMInfo {
provider: LLMProvider;
name: string;
description: string;
baseUrl: string;
models: string[];
defaultModel: string;
website?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L74-L82 | 8a3983a383fc18fb118ba65f0bd0c12a3804e8c9 | github | |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/Theme.ets | arkts | AppStorage key 标识 | export class ThemeStorageKey {
static readonly THEME: string = 'theme' // 主题key
static readonly THEMELIST: string = 'themelist'
static readonly THEMELISTSTR: string = 'themeliststr'
static readonly THEMEINDEX: string = 'themeindex' // 被选中主题索引key
} | AST#export_declaration#Left export AST#class_declaration#Left class ThemeStorageKey AST#class_body#Left { AST#property_declaration#Left static readonly THEME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'theme' AST#expression#Right // 主题k... | export class ThemeStorageKey {
static readonly THEME: string = 'theme'
static readonly THEMELIST: string = 'themelist'
static readonly THEMELISTSTR: string = 'themeliststr'
static readonly THEMEINDEX: string = 'themeindex'
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/Theme.ets#L13-L18 | f2857253f5c9ef931f1f6a4737175add45622cd6 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/EncourageManager.ets | arkts | resetRewards | 重置奖励池(现在直接调用EncourageTypeHelper的方法) | public resetRewards(type: EncourageType): void {
EncourageTypeHelper.resetRewards(type);
} | AST#method_declaration#Left public resetRewards AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left EncourageType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima... | public resetRewards(type: EncourageType): void {
EncourageTypeHelper.resetRewards(type);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L196-L198 | 2e9b013a098c78526d84489bd1187238e1b91ec0 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets | arkts | setCrossAxis | 设置交叉轴位置 | setCrossAxis(event: GestureEvent) {
// list当前没有在移动 && 交叉轴时候如果没有放大也不移动
let isScale = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue;
let listOffset = Math.abs(this.imageListOffset);
if (listOffset > this.moveMaxOffset) {
this.isMoveCrossAxis = false;
}
if (this.is... | AST#method_declaration#Left setCrossAxis AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // list当前没有在移动 && 交叉轴时候如果没有放大也不移动 AST#stat... | setCrossAxis(event: GestureEvent) {
let isScale = this.imageScaleInfo.scaleValue !== this.imageScaleInfo.defaultScaleValue;
let listOffset = Math.abs(this.imageListOffset);
if (listOffset > this.moveMaxOffset) {
this.isMoveCrossAxis = false;
}
if (this.isMoveCrossAxis && isScale) {
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets#L249-L270 | 0230bd63656d859b9d50431e1b6812eff71b0a65 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/PickerUtils.ets | arkts | camera | 调用系统相机,拍照、录视频
@param options
@returns | static async camera(options?: CameraOptions): Promise<string> {
try {
if (!options) {
options = new CameraOptions();
}
if (!options.mediaTypes || options.mediaTypes.length == 0) {
options.mediaTypes = [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO];
}... | AST#method_declaration#Left static async camera AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left CameraOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener... | static async camera(options?: CameraOptions): Promise<string> {
try {
if (!options) {
options = new CameraOptions();
}
if (!options.mediaTypes || options.mediaTypes.length == 0) {
options.mediaTypes = [cameraPicker.PickerMediaType.PHOTO, cameraPicker.PickerMediaType.VIDEO];
}... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PickerUtils.ets#L25-L50 | 616bbe46285cc700da3f91af5c02bc4f818d614f | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getOsVersion | 获取OS版本号(5.0.4)(Major版本号,示例:5;Senior版本号,示例:0;Feature版本号,示例:0)。 | static getOsVersion(): string {
return `${deviceInfo.majorVersion}.${deviceInfo.seniorVersion}.${deviceInfo.featureVersion}`;
} | AST#method_declaration#Left static getOsVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_li... | static getOsVersion(): string {
return `${deviceInfo.majorVersion}.${deviceInfo.seniorVersion}.${deviceInfo.featureVersion}`;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L222-L224 | 562c4de558cda063c42157f5d3a7af1fbf628b73 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets | arkts | saveAccount | 保存账号
@returns {Promise<void>} Promise<void> | async saveAccount(): Promise<void> {
const account: string = this.accountInput.trim();
if (!account) {
return;
}
await this.repository.saveAccount(account);
} | AST#method_declaration#Left async saveAccount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu... | async saveAccount(): Promise<void> {
const account: string = this.accountInput.trim();
if (!account) {
return;
}
await this.repository.saveAccount(account);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets#L38-L44 | b06b59ecba96624968056281e858dc6f38f20ac9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/recommendation/RecommendationEngine.ets | arkts | generateHybridRecommendations | 生成混合推荐 | private async generateHybridRecommendations(
type: RecommendationType,
context: RecommendationContext,
behaviorData: UserBehaviorData,
count: number
): Promise<RecommendationResult> {
try {
const algorithmResults: Map<string, RecommendationItem[]> = new Map();
// 运行各个推荐算法
... | AST#method_declaration#Left private async generateHybridRecommendations AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left RecommendationType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#p... | private async generateHybridRecommendations(
type: RecommendationType,
context: RecommendationContext,
behaviorData: UserBehaviorData,
count: number
): Promise<RecommendationResult> {
try {
const algorithmResults: Map<string, RecommendationItem[]> = new Map();
for (const ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L543-L668 | 687826eebc2cc7c11a1718d9ef4f8bd865922251 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/structures/NewsChannel.ets | arkts | 应用约束1:添加构造函数参数类型 | constructor(guild: any, data: any) {
super(guild, data);
this.type = 'news';
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left guild : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right ... | constructor(guild: any, data: any) {
super(guild, data);
this.type = 'news';
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/NewsChannel.ets#L17-L20 | 559c075780fb809670ec0f57610a32a7ed5bc72e | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | LIstOptimizationBak/entry/src/main/ets/component/ReusableArticleCardView.ets | arkts | ActionButtonBuilder | DocsCode 1 | @Builder
function ActionButtonBuilder(imgResource: Resource, count: number, textWidth: Resource) {
Row() {
Image(imgResource)
.size({ width: 16, height: 16 })
.margin({ right: $r('app.float.action_button_margin_right') })
Text(count.toString())
.fontFamily('HarmonyHeiTi')
.fontSize($r(... | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function ActionButtonBuilder AST#parameter_list#Left ( AST#parameter#Left imgResource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Le... | @Builder
function ActionButtonBuilder(imgResource: Resource, count: number, textWidth: Resource) {
Row() {
Image(imgResource)
.size({ width: 16, height: 16 })
.margin({ right: $r('app.float.action_button_margin_right') })
Text(count.toString())
.fontFamily('HarmonyHeiTi')
.fontSize($r(... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/LIstOptimizationBak/entry/src/main/ets/component/ReusableArticleCardView.ets#L102-L119 | 40fd209916c3f57d2ed52e94615cbcbe7c48c2f8 | gitee |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/common/constant/CommonConstant.ets | arkts | import { NewsTypeBean } from '../../viewmodel/NewsViewModel'; | export class CommonConstant {
/**
* The host address of the server.
*/
static readonly SERVER: string = 'http://**.**.**.**:9588';
/**
* Get the news type.
*/
static readonly GET_NEWS_TYPE: string = 'news/getNewsType';
/**
* Get the news list.
*/
static readonly GET_NEWS_LIST: string = ... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstant AST#class_body#Left { /**
* The host address of the server.
*/ AST#property_declaration#Left static readonly SERVER : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expr... | export class CommonConstant {
static readonly SERVER: string = 'http://**.**.**.**:9588';
static readonly GET_NEWS_TYPE: string = 'news/getNewsType';
static readonly GET_NEWS_LIST: string = 'news/getNewsList';
static readonly SERVER_CODE_SUCCESS: string = 'success';
static readonly Y_OFF_S... | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/common/constant/CommonConstant.ets#L18-L202 | ee07641de2ceffc0d22cd17be2dec242615c8264 | github | |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/common/service/RecordService.ets | arkts | insert | 新增饮食记录
@param typeId 记录类型id
@param itemId 记录项id
@param amount 记录项数量(食物量、运动时长)
@returns 新增数量 | insert(typeId:number,itemId:number,amount:number): Promise<number>{
//1.获取时间
let createTime = (AppStorage.Get('selectedDate') || DateUtil.beginTimeOfDay(new Date())) as number
//2.新增
return RecordModel.insert({typeId,itemId,amount,createTime})
} | AST#method_declaration#Left insert AST#parameter_list#Left ( AST#parameter#Left typeId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left itemId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A... | insert(typeId:number,itemId:number,amount:number): Promise<number>{
let createTime = (AppStorage.Get('selectedDate') || DateUtil.beginTimeOfDay(new Date())) as number
return RecordModel.insert({typeId,itemId,amount,createTime})
} | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/common/service/RecordService.ets#L20-L25 | ed970179ae525f36748a9a9780ae835658d5a625 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSMultiPictureUI/entry/src/main/ets/view/CenterPart.ets | arkts | CenterPart | 中部图片显示区 | @Component
export struct CenterPart {
build() {
Row() {
Column() {
Text('中部图片显示区')
.fontSize('24fp')
}
}
.height('100%')
.width('100%')
.borderColor(Color.Black)
.borderWidth('2vp')
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CenterPart AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { A... | @Component
export struct CenterPart {
build() {
Row() {
Column() {
Text('中部图片显示区')
.fontSize('24fp')
}
}
.height('100%')
.width('100%')
.borderColor(Color.Black)
.borderWidth('2vp')
}
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMultiPictureUI/entry/src/main/ets/view/CenterPart.ets#L4-L19 | 78d0047688f8317ea74a8996f16ce3b48cc1b2d2 | gitee |
2763981847/Clock-Alarm.git | 8949bedddb7d011021848196735f30ffe2bd1daf | entry/src/main/ets/common/util/GlobalContext.ets | arkts | setObject | 设置指定键对应的对象。
@param key 对象的键
@param objectClass 要设置的对象 | setObject(key: string, objectClass: Object): void {
this._objects.set(key, objectClass);
} | AST#method_declaration#Left setObject AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left objectClass : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Ri... | setObject(key: string, objectClass: Object): void {
this._objects.set(key, objectClass);
} | https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/GlobalContext.ets#L39-L41 | 5f8b72f9419dc5bf8bfb910f4721bc286267c818 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM3Sync.ets | arkts | digest | SM3摘要
@param str 带摘要的字符串
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns 摘要后的字符串 | static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SM3', resultCoding);
} | AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Le... | static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SM3', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM3Sync.ets#L34-L36 | a68f35b574635cb834ae6bcb623c9054fe21d601 | gitee |
chongzi/Lucky-ArkTs.git | 84fc104d4a68def780a483e2543ebf9f53e793fd | entry/src/main/ets/model/InterviewRecordModel.ets | arkts | getResultText | 获取面试结果显示文本 | getResultText(): string {
switch (this.result) {
case InterviewResult.PASS:
return '通过';
case InterviewResult.FAIL:
return '未通过';
case InterviewResult.PENDING:
return '待定';
case InterviewResult.UNKNOWN:
return '未知';
default:
return '未知';
}
... | AST#method_declaration#Left getResultText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left swit... | getResultText(): string {
switch (this.result) {
case InterviewResult.PASS:
return '通过';
case InterviewResult.FAIL:
return '未通过';
case InterviewResult.PENDING:
return '待定';
case InterviewResult.UNKNOWN:
return '未知';
default:
return '未知';
}
... | https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L123-L136 | eb36b52acc9071d5bac489511fca020e6211e9ba | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/EmitterUtil.ets | arkts | onceSubscribe | 单次订阅指定事件
@param eventId 事件ID,string类型的eventId不支持空字符串。
@param callback 事件的回调处理函数。 | static onceSubscribe<T>(eventId: string | number, callback: Callback<T>) {
emitter.once(eventId.toString(), (eventData: emitter.GenericEventData<T>) => {
callback(eventData.data);
});
} | AST#method_declaration#Left static onceSubscribe AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary... | static onceSubscribe<T>(eventId: string | number, callback: Callback<T>) {
emitter.once(eventId.toString(), (eventData: emitter.GenericEventData<T>) => {
callback(eventData.data);
});
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/EmitterUtil.ets#L57-L61 | 00c2063288f5534bb61b921a06430c61b3677b74 | gitee |
njkndxz/learn-ArkTs.git | 70fabab8ee28e3637329d53a4ec93afc72a001c2 | entry/src/main/ets/pages/案例/掘金评论案例.ets | arkts | aboutToAppear | 一加载页面就注册font | aboutToAppear(): void {
// 会在组件加载时自动调用执行(生命周期函数)
// 注册字体
font.registerFont({
familyName: 'myFont',
familySrc: '/fonts/iconfont.ttf'
})
// 默认排序
this.handleSort(0)
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 会在组件加载时自动调用执行(生命周期函数) // 注册字体 AST#expression_statement#Left AST#expression#Left AST#ca... | aboutToAppear(): void {
font.registerFont({
familyName: 'myFont',
familySrc: '/fonts/iconfont.ttf'
})
this.handleSort(0)
} | https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/案例/掘金评论案例.ets#L13-L22 | 982842166d43b3ab44620055d95780f2129c6403 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets | arkts | checkPermissionGrant | 检查用户是否授权
@param permission
@returns | static async checkPermissionGrant(permission: Permissions): Promise<boolean> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
// 获取应用程序的accessTokenID
let tokenId: number ... | AST#method_declaration#Left static async checkPermissionGrant AST#parameter_list#Left ( AST#parameter#Left permission : AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#L... | static async checkPermissionGrant(permission: Permissions): Promise<boolean> {
let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
let tokenId: number = 0;
try {
le... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/module_city_select/src/main/ets/common/Utils.ets#L94-L118 | 96d33c364d8b1b958ecac046397f26f3255a021e | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/subscription/SubscriptionInfoManager.ets | arkts | autoRefreshSubscriptionInfoIfNeeds | ------------------------- 自动刷新订阅信息 ------------------------- 自动刷新订阅信息(判断时间间隔) | autoRefreshSubscriptionInfoIfNeeds(): void {
// 检查网络
if (!NetWorkTool.checkInternetConnection(false)) return;
// // 检查自动刷新开关
// if (!AppCfgManager.shared.isAutoRefreshSubscriptionInfo_is_ON()) {
// Toast.showDebugMessage("自动刷新订阅时间..未启用");
// return;
// }
// 判断时间间隔是否到达
if (Time... | AST#method_declaration#Left autoRefreshSubscriptionInfoIfNeeds AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 检查网络 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left ... | autoRefreshSubscriptionInfoIfNeeds(): void {
if (!NetWorkTool.checkInternetConnection(false)) return;
if (TimeToManager.isTimeTo(TimeToType.autoRefreshSubsciptionInfo)) {
Toast.showDebugMessage("自动刷新订阅时间..start..");
this.refreshSubscriptionInfo(true);
Ti... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/subscription/SubscriptionInfoManager.ets#L82-L99 | 5949ddb301c62e37f145771c52433d2081df1118 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets | arkts | reset | 重置倒计时 | reset(): void {
this.stop();
this.remainMs = this.totalMs;
} | AST#method_declaration#Left reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AS... | reset(): void {
this.stop();
this.remainMs = this.totalMs;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L103-L106 | 24e51198422d5898efb09914d59763fce7788817 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | getNavStack | 获取默认栈名的路由栈,初次调用会创建一个实例,并入参到Navigation构造方法中
@param willShow 可选
@returns | public static getNavStack(willShow?: InterceptionShowCallback): NavPathStack {
return ZRouter.getRouterMgr().getNavStackByName(DEFAULT_STACK_NAME, willShow)
} | AST#method_declaration#Left public static getNavStack AST#parameter_list#Left ( AST#parameter#Left willShow ? : AST#type_annotation#Left AST#primary_type#Left InterceptionShowCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t... | public static getNavStack(willShow?: InterceptionShowCallback): NavPathStack {
return ZRouter.getRouterMgr().getNavStackByName(DEFAULT_STACK_NAME, willShow)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L244-L246 | 37522d033074038ffe6c7ac22bd3926641028fea | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | fdatasyncSync | 实现文件内容数据同步,以同步方法。
@param fd number 已打开的文件描述符。 | static fdatasyncSync(fd: number) {
fs.fdatasyncSync(fd);
} | AST#method_declaration#Left static fdatasyncSync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expr... | static fdatasyncSync(fd: number) {
fs.fdatasyncSync(fd);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L762-L764 | 683bed6c21526b026eab6c3f9ecfe6e23012996f | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/model/src/main/ets/entity/LogisticsItem.ets | arkts | @file 物流轨迹项实体类
@author Joker.X | export class LogisticsItem {
/**
* 时间
*/
time?: string | null = null;
/**
* 状态描述
*/
status?: string | null = null;
constructor(init?: Partial<LogisticsItem>) {
if (!init) {
return;
}
this.time = init.time ?? this.time;
this.status = init.status ?? this.status;
}
} | AST#export_declaration#Left export AST#class_declaration#Left class LogisticsItem AST#class_body#Left { /**
* 时间
*/ AST#property_declaration#Left time ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_... | export class LogisticsItem {
time?: string | null = null;
status?: string | null = null;
constructor(init?: Partial<LogisticsItem>) {
if (!init) {
return;
}
this.time = init.time ?? this.time;
this.status = init.status ?? this.status;
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/LogisticsItem.ets#L5-L22 | 48f1284c4c728dc6987eb1c0abf89c1e39ae3754 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/LanguageDetector.ets | arkts | getSystemRegion | 获取系统地区 | private async getSystemRegion(): Promise<string> {
try {
const region = await systemParameter.getSync('const.global.region');
return region || 'CN';
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to get system region: ${error}`);
return 'CN'... | AST#method_declaration#Left private async getSystemRegion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right >... | private async getSystemRegion(): Promise<string> {
try {
const region = await systemParameter.getSync('const.global.region');
return region || 'CN';
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Failed to get system region: ${error}`);
return 'CN'... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L391-L400 | d8de70fa0bc90601b5c63368b1f94b3e1be8f4cd | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NetworkUtil.ets | arkts | getOperatorName | 获取运营商名称
@param slotId 卡槽ID,如果不指定slotId,默认移动数据的SIM卡。
@returns | static async getOperatorName(slotId?: number): Promise<string> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId(); //获取默认移动数据的SIM卡。
return radio.getOperatorName(slotId);
} | AST#method_declaration#Left static async getOperatorName AST#parameter_list#Left ( AST#parameter#Left slotId ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene... | static async getOperatorName(slotId?: number): Promise<string> {
slotId = slotId ?? await NetworkUtil.getDefaultCellularDataSlotId();
return radio.getOperatorName(slotId);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L344-L347 | 06124120eda310c0eb6f4f4e07c9fbea4f5b1621 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets | arkts | CreateTunnel | [End call_the_ondestroy_method] 创建隧道的方法 | CreateTunnel() {
Logger.info('xdw step1');
gTunnelFd = vpn_client.udpConnect(this.vpnServerIp, 1194);
if (gTunnelFd < 0) {
Logger.error(tag, 'Failed to create UDP tunnel');
return;
}
Logger.info(tag, `Tunnel created, FD: ${gTunnelFd}`);
this.Protect();
} | AST#method_declaration#Left CreateTunnel AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_expre... | CreateTunnel() {
Logger.info('xdw step1');
gTunnelFd = vpn_client.udpConnect(this.vpnServerIp, 1194);
if (gTunnelFd < 0) {
Logger.error(tag, 'Failed to create UDP tunnel');
return;
}
Logger.info(tag, `Tunnel created, FD: ${gTunnelFd}`);
this.Protect();
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/vpnability/VPNExtentionAbility.ets#L85-L94 | 3bb0c32fa7ed63e953fb425e6d9bd834fd5513f3 | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | 用户列表响应 | export interface UserListResponse {
userList: UserItem[];
groupList?: GroupItem[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface UserListResponse AST#object_type#Left { AST#type_member#Left userList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UserItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ... | export interface UserListResponse {
userList: UserItem[];
groupList?: GroupItem[];
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L115-L118 | 8a390878207dd058c997bf62821d3fca1c174e35 | github | |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showWarning | 显示警告提示
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showWarning(message: string | ResourceStr): void {
IBestToast.show({
type: "warning",
message: message
});
} | AST#method_declaration#Left static showWarning AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#R... | static showWarning(message: string | ResourceStr): void {
IBestToast.show({
type: "warning",
message: message
});
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L46-L51 | b8e8f0e926277fad86fb257269a25045be488e75 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/MDNS_case/entry/src/main/ets/pages/Index.ets | arkts | startServiceDiscovery | [End manage_local_services] [Start discover_local_services] | private async startServiceDiscovery(): Promise<void> {
this.discoveryStatus = serviceOperateStatus.DISCOVERY_STARTING;
if (!context) {
this.discoveryStatus = serviceOperateStatus.DISCOVERY_FAIL3;
Logger.error('Context is undefined or null.');
return;
}
let serviceType = '_print._tcp';... | AST#method_declaration#Left private async startServiceDiscovery AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Rig... | private async startServiceDiscovery(): Promise<void> {
this.discoveryStatus = serviceOperateStatus.DISCOVERY_STARTING;
if (!context) {
this.discoveryStatus = serviceOperateStatus.DISCOVERY_FAIL3;
Logger.error('Context is undefined or null.');
return;
}
let serviceType = '_print._tcp';... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/MDNS_case/entry/src/main/ets/pages/Index.ets#L248-L276 | 80d6eacde56add0f5a00acbc4482c7347e9e7504 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chatwithexpression/src/main/ets/model/Message.ets | arkts | 聊天信息 | export class MessageBase {
maxWidth: number = 0; // 最大宽度
isSelf: boolean = true; // 是否本人发言
userName: string = ''; // 发言人信息
profilePicture: string = '' // 发言人头像
spanItems: Array<SpanItem> = []; // Span、ImageSpan 信息列表
constructor(self: boolean, userName: string, profilePicture: string, maxWidth: number) {
... | AST#export_declaration#Left export AST#class_declaration#Left class MessageBase AST#class_body#Left { AST#property_declaration#Left maxWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Ri... | export class MessageBase {
maxWidth: number = 0;
isSelf: boolean = true;
userName: string = '';
profilePicture: string = ''
spanItems: Array<SpanItem> = [];
constructor(self: boolean, userName: string, profilePicture: string, maxWidth: number) {
this.isSelf = self;
this.userName = userName;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/model/Message.ets#L36-L48 | d03fcef2be7597b143f5d5be31998b0f276f8ed7 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/DES.ets | arkts | decryptSync | 解密,同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。
@returns | static decryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, symKey, params, transformation);
} | AST#method_declaration#Left static decryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey :... | static decryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, symKey, params, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L181-L183 | 67ad55bcfdb068ce3286c0a963f93b89295c29ac | gitee |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/OpenAI.ets | arkts | 提交给AI的问题 | export class ChatInfo {
public model: string = ""
public messages: Array<Message> = new Array()
constructor | AST#export_declaration#Left export AST#ERROR#Left class ChatInfo { AST#property_declaration#Left public model : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "" AST#expression#Right AST#property_declaration#Right public messages : AST#type_... | export class ChatInfo {
public model: string = ""
public messages: Array<Message> = new Array()
constructor | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/OpenAI.ets#L14-L18 | dbd85d04108f5002eee6f9e979f6c4aee6378ac3 | gitee | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets | arkts | attaches | 弹窗挂件(可选) (类型为PresetAttach枚举时,使用预设的挂件;IPresetAttachImage时,为自定义挂件)
@description 目前预设挂件:1. 弹窗内部关闭按钮,如右上角;2. 弹窗外关闭按钮,如弹窗底部中间
@description1 可自定义挂件,继承IPresetAttachImage接口即可
@param attaches 弹窗挂件
@param attachAction 挂件点击回调 @NumberCallback (index:number)=>void (index为attaches数组顺序) | attaches(attaches: AttachType[], attachAction?: NumberCallback) {
this.builderOptions.attaches = attaches;
this.builderOptions.attachAction = attachAction;
return this;
} | AST#method_declaration#Left attaches AST#parameter_list#Left ( AST#parameter#Left attaches : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AttachType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left attachAction ? : AST#type_annotati... | attaches(attaches: AttachType[], attachAction?: NumberCallback) {
this.builderOptions.attaches = attaches;
this.builderOptions.attachAction = attachAction;
return this;
} | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseBuilderProxy.ets#L143-L148 | fd95d3743b8aa34da8db70f9bbc6a7cc2473c9fc | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | darkenColor | 颜色变暗 | private darkenColor(color: string, factor: number): string {
const hex = color.replace('#', '');
const num = parseInt(hex, 16);
const amt = Math.round(255 * factor);
const R = Math.max(0, (num >> 16) - amt);
const G = Math.max(0, (num >> 8 & 0x00FF) - amt);
const B = Math.max(0, (num & 0x0000FF)... | AST#method_declaration#Left private darkenColor AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left factor : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | private darkenColor(color: string, factor: number): string {
const hex = color.replace('#', '');
const num = parseInt(hex, 16);
const amt = Math.round(255 * factor);
const R = Math.max(0, (num >> 16) - amt);
const G = Math.max(0, (num >> 8 & 0x00FF) - amt);
const B = Math.max(0, (num & 0x0000FF)... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6129-L6137 | 6ae562a230daacf4e5ebfc0d9b4c574db0c6909e | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/customcomponents/CustomTabBar.ets | arkts | CustomTabBar | 非选中状态的外边距初始值 | @Component
export struct CustomTabBar {
@Link currentIndex: TabBarType;
@StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0;
build() {
Row() {
ForEach(TABS_INFO, (item: TabBarData) => {
this.TabItem(item.id);
}, (item: TabBarData) => item.id.toString())
}
.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left TabBarType AST#primary_type#Right AST#ty... | @Component
export struct CustomTabBar {
@Link currentIndex: TabBarType;
@StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0;
build() {
Row() {
ForEach(TABS_INFO, (item: TabBarData) => {
this.TabItem(item.id);
}, (item: TabBarData) => item.id.toString())
}
.... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/customcomponents/CustomTabBar.ets#L26-L79 | 08fe44057586b3c80c23533833bae3220d2e2a9f | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/AppUtility.ets | arkts | getLengthOfStringWithoutKind | / 查找去除kind之后的字符串长度 | private static getLengthOfStringWithoutKind(str: string): number {
const strPoint: string = STR_POINT_HALF;
const indexNoFound: number = -1;
let strLength: number = 0;
if (str) {
strLength = str.length;
const index: number = str.indexOf(strPoint);
if (index !== indexNoFound) {
... | AST#method_declaration#Left private static getLengthOfStringWithoutKind AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef... | private static getLengthOfStringWithoutKind(str: string): number {
const strPoint: string = STR_POINT_HALF;
const indexNoFound: number = -1;
let strLength: number = 0;
if (str) {
strLength = str.length;
const index: number = str.indexOf(strPoint);
if (index !== indexNoFound) {
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L245-L258 | 11e47c3a66516e5fc7e8f63648f364fc2441d911 | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowAppSettings.ets | arkts | scroll_settings_to | Scrolls to a specific category of settings.
Triggered by @Watch of this.settings_scroll_to. | scroll_settings_to() {
if (this.settings_scroll_to < 0) {
return;
}
this.settings_scroll_to_highlight_timeout = 1200;
this.waterFlow_control.scrollToIndex(this.settings_scroll_to, true);
} | AST#method_declaration#Left scroll_settings_to AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . setti... | scroll_settings_to() {
if (this.settings_scroll_to < 0) {
return;
}
this.settings_scroll_to_highlight_timeout = 1200;
this.waterFlow_control.scrollToIndex(this.settings_scroll_to, true);
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowAppSettings.ets#L1722-L1728 | b26bfe1feb2e8a7bd9e49b73d971c19618b8ad57 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/router/AppRouter.ets | arkts | replace | 页面替换
@param path 目标页面路径
@param options 替换选项 | async replace(path: string, options?: RouteOptions): Promise<void> {
try {
const routerOptions: router.RouterOptions = {
url: path,
params: options?.params
};
await router.replaceUrl(routerOptions, options?.mode || router.RouterMode.Standard);
// 更新导航栈
if ... | AST#method_declaration#Left async replace AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left RouteOptions AST#primar... | async replace(path: string, options?: RouteOptions): Promise<void> {
try {
const routerOptions: router.RouterOptions = {
url: path,
params: options?.params
};
await router.replaceUrl(routerOptions, options?.mode || router.RouterMode.Standard);
if (this.na... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/router/AppRouter.ets#L108-L131 | d70f0917d4334ad49c5a0f2e58a4387b3f68c283 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FileUtil.ets | arkts | deactivatePermissionEasy | 取消使能授权过的多个文件或目录。(需要权限:ohos.permission.FILE_ACCESS_PERSIST)
@param uris string 需要授予或使能权限的URI。
@param operationMode number 授予或使能权限的URI访问模式,参考OperationMode,例如: fileShare.OperationMode.READ_MODE :允许读授权。fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE :允许读写授权。
@returns 无返回结果的Promise对象。 | static async deactivatePermissionEasy(uris: Array<string>,
operationMode: number = fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE): Promise<void> {
let policies: Array<fileShare.PolicyInfo> = new Array<fileShare.PolicyInfo>();
for (let index = 0; index < uris.length; index++) {
... | AST#method_declaration#Left static async deactivatePermissionEasy AST#parameter_list#Left ( AST#parameter#Left uris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Righ... | static async deactivatePermissionEasy(uris: Array<string>,
operationMode: number = fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE): Promise<void> {
let policies: Array<fileShare.PolicyInfo> = new Array<fileShare.PolicyInfo>();
for (let index = 0; index < uris.length; index++) {
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L973-L981 | 29f2e8689708d0bcedbec5eba512bc8bfc53a76d | gitee |
anhao0226/harmony-music-player.git | 4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073 | entry/src/main/ets/components/CustomTabBar.ets | arkts | CustomTabBar | CustomTabBar | @Component
export struct CustomTabBar {
@State currentIndex: number = 0;
@State barWidth: number = 0;
@BuilderParam viewBuilder: (item: TabBarItemInterface, index: number) => void;
@BuilderParam menuBuilder?: () => void = this._defaultMenuBuilder;
@Builder _defaultMenuBuilder() {
}
//
@Link tabs: TabBa... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_... | @Component
export struct CustomTabBar {
@State currentIndex: number = 0;
@State barWidth: number = 0;
@BuilderParam viewBuilder: (item: TabBarItemInterface, index: number) => void;
@BuilderParam menuBuilder?: () => void = this._defaultMenuBuilder;
@Builder _defaultMenuBuilder() {
}
@Link tabs: TabBarI... | https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/components/CustomTabBar.ets#L17-L60 | 503cc502e8fed5a574339c143a0cc70377d69c32 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | isValueLineVariableLength | When valuePosition is OutsideSlice, this allows variable line length
@Override | public isValueLineVariableLength(): boolean {
return this.mValueLineVariableLength;
} | AST#method_declaration#Left public isValueLineVariableLength AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left A... | public isValueLineVariableLength(): boolean {
return this.mValueLineVariableLength;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L253-L255 | 41c9fe6c70e7ee776de47a7cb4bedea2cb63c27d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/model/ActionItem.ets | arkts | 操作项信息 | export interface ActionItem {
id: string;
title: string | Resource;
subTitle: string | Resource;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ActionItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left title : AST#type_annotation#Left AST... | export interface ActionItem {
id: string;
title: string | Resource;
subTitle: string | Resource;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/model/ActionItem.ets#L19-L23 | 6325e6307e53351d71c56d5407b388a49dd8abd5 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets | arkts | aboutToAppear | 页面加载之前触发 | aboutToAppear() {
// ...
} | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // ... } AST#builder_function_body#Right AST#method_declaration#Right | aboutToAppear() {
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/grammar/entry/src/main/ets/pages/LifeCycle1.ets#L57-L59 | 5155404cd204693ce7c495621e8ce5d93626b7f5 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets | arkts | aboutToAppear | 设置深色浅色,默认跟随系统。 | aboutToAppear(): void {
this.statusBarHeight = Helper.getStatusBarHeight();
this.indicatorHeight = Helper.getIndicatorHeight();
if (this.options.title) {
this.title = Helper.getResourceStr(this.options.title) ?? "";
}
if (this.options.sheets && this.options.sheets.length >= 1) {
this.len... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | aboutToAppear(): void {
this.statusBarHeight = Helper.getStatusBarHeight();
this.indicatorHeight = Helper.getIndicatorHeight();
if (this.options.title) {
this.title = Helper.getResourceStr(this.options.title) ?? "";
}
if (this.options.sheets && this.options.sheets.length >= 1) {
this.len... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets#L39-L52 | f490aad25eb60608d110f157c371b418bc15c9fb | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM3Sync.ets | arkts | @Author csx
@DateTime 2024/3/18 10:37:03
@TODO SM3Sync SM3同步工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto | export class SM3Sync {
/**
* SM3摘要
* @param str 带摘要的字符串
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 摘要后的字符串
*/
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SM3', resultCoding);
}
/**
* 消息认证... | AST#export_declaration#Left export AST#class_declaration#Left class SM3Sync AST#class_body#Left { /**
* SM3摘要
* @param str 带摘要的字符串
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 摘要后的字符串
*/ AST#method_declaration#Left static digest AST#parameter_list#Left ( AST#parameter#Left str : A... | export class SM3Sync {
static digest(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.digest(str, 'SM3', resultCoding);
}
static hmac(str: string, resultCoding: buffer.BufferEncoding = 'base64'): string {
return DynamicSyncUtil.hmac(str, 'SM3', resultCodi... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM3Sync.ets#L27-L47 | 857f1fa4d892eec008b077ab19cb87a9fca641ad | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/component/HomeCategorySection.ets | arkts | getColumnsCount | 获取当前断点对应的列数
@returns {number} 列数 | private getColumnsCount(): number {
return bp({ sm: 5, md: 10, lg: 10 });
} | AST#method_declaration#Left private getColumnsCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_ex... | private getColumnsCount(): number {
return bp({ sm: 5, md: 10, lg: 10 });
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCategorySection.ets#L96-L98 | b10f32ce8489b87a8e77788ce9accb59f9a7b0f8 | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleBackupManager.ets | arkts | 简化的备份结果接口 | export interface SimpleBackupResult {
success: boolean;
message?: string;
timestamp: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SimpleBackupResult AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left message ? : AST#type_a... | export interface SimpleBackupResult {
success: boolean;
message?: string;
timestamp: number;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleBackupManager.ets#L16-L20 | 886daaafd4225d3012520f7f5f5af0ed478ff968 | github | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/timer/TimerDialog.ets | arkts | subscribeStartTimer | 启动计时器 | subscribeStartTimer() {
EmitterUtil.subscribe(VHRoomEventType.TIMER_START, (msgData: EmitterMsgData) => {
console.log(`启动计时器,类型:${VHRoomEventType.TIMER_START}`);
let timerInfo: VHTimerMsg = msgData.data as VHTimerMsg;
this.initTimerMsg(timerInfo);
this.startTimer();
});
} | AST#method_declaration#Left subscribeStartTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left EmitterUtil AST#expression#Right . subscribe... | subscribeStartTimer() {
EmitterUtil.subscribe(VHRoomEventType.TIMER_START, (msgData: EmitterMsgData) => {
console.log(`启动计时器,类型:${VHRoomEventType.TIMER_START}`);
let timerInfo: VHTimerMsg = msgData.data as VHTimerMsg;
this.initTimerMsg(timerInfo);
this.startTimer();
});
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/timer/TimerDialog.ets#L198-L205 | 07d1952cca53004252e2179cbca960bec4371614 | gitee |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectMember.ets | arkts | getFamilyById | 根据用户id查询家庭信息 | async getFamilyById() {
if (this.userId != '') {
await DistScheduleService.getFamilyById(this.userId)
.then((families) => {
if (families.length > 0) {
this.familyName = families[0].name
this.getMemberById(families[0].id)
}
}).catch((err) => {
... | AST#method_declaration#Left async getFamilyById AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expressi... | async getFamilyById() {
if (this.userId != '') {
await DistScheduleService.getFamilyById(this.userId)
.then((families) => {
if (families.length > 0) {
this.familyName = families[0].name
this.getMemberById(families[0].id)
}
}).catch((err) => {
... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/schedule/pages/selectMember.ets#L108-L122 | 9958b57572fd1b38ae0abe7bb9baa1db7d824420 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets | arkts | initLoad | 初始化加载(子类可在 aboutToAppear 中调用)
@returns {void} 无返回值 | protected initLoad(): void {
this.loadListData();
} | AST#method_declaration#Left protected initLoad AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expre... | protected initLoad(): void {
this.loadListData();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkListViewModel.ets#L66-L68 | 758497707ae2ac740ceec14dcc5a59a000b4a3fd | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets | arkts | getData | 获取指定数据项 | getData(index: number): Comment {
return this.comments[index];
} | AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_type#Right A... | getData(index: number): Comment {
return this.comments[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets#L112-L114 | be0ef7462d351c507a3e29d65004d5db4ed01126 | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/media/MediaManager.ets | arkts | playVideo | 播放视频 | async playVideo(url: string): Promise<boolean> {
try {
Logger.info('MediaManager', `Playing video: ${url}`);
// 实际实现需要使用 @ohos.multimedia.media
return true;
} catch (error) {
Logger.error('MediaManager', `Failed to play video: ${String(error)}`);
return false;
}
} | AST#method_declaration#Left async playVideo AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom... | async playVideo(url: string): Promise<boolean> {
try {
Logger.info('MediaManager', `Playing video: ${url}`);
return true;
} catch (error) {
Logger.error('MediaManager', `Failed to play video: ${String(error)}`);
return false;
}
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/media/MediaManager.ets#L76-L85 | e3dedb123b356beecfb55f57e7cc5e6442af8b87 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/control_flow/loop_stmt/for_update_001_T.ets | arkts | Introduction 循环结构-update语句 | export function for_update_001_T(taint_src : string) {
let t = ""
let ini = 0
let j = "_"
for (; ini < 2; j = taint_src) {
t = j
ini++
}
taint.Sink(t);
} | AST#export_declaration#Left export AST#function_declaration#Left function for_update_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le... | export function for_update_001_T(taint_src : string) {
let t = ""
let ini = 0
let j = "_"
for (; ini < 2; j = taint_src) {
t = j
ini++
}
taint.Sink(t);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/for_update_001_T.ets#L6-L15 | 83ec7ab5dbc7ecc41e127ed2dd844461017795c2 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets | arkts | AES加密参数
@param authTag 加解密参数,加密数据时不需要传参,会在调用cipher的doFinal方法时生成,解密时需要传入
@returns | export function genGcmParamsSpec(authTag?: string): cryptoFramework.GcmParamsSpec {
let arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; // 12 bytes
let dataIv = new Uint8Array(arr);
let ivBlob: cryptoFramework.DataBlob = { data: dataIv };
arr = [0, 0, 0, 0, 0, 0, 0, 0]; // 8 bytes
let dataAad = new Uint8Array(ar... | AST#export_declaration#Left export AST#function_declaration#Left function genGcmParamsSpec AST#parameter_list#Left ( AST#parameter#Left authTag ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#... | export function genGcmParamsSpec(authTag?: string): cryptoFramework.GcmParamsSpec {
let arr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let dataIv = new Uint8Array(arr);
let ivBlob: cryptoFramework.DataBlob = { data: dataIv };
arr = [0, 0, 0, 0, 0, 0, 0, 0];
let dataAad = new Uint8Array(arr);
let aadBlob: cr... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/AesUtils.ets#L137-L158 | bad6c9267a4203204abbebd39e9e8fa45c26722a | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/DatabaseService.ets | arkts | migrateDatabase | 执行数据库迁移
每次升级版本时,在这里添加对应的迁移逻辑 | private async migrateDatabase(fromVersion: number, toVersion: number): Promise<void> {
if (!this.rdbStore) return;
console.info(`[DatabaseService] Migrating from v${fromVersion} to v${toVersion}`);
// 逐版本升级
for (let version = fromVersion; version < toVersion; version++) {
await this.migrateToVer... | AST#method_declaration#Left private async migrateDatabase AST#parameter_list#Left ( AST#parameter#Left fromVersion : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toVersion : AST#type_annotation#Left AST#primary_type#Left ... | private async migrateDatabase(fromVersion: number, toVersion: number): Promise<void> {
if (!this.rdbStore) return;
console.info(`[DatabaseService] Migrating from v${fromVersion} to v${toVersion}`);
for (let version = fromVersion; version < toVersion; version++) {
await this.migrateToVersion(ver... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L139-L148 | 8ff28f1650ae3212260d047ca91445c2187fc2d5 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/Manacher.ets | arkts | longestPalindrome | 查找最长回文子串
@param str 输入字符串
@returns 最长回文子串 | static longestPalindrome(str: string): string {
if (!str || str.length === 0) {
return '';
}
// 预处理字符串,在每个字符之间插入特殊字符
const processed = Manacher.preprocess(str);
const n = processed.length;
const p: number[] = new Array(n).fill(0); // 回文半径数组
let center = 0; // 当前最大回文的中心
let rightBo... | AST#method_declaration#Left static longestPalindrome AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static longestPalindrome(str: string): string {
if (!str || str.length === 0) {
return '';
}
const processed = Manacher.preprocess(str);
const n = processed.length;
const p: number[] = new Array(n).fill(0);
let center = 0;
let rightBound = 0;
let maxLen = 0;
let maxCe... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/Manacher.ets#L11-L56 | ff50809693afcd79129e7115e67f07b08b4aff3f | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/member/MemberManager.ets | arkts | checkDictShowable | / 检查 内置词典 是否可用 | public checkDictShowable(showMessage: boolean = true): boolean {
if (this.isActive) { return true } // 非会员才做检查
if (this.maxDictShowCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.dictShow)) {
if (showMessage) {
Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit_... | AST#method_declaration#Left public checkDictShowable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#p... | public checkDictShowable(showMessage: boolean = true): boolean {
if (this.isActive) { return true }
if (this.maxDictShowCountDaily <= DailyCountManager.shared.dailyCount(DailyCountType.dictShow)) {
if (showMessage) {
Toast.showMessage(getStringF($r('app.string.member_manager_msg_limit_dict_show'... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L230-L241 | ddc7e028423bd139b0b51a32658eed13914613c9 | github |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | entry/src/main/ets/views/ContentView.ets | arkts | holdingHandStatusChange | 监听握持手位置 | @Monitor('appTmpData.holdingHandStatus')
holdingHandStatusChange() {
// 开启智感握持
if (this.appAppearanceData.isSmartGripDetection) {
// 未握持
if (this.appTmpData.holdingHandStatus === 0) {
this.positionRight = 16;
}
// 左手握持
else if (this.appTmpData.holdingHandStatus === 1) {
... | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'appTmpData.holdingHandStatus' AST#expression#Right ) AST#decorator#Right holdingHandStatusChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 开启智感握持 AST#ui_control_flow#Left AST#ui_if_statement#Le... | @Monitor('appTmpData.holdingHandStatus')
holdingHandStatusChange() {
if (this.appAppearanceData.isSmartGripDetection) {
if (this.appTmpData.holdingHandStatus === 0) {
this.positionRight = 16;
}
else if (this.appTmpData.holdingHandStatus === 1) {
this.positionRi... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/ContentView.ets#L96-L121 | 8af87fb60572080a6a5dc626625cdbcdcb597bae | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/pages/AcademyPage.ets | arkts | loadLLMConfigs | 加载大模型配置 | private loadLLMConfigs(): void {
this.llmConfigs = this.llmConfigManager.getAllConfigs();
const summary = this.llmConfigManager.getConfigSummary();
this.configSummary = {
total: summary.total,
hasDefault: summary.hasDefault,
providers: summary.providers
};
} | AST#method_declaration#Left private loadLLMConfigs AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_ex... | private loadLLMConfigs(): void {
this.llmConfigs = this.llmConfigManager.getAllConfigs();
const summary = this.llmConfigManager.getConfigSummary();
this.configSummary = {
total: summary.total,
hasDefault: summary.hasDefault,
providers: summary.providers
};
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/pages/AcademyPage.ets#L176-L184 | 080cbddca75c9a8d5debd2ba7915d9479561aab6 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DialogUtils.ets | arkts | getTextInput | 获取showTextInputDialog的输入框内容
@param dialogId
@returns | static getTextInput(dialogId: string): string {
let content = GlobalContext.getContext().get<string>(`${DialogUtils.CACHE_LABEL}${dialogId}`);
return content;
} | AST#method_declaration#Left static getTextInput AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static getTextInput(dialogId: string): string {
let content = GlobalContext.getContext().get<string>(`${DialogUtils.CACHE_LABEL}${dialogId}`);
return content;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L168-L171 | 0940884a96760373c047bc6ab0032341327821fd | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/LocationUtil.ets | arkts | convertCoordinateEasy | 坐标转换,将WGS84坐标系转换为GCJ02坐标系。
@param location 待转换坐标。
@returns | static convertCoordinateEasy(location: mapCommon.LatLng): mapCommon.LatLng {
return LocationUtil.convertCoordinateSync(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, location);
} | AST#method_declaration#Left static convertCoordinateEasy AST#parameter_list#Left ( AST#parameter#Left location : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left mapCommon . LatLng AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | static convertCoordinateEasy(location: mapCommon.LatLng): mapCommon.LatLng {
return LocationUtil.convertCoordinateSync(mapCommon.CoordinateType.WGS84, mapCommon.CoordinateType.GCJ02, location);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L335-L337 | 994eff20461e7eacddcc70a3d255473529a366b9 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.