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
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinX.ets
arkts
SpinX
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinX { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local scale2: number = 0.3; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.sp...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinX AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinX { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local scale2: number = 0.3; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.sp...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinX.ets#L27-L99
9e0b91b1f480eb038ff04d0e0ebd5b8cd3a860b0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
saveLearn
/ 保存学习记录Learn
public static async saveLearn(learn: Learn): Promise<void> { // 保存到db await PlanDbAccess.shared.insertLearn(learn.asDBLearn()); }
AST#method_declaration#Left public static async saveLearn AST#parameter_list#Left ( AST#parameter#Left learn : AST#type_annotation#Left AST#primary_type#Left Learn 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...
public static async saveLearn(learn: Learn): Promise<void> { await PlanDbAccess.shared.insertLearn(learn.asDBLearn()); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L452-L455
9be0688f5cdad86a31d6c0514c24dfb67bc2bbcb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
multiCodeBreathe
多二维码结果图案的呼吸动效
multiCodeBreathe(): void { this.multiCodeScale = 1; animateTo({ duration: 300, curve: curves.cubicBezierCurve(0.33, 0, 0.67, 1), // Animation curve. delay: 0, iterations: 4, playMode: PlayMode.Alternate, onFinish: () => { funcDelayer(() => { this.multiCodeBr...
AST#method_declaration#Left multiCodeBreathe 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_expressi...
multiCodeBreathe(): void { this.multiCodeScale = 1; animateTo({ duration: 300, curve: curves.cubicBezierCurve(0.33, 0, 0.67, 1), delay: 0, iterations: 4, playMode: PlayMode.Alternate, onFinish: () => { funcDelayer(() => { this.multiCodeBreathe(); },...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonCodeLayout.ets#L317-L333
e3c0adffd37b2c2ac52a187b18bf0782261aacf2
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets
arkts
check
设置弹窗复选框 @param isChecked 默认是否勾选 @param onCheckedChange 勾选变化回调 @param checkTips 复选框右侧文本 @returns
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, checkTips?: ResourceStr) { (this.builderOptions as IConfirmDialogOptions).checkTips = checkTips; (this.builderOptions as IConfirmDialogOptions).isChecked = isChecked; (this.builderOptions as IConfirmDialogOptions).onCheckedChange = onCheckedChan...
AST#method_declaration#Left check AST#parameter_list#Left ( AST#parameter#Left isChecked : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left onCheckedChange ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
check(isChecked: boolean, onCheckedChange?: Callback<boolean>, checkTips?: ResourceStr) { (this.builderOptions as IConfirmDialogOptions).checkTips = checkTips; (this.builderOptions as IConfirmDialogOptions).isChecked = isChecked; (this.builderOptions as IConfirmDialogOptions).onCheckedChange = onCheckedChan...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ConfirmBuilderProxy.ets#L63-L68
d19c96684ba99be2435b7de55e9764ec465d55d0
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets
arkts
changeOrientation
Change the horizontal and vertical screen status functions of the device
private changeOrientation(isLandscape: boolean) { // Obtain the context of the UIAbility instance let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; // Call this API to manually change the horizontal and vertical screen status of the device window.get...
AST#method_declaration#Left private changeOrientation AST#parameter_list#Left ( AST#parameter#Left isLandscape : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Obtain the context of the ...
private changeOrientation(isLandscape: boolean) { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; window.getLastWindow(context).then((lastWindow) => { lastWindow.setPreferredOrientation(isLandscape ? window.Orientation.LANDSCAPE : window.Or...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets#L37-L44
7763630ba555d0d59bc3fc5150336a901063d413
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/DataSyncVerifier.ets
arkts
clearAllTestData
清空所有测试数据
async clearAllTestData(): Promise<void> { try { // 获取所有任务并删除 const allTasks = this.taskViewModel.getAllTasks(); for (const task of allTasks) { await this.taskViewModel.deleteTask(task.id); } hilog.info(0x0000, 'DataSyncVerifier', 'All test data cleared'); } catch (error) { ...
AST#method_declaration#Left async clearAllTestData 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...
async clearAllTestData(): Promise<void> { try { const allTasks = this.taskViewModel.getAllTasks(); for (const task of allTasks) { await this.taskViewModel.deleteTask(task.id); } hilog.info(0x0000, 'DataSyncVerifier', 'All test data cleared'); } catch (error) { hilog....
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DataSyncVerifier.ets#L39-L50
ffae9688453c4263d68e8ada7196a1936f7089f4
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/menu/menuExpand.ets
arkts
MenuExpandBuilder
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 MenuExpandBuilder(name: string, param: Object) { MenuExpandExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function MenuExpandBuilder 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 par...
@Builder export function MenuExpandBuilder(name: string, param: Object) { MenuExpandExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/menuExpand.ets#L16-L19
fc9f65cbd3501d348619e5af1bd3a02f1f059d5a
gitee
ElegantDancer/arkts.git
5f46683fa690e0e976c7dee6813c2a04f3922ea2
ToDoListArkTS/entry/build/default/generated/profile/default/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const BUNDLE_NAME = 'com.huawei.todolist';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BUNDLE_NAME = AST#expression#Left 'com.huawei.todolist' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const BUNDLE_NAME = 'com.huawei.todolist';
https://github.com/ElegantDancer/arkts.git/blob/5f46683fa690e0e976c7dee6813c2a04f3922ea2/ToDoListArkTS/entry/build/default/generated/profile/default/BuildProfile.ets#L4-L4
e8f27e4371c8e8ddbcf2ad7bb3981fb8aacd7bfe
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/VoiceService.ets
arkts
语音识别结果接口
export interface RecognitionResult { text: string; confidence: number; timestamp: string; duration: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RecognitionResult AST#object_type#Left { AST#type_member#Left text : 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 confidence : AST#type_annot...
export interface RecognitionResult { text: string; confidence: number; timestamp: string; duration: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/VoiceService.ets#L18-L23
7bd179119495e371cdce86a757d55fb95877befc
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/AnimationAttribute.ets
arkts
动效属性,提供了必需的动效属性,后续添加属性可通过继承该类实现
export class AnimationAttribute { // 背景条左边距,即:背景条左侧离tab组件左侧的距离 public left: number = 0; // 背景条宽度 public indicatorBarWidth: number = 0; // 背景条高度 public indicatorBarHeight: number = 0; }
AST#export_declaration#Left export AST#class_declaration#Left class AnimationAttribute AST#class_body#Left { // 背景条左边距,即:背景条左侧离tab组件左侧的距离 AST#property_declaration#Left public left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#express...
export class AnimationAttribute { public left: number = 0; public indicatorBarWidth: number = 0; public indicatorBarHeight: number = 0; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/AnimationAttribute.ets#L20-L27
6d2e792dcb34567c87356e651abaace3b14feab2
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets
arkts
getConfirmOrder
获取确认订单页数据 @returns {Promise<NetworkResponse<ConfirmOrder>>} 确认订单信息
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { const resp: AxiosResponse<NetworkResponse<ConfirmOrder>> = await NetworkClient.http.get("page/confirmOrder"); return resp.data; }
AST#method_declaration#Left async getConfirmOrder 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 AST#generic_type#Left NetworkResponse AST#type_arguments#Left < A...
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { const resp: AxiosResponse<NetworkResponse<ConfirmOrder>> = await NetworkClient.http.get("page/confirmOrder"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets#L36-L40
5ac78bcb48c386d85c26b9673f58a635d7699306
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/Base64Utils.ets
arkts
decodeSync
解码,通过输入参数解码后输出对应Uint8Array对象。 @param array @returns
static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array { let base64 = new util.Base64Helper(); let result = base64.decodeSync(array, options); return result; }
AST#method_declaration#Left static decodeSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right...
static decodeSync(array: Uint8Array | string, options?: util.Type): Uint8Array { let base64 = new util.Base64Helper(); let result = base64.decodeSync(array, options); return result; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L39-L43
a07cda7b850e7856c15d00f5c9c92d7adb3f9637
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
receiveMessage
对接收的消息处理 @param data
receiveMessage(data: string): void { Logger.info(TAG, 'receiveMessage begin data ' + JSON.stringify(data)); if (data.split('&')[0] && data.split('&')[0] === 'invitationNumber') { AppStorage.setOrCreate('invitationNumber', data.split('&')[1]); return; } if (data == 'ok') { // router.cl...
AST#method_declaration#Left receiveMessage AST#parameter_list#Left ( AST#parameter#Left data : 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 void AST#primary_type#Righ...
receiveMessage(data: string): void { Logger.info(TAG, 'receiveMessage begin data ' + JSON.stringify(data)); if (data.split('&')[0] && data.split('&')[0] === 'invitationNumber') { AppStorage.setOrCreate('invitationNumber', data.split('&')[1]); return; } if (data == 'ok') { this....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets#L136-L174
dec3ed0c3f04a7e3c829a272e36a0cb31bdcdc3e
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/AddBill.ets
arkts
saveBill
保存账单
async saveBill() { if (!this.amount || parseFloat(this.amount) <= 0) { promptAction.showToast({ message: '请输入有效金额', duration: 2000 }); return; } if (!this.selectedCategory) { promptAction.showToast({ message: '请选择分类', duration: 2000 }); re...
AST#method_declaration#Left async saveBill 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#call_expression#Left AST#expression#Left AST#binary_expression#Left AST#expressi...
async saveBill() { if (!this.amount || parseFloat(this.amount) <= 0) { promptAction.showToast({ message: '请输入有效金额', duration: 2000 }); return; } if (!this.selectedCategory) { promptAction.showToast({ message: '请选择分类', duration: 2000 }); re...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AddBill.ets#L353-L410
eb8985e0fea16d2a0c7bae27c6e2e8c147e9425e
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/utils/Logger.ets
arkts
warn
输出警告日志 @param message 日志信息
public static warn(message: string): void { console.warn(`[${Logger.TAG}] ${message}`); }
AST#method_declaration#Left public static warn AST#parameter_list#Left ( AST#parameter#Left message : 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 void AST#primary_ty...
public static warn(message: string): void { console.warn(`[${Logger.TAG}] ${message}`); }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/utils/Logger.ets#L19-L21
4c5304a90eb5bf3e1d691bb0bf3991ba1b418876
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets
arkts
CartItem
购物车商品项
@Builder CartItem(cart: Cart) { Column({ space: AppDimensions.spaceSmall }) { ForEach(cart.spec, (spec: CartSpec) => { Row({ space: AppDimensions.spaceMedium }) { // 选择框 Checkbox() .select(this.isSpecSelected(cart.goodsId, spec.id)) .onChange((value: boole...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right CartItem AST#parameter_list#Left ( AST#parameter#Left cart : AST#type_annotation#Left AST#primary_type#Left Cart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { A...
@Builder CartItem(cart: Cart) { Column({ space: AppDimensions.spaceSmall }) { ForEach(cart.spec, (spec: CartSpec) => { Row({ space: AppDimensions.spaceMedium }) { Checkbox() .select(this.isSpecSelected(cart.goodsId, spec.id)) .onChange((value: boolean) =>...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L105-L195
05ec14278f7e97a18558a34fe8531b0cda228375
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
updateCartSpecCount
更新购物车中商品的规格数量 @param {number} goodsId 商品ID @param {number} specId 规格ID @param {number} count 规格数量 @returns {Promise<void>} Promise<void>
updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void> { return this.dataSource.updateCartSpecCount(goodsId, specId, count); }
AST#method_declaration#Left updateCartSpecCount AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
updateCartSpecCount(goodsId: number, specId: number, count: number): Promise<void> { return this.dataSource.updateCartSpecCount(goodsId, specId, count); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L47-L49
62afea24c7d348498988f615f24420d7c105ac10
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
@file 订单详情页面 ViewModel @author Joker.X
@ObservedV2 export default class OrderDetailViewModel extends BaseNetWorkViewModel<Order> { /** * 订单仓库 */ private readonly repository: OrderRepository = new OrderRepository(); /** * 公共仓库 */ private readonly commonRepository: CommonRepository = new CommonRepository(); /** * 路由参数 */ private ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class OrderDetailViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_...
@ObservedV2 export default class OrderDetailViewModel extends BaseNetWorkViewModel<Order> { private readonly repository: OrderRepository = new OrderRepository(); private readonly commonRepository: CommonRepository = new CommonRepository(); private readonly routeParam: OrderIdParam | undefined = getRouteP...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets#L22-L356
392cba86dc773f45f079e8f9b1f9d29a8ca3644e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/SimpleAIService.ets
arkts
callRealStreamAPI
调用真实AI API(流式输出)
private async callRealStreamAPI( prompt: string, streamMode: StreamMode, onStreamUpdate: (state: StreamState) => void ): Promise<string> { if (!this.currentConfig) { throw new Error('AI配置未找到'); } const configModel = this.currentConfig.model; hilog.info(LogConstants.DOMAIN_APP, LogCo...
AST#method_declaration#Left private async callRealStreamAPI AST#parameter_list#Left ( AST#parameter#Left prompt : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left streamMode : AST#type_annotation#Left AST#primary_type#Left St...
private async callRealStreamAPI( prompt: string, streamMode: StreamMode, onStreamUpdate: (state: StreamState) => void ): Promise<string> { if (!this.currentConfig) { throw new Error('AI配置未找到'); } const configModel = this.currentConfig.model; hilog.info(LogConstants.DOMAIN_APP, LogCo...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L318-L347
8b3de8b6c4225dc7d0408bd233dab7adad422c87
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
needsUpgrade
检查设置是否需要升级 @returns 是否需要升级
async needsUpgrade(): Promise<boolean> { try { const settings = await this.getSettings(); return settings.version !== BusinessConstants.SETTINGS_VERSION; } catch (error) { return true; // 如果无法读取版本,认为需要升级 } }
AST#method_declaration#Left async needsUpgrade 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 boolean AST#primary_type#Right AST#type_annotation#Right > AST#type_...
async needsUpgrade(): Promise<boolean> { try { const settings = await this.getSettings(); return settings.version !== BusinessConstants.SETTINGS_VERSION; } catch (error) { return true; } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L434-L441
a5027577f3c06a6b3147c15cb6013a792c07c103
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets
arkts
animateFunc
设置卡片组件点击图片后的动画 duration: 动画时长 curve: 动画曲线,默认Friction(阻尼曲线)
animateFunc() { animateTo({ duration: Constants.DURATION, curve: Constants.DEFAULT_ANIMATION_CURVE }, () => { this.isPhotoShow = !this.isPhotoShow; }) }
AST#method_declaration#Left animateFunc 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 animateTo ( AST#ERROR#Left AST#component_parameters#Left { AST#component_parameter#Left duration : AST#expressi...
animateFunc() { animateTo({ duration: Constants.DURATION, curve: Constants.DEFAULT_ANIMATION_CURVE }, () => { this.isPhotoShow = !this.isPhotoShow; }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cardswiperanimation/src/main/ets/utils/CardComponent.ets#L168-L175
99da73be91bbc597f449d3812d5e4603a1cdff4c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderRefundPage.ets
arkts
PriceValue
退款金额值 @param {number} price - 金额 @returns {void} 无返回值
@Builder private PriceValue(price: number): void { IBestPrice({ value: price, integerFontSize: 14, decimalFontSize: 12, symbolFontSize: 12 }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PriceValue AST#parameter_list#Left ( AST#parameter#Left price : 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...
@Builder private PriceValue(price: number): void { IBestPrice({ value: price, integerFontSize: 14, decimalFontSize: 12, symbolFontSize: 12 }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L172-L180
1915c66effc159a3ed9676b2d376a3574247fccb
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
disableGridDashedLine
Disables the grid line to be drawn in dashed mode.
public disableGridDashedLine(): void { this.mGridDashPathEffect = null; }
AST#method_declaration#Left public disableGridDashedLine 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_expressio...
public disableGridDashedLine(): void { this.mGridDashPathEffect = null; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L604-L606
9d0fef99fb75f15acf764ab4beeb4fb41a31eba2
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileSizeUtils.ets
arkts
formatBytes
格式化文件大小(带单位) @param bytes - 字节数 @param decimalPlaces - 小数位数 (默认1位) @returns 格式化的字符串
static formatBytes(bytes: number, decimalPlaces: number = 1): string { if (bytes === 0) return '0B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + sizes[i]; }
AST#method_declaration#Left static formatBytes AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left decimalPlaces : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
static formatBytes(bytes: number, decimalPlaces: number = 1): string { if (bytes === 0) return '0B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return parseFloat((bytes / Math.pow(k, i)).toFixed(decimalPlaces)) + sizes[i]; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileSizeUtils.ets#L12-L20
4e345f121f15f8102875dbbf16b50915d6749b1e
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
setUseAutoScaleMinRestriction
Sets autoscale restriction for axis min value as enabled/disabled @Deprecated
public setUseAutoScaleMinRestriction(isEnabled: boolean): void { this.mUseAutoScaleRestrictionMin = isEnabled; }
AST#method_declaration#Left public setUseAutoScaleMinRestriction AST#parameter_list#Left ( AST#parameter#Left isEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
public setUseAutoScaleMinRestriction(isEnabled: boolean): void { this.mUseAutoScaleRestrictionMin = isEnabled; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L410-L412
8ae1e5afed83e0ce555333be4514e123aecfcca4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets
arkts
SwiperSection
功能描述: 1. isLoop为true,轮播图自动切换,向左或者向右滑动,轮播图可以切换。 2. 点击轮播图图片,开发者可以根据自己的需求执行对应的功能效果,比如点击跳转到指定页面。 实现原理: 1. 通过stack组件堆叠图片,实现多层级效果,配合手势滑动和显式动画实现切换的动画效果。同时通过改变数据中间值currentIndex来改变组件zIndex层级和高度来实现切换的效果 @param swiperListView - 轮播模块列表 @param currentIndex - 双向数据绑定当前索引 @param swiperAnimationDuration - 轮播切换动画时间 @param swiperSwitch...
@Component export struct SwiperSection { // -------------------对外暴露变量----------------------- // 轮播模块列表 swiperListView: SwiperItemViewType[] = []; // 双向数据绑定当前索引 @Link currentIndex: number; // 轮播切换动画时间 swiperAnimationDuration: number = CommonConstants.SWIPER_ANIMATION_DURATION; // 轮播每5s切换一次 swiperSwitch...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SwiperSection AST#component_body#Left { // -------------------对外暴露变量----------------------- // 轮播模块列表 AST#property_declaration#Left swiperListView : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left S...
@Component export struct SwiperSection { swiperListView: SwiperItemViewType[] = []; @Link currentIndex: number; swiperAnimationDuration: number = CommonConstants.SWIPER_ANIMATION_DURATION; swiperSwitchDuration: number = CommonConstants.SWIPER_SWITCH_DURATION; isLoop: boolean = true; @Bu...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/utils/SwiperSection.ets#L37-L193
7ea93d457e1c785f4e395eaf2091ccb9eb9d0c37
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/SysUtil.ets
arkts
getNumber
获取指定资源对应的integer数值或者float数值 @param res @returns
static getNumber(res: Resource): number { return SysUtil.getResourceManager().getNumber(res); }
AST#method_declaration#Left static getNumber AST#parameter_list#Left ( AST#parameter#Left res : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
static getNumber(res: Resource): number { return SysUtil.getResourceManager().getNumber(res); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L27-L29
c07007cc20fb40b15b7f4c7c6aef127ae976df47
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/JListInterface.ets
arkts
Copyright (C) 2022 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 default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/JListInterface.ets#L16-L16
80d47f01f3137d025aa3c66d0717d53605f8e618
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
initDialogButton
多个按钮,初始化参数 @param options
private static initDialogButton(options: OptionDialogOptions) { if (!options.buttons) { options.buttons = [DialogUtil.defaultConfig.primaryButton, DialogUtil.defaultConfig.secondaryButton] } if (options.buttons && options.buttons.length > 0) { let buttons = new Array<ButtonOptions>(); for ...
AST#method_declaration#Left private static initDialogButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left OptionDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#L...
private static initDialogButton(options: OptionDialogOptions) { if (!options.buttons) { options.buttons = [DialogUtil.defaultConfig.primaryButton, DialogUtil.defaultConfig.secondaryButton] } if (options.buttons && options.buttons.length > 0) { let buttons = new Array<ButtonOptions>(); for ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L363-L396
b6170e1e08f946874e8ca16a6bc76c34619a733c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SHA.ets
arkts
digestSegmentSync
SHA摘要,分段,同步 @param data 待摘要的数据 @param algName 摘要算法名(SHA1、SHA224、SHA256、SHA384、SHA512)。 @param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。 @param len 自定义的数据拆分长度 @returns
static digestSegmentSync(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex', len: number = 120): string { return CryptoUtil.digestSegmentSync(data, algName, resultCoding, len); }
AST#method_declaration#Left static digestSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left AST#qualified_...
static digestSegmentSync(data: string, algName: crypto.SHA = 'SHA256', resultCoding: crypto.BhCoding = 'hex', len: number = 120): string { return CryptoUtil.digestSegmentSync(data, algName, resultCoding, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SHA.ets#L76-L79
b415bd070b08f406db6774e8fc597c34da9f00d7
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringCrypto.ets
arkts
sha1
计算字符串的 SHA1 哈希值 @param input 输入字符串 @returns 十六进制格式的哈希值
static async sha1(input: string): Promise<string> { return StringCrypto._computeHash(input, 'SHA1'); }
AST#method_declaration#Left static async sha1 AST#parameter_list#Left ( AST#parameter#Left input : 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 ...
static async sha1(input: string): Promise<string> { return StringCrypto._computeHash(input, 'SHA1'); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringCrypto.ets#L18-L20
1dde11198c869c733738d767d36c2a97054ed0b2
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/SearchHistoryRepository.ets
arkts
getRecentSearchHistory
获取指定数量的最新搜索历史记录 @param {number} limit 限制数量 @returns {Promise<SearchHistory[]>} 搜索历史列表
getRecentSearchHistory(limit: number): Promise<SearchHistory[]> { return this.dataSource.getRecentSearchHistory(limit); }
AST#method_declaration#Left getRecentSearchHistory AST#parameter_list#Left ( AST#parameter#Left limit : 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#generic_type#...
getRecentSearchHistory(limit: number): Promise<SearchHistory[]> { return this.dataSource.getRecentSearchHistory(limit); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L79-L81
944e2cad3270916365376b0543af3d92b6c3aa05
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fadingedge/src/main/ets/common/Constants.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 default class Const { // 示例图片间距 public static readonly EXAMPLE_IMAGE_GAP: number = 10; // 示例图片数量 public static readonly ITEM_COUNT: number = 6; // 动画时长 public static readonly DURATION: number = 220; // 边缘渐变起始和终止颜色 public static readonly BEGIN_COLOR: string = '#00ffffff'; public static readonly ...
AST#export_declaration#Left export default AST#class_declaration#Left class Const AST#class_body#Left { // 示例图片间距 AST#property_declaration#Left public static readonly EXAMPLE_IMAGE_GAP : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#e...
export default class Const { public static readonly EXAMPLE_IMAGE_GAP: number = 10; public static readonly ITEM_COUNT: number = 6; public static readonly DURATION: number = 220; public static readonly BEGIN_COLOR: string = '#00ffffff'; public static readonly END_COLOR: string = '#ffffffff'; p...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fadingedge/src/main/ets/common/Constants.ets#L16-L38
515149764bbc9188c69793b09eb18c23cc40dbd5
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
getLunarCalendarMonth
获取农历月历 @param year 农历年份 @param month 农历月份 @param isLeapMonth 是否闰月 @returns 农历月历信息
async getLunarCalendarMonth(year: number, month: number, isLeapMonth: boolean = false): Promise<LunarCalendarMonth | null> { try { const monthDays = LunarUtils.getLunarMonthDays(year, month, isLeapMonth); const monthName = LunarUtils.getMonthName(month, isLeapMonth); const days: LunarCalendarDay[]...
AST#method_declaration#Left async getLunarCalendarMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
async getLunarCalendarMonth(year: number, month: number, isLeapMonth: boolean = false): Promise<LunarCalendarMonth | null> { try { const monthDays = LunarUtils.getLunarMonthDays(year, month, isLeapMonth); const monthName = LunarUtils.getMonthName(month, isLeapMonth); const days: LunarCalendarDay[]...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L341-L385
7b62e611ebcf3ed9636661fefad2d59676e37bed
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkcompiler/esmodule/esmodule_dynamicimport/entry/src/main/ets/pages/Index.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 async function varibleWithinHap( ): Promise<boolean> { let filePath = '../Calc'; let lib: ESObject = await import(filePath); let res: boolean = false; if (lib.add(3, 5) == 8) { res = true; } return res; }
AST#export_declaration#Left export AST#function_declaration#Left async function varibleWithinHap 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 boolean AST#primar...
export async function varibleWithinHap( ): Promise<boolean> { let filePath = '../Calc'; let lib: ESObject = await import(filePath); let res: boolean = false; if (lib.add(3, 5) == 8) { res = true; } return res; }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/entry/src/main/ets/pages/Index.ets#L16-L24
abffe3c36d3ece63d8ff2bd61fab24221ac9d8a2
gitee
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/common/util/Logger.ets
arkts
error
记录错误级别的日志。 @param args 要记录的日志信息
error(...args: string[]): void { hilog.error(this.domain, this.prefix, this.format, args); }
AST#method_declaration#Left error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
error(...args: string[]): void { hilog.error(this.domain, this.prefix, this.format, args); }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/common/util/Logger.ets#L51-L53
8a479f02bfc06b3e5fda3a659231b1bddfb910a3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/utils/utils.ets
arkts
临界值 时间处理函数 @param time @returns
export function handleTime(time: number): string { const minInt: number = Math.floor(time / TIME_ONE); const minString: string = minInt > 0 ? (minInt > TIME_THREE ? minInt.toString() : `0${minInt}`) : '00'; const secondsInt: number = Math.floor((time - minInt * TIME_ONE) / TIME_TWO); const secondsString: string...
AST#export_declaration#Left export AST#function_declaration#Left function handleTime AST#parameter_list#Left ( AST#parameter#Left time : 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#pr...
export function handleTime(time: number): string { const minInt: number = Math.floor(time / TIME_ONE); const minString: string = minInt > 0 ? (minInt > TIME_THREE ? minInt.toString() : `0${minInt}`) : '00'; const secondsInt: number = Math.floor((time - minInt * TIME_ONE) / TIME_TWO); const secondsString: string...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/utils/utils.ets#L25-L31
9d1c44387125a4f474019c1c5838351a867c0e93
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
arkts
initSelect
选择类弹出框,参数 @param options
static initSelect(options: SelectOptions) { if (options.radioContent && options.radioContent.length > 0) { CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, ""); if (Helper.isResourceStr(options.radioContent[0])) { let sheetInfos = new Array<SheetInfo>() for (let ind...
AST#method_declaration#Left static initSelect AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left SelectOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#...
static initSelect(options: SelectOptions) { if (options.radioContent && options.radioContent.length > 0) { CacheHelper.put(`${CacheHelper.CACHE_LABEL}${options.dialogId ?? ""}`, ""); if (Helper.isResourceStr(options.radioContent[0])) { let sheetInfos = new Array<SheetInfo>() for (let ind...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L425-L494
10042e61ca6ceef98ea226394177b2bf7e6b6978
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets
arkts
regAVPlayerCallback
注册avplayer回调函数 @param avPlayer AVPlayer实例 @param timeUpdateCb 歌曲时间更新回调 @param stateUpdateCb avplayer状态更新回调 @param completeCb avplayer单曲完成回调 @returns {void}
private regAVPlayerCallback(avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): void { // seek操作结果回调函数 avPlayer.on('seekDone', (seekDoneTime: number) => { logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) // error回调监听函数,当avPlaye...
AST#method_declaration#Left private regAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeU...
private regAVPlayerCallback(avPlayer: media.AVPlayer, timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): void { avPlayer.on('seekDone', (seekDoneTime: number) => { logger.debug(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) avPlayer.on('error', (err: Busine...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets#L83-L105
d80e0fdaf6254ddce9cc72fd5b5c55e2e541fee6
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets
arkts
chat
对话
async chat() { let cfg: rcp.SessionConfiguration = { headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' } } let chatInfo = this.getChatInfo() let postInfo = JSON.stringify(chatInfo) const session = rcp.createSession(cfg); session....
AST#method_declaration#Left async chat AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left cfg : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rcp . SessionConfiguration AST#qualified_t...
async chat() { let cfg: rcp.SessionConfiguration = { headers: { 'Authorization': `Bearer ${this.apiKey}`, 'Content-Type': 'application/json' } } let chatInfo = this.getChatInfo() let postInfo = JSON.stringify(chatInfo) const session = rcp.createSession(cfg); session....
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/OpenAIWithRCP/entry/src/main/ets/pages/Index.ets#L129-L153
be677daffead6f9b6333383a2d1d687bd2610cb4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
getAvailableSharePlatforms
获取可用的分享平台
async getAvailableSharePlatforms(): Promise<SharePlatform[]> { const availablePlatforms: SharePlatform[] = []; try { // 检查系统分享能力 availablePlatforms.push(SharePlatform.SYSTEM); availablePlatforms.push(SharePlatform.SMS); availablePlatforms.push(SharePlatform.EMAIL); // 检查第三方应用...
AST#method_declaration#Left async getAvailableSharePlatforms 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 AST#array_type#Left SharePlatform [ ] AST#array_type#R...
async getAvailableSharePlatforms(): Promise<SharePlatform[]> { const availablePlatforms: SharePlatform[] = []; try { availablePlatforms.push(SharePlatform.SYSTEM); availablePlatforms.push(SharePlatform.SMS); availablePlatforms.push(SharePlatform.EMAIL); const installe...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L258-L296
2012dfb5f15b3e155803491abccf364093a0beb4
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/LoginSample/entry/src/main/ets/view/CustomerListComponent.ets
arkts
CustomerListComponent
Customer service page component.
@Component export struct CustomerListComponent { build() { Column() { List() { ForEach(LoginPageViewModel.getContactListItems(), (contactItemInfo: ListItemData) => { ListItem() { Row() { Text(contactItemInfo.title) .fontSize($r('app.float.name_text...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomerListComponent 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 Column ( ) AST#container_content...
@Component export struct CustomerListComponent { build() { Column() { List() { ForEach(LoginPageViewModel.getContactListItems(), (contactItemInfo: ListItemData) => { ListItem() { Row() { Text(contactItemInfo.title) .fontSize($r('app.float.name_text...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/LoginSample/entry/src/main/ets/view/CustomerListComponent.ets#L8-L45
f91a55b178a7b853fafcd19bdd7bd8f7708e1d3c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
avscreen-capture-screen-record-master/entry/src/main/ets/common/utils/TimeUtils.ets
arkts
Time handling function. @param time @returns
export function formatVideoTime(totalSeconds: number): string { const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor((totalSeconds % 3600) / 60); const seconds = totalSeconds % 60; return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padS...
AST#export_declaration#Left export AST#function_declaration#Left function formatVideoTime AST#parameter_list#Left ( AST#parameter#Left totalSeconds : 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_annotatio...
export function formatVideoTime(totalSeconds: number): string { const hours = Math.floor(totalSeconds / 3600); const minutes = Math.floor((totalSeconds % 3600) / 60); const seconds = totalSeconds % 60; return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padS...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/common/utils/TimeUtils.ets#L20-L26
35427b45ef7a4bdc6165c72491405b61d1b80660
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/viewmodels/ReviewViewModel.ets
arkts
getOnTimeCount
获取准时完成的任务数量
static getOnTimeCount(completedTasks: TaskItem[]): number { return completedTasks.filter(t => { if (!t.actualTime) return false; const ratio = t.estimatedTime / t.actualTime; return ratio >= 0.9 && ratio <= 1.1; }).length; }
AST#method_declaration#Left static getOnTimeCount AST#parameter_list#Left ( AST#parameter#Left completedTasks : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left TaskItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_...
static getOnTimeCount(completedTasks: TaskItem[]): number { return completedTasks.filter(t => { if (!t.actualTime) return false; const ratio = t.estimatedTime / t.actualTime; return ratio >= 0.9 && ratio <= 1.1; }).length; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L121-L127
790ddeea1dd46165b05a29b500ef37c638bf55e5
github
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/model.ets
arkts
loadTodos
从 Preferences 中加载所有待办事项到 ToDoData 数组
async loadTodos() { try { const todosStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString(); this.ToDoData = JSON.parse(todosStr); Logger.info(CommonConstants.TAG, `Loaded ${this.ToDoData.length} todos.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to load...
AST#method_declaration#Left async loadTodos AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left todosStr = AST#expression#Left AST#call...
async loadTodos() { try { const todosStr = (await preference.get(CommonConstants.KEY_NAME, '[]')).toString(); this.ToDoData = JSON.parse(todosStr); Logger.info(CommonConstants.TAG, `Loaded ${this.ToDoData.length} todos.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to load...
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/model.ets#L29-L38
ada2096b9b8a2b70e0a586bef12b0df481910b34
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
申请通知权限,统一处理权限申请流程 @param callback 权限申请结果回调
export async function requestPermission(callback: (granted: boolean) => void): Promise<void> { if (isEnabled()) { callback(true); } else { requestEnable().then(() => callback(true)).catch(() => callback(false)); } }
AST#export_declaration#Left export AST#function_declaration#Left async function requestPermission AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left granted : AST#type_annotation#Left AST#primary_type#Left boolean AST#prim...
export async function requestPermission(callback: (granted: boolean) => void): Promise<void> { if (isEnabled()) { callback(true); } else { requestEnable().then(() => callback(true)).catch(() => callback(false)); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L47-L53
bc2ff662a3fb5d4e62ced7ee6043bb0deaeac4b6
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Column.ets
arkts
ColumnSpaceBetweenStart
纵向两端分布 + 水平起始
@ComponentV2 export struct ColumnSpaceBetweenStart { /** * Column 构造参数 */ @Param options: ColumnOptions | ColumnOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColumnSpaceBetweenStart AST#component_body#Left { /** * Column 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#pr...
@ComponentV2 export struct ColumnSpaceBetweenStart { @Param options: ColumnOptions | ColumnOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue:...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L945-L1020
cdc26b42fb86d08a9d23e00c3d16d92e5d8a0c90
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/MeViewModel.ets
arkts
aboutToAppear
页面出现前 @returns {void} 无返回值
aboutToAppear(): void { this.userState.refreshUserInfo(); }
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#call_expression#Left AST#expression...
aboutToAppear(): void { this.userState.refreshUserInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MeViewModel.ets#L98-L100
0df5da3706c463bc2e90359bc5775faa7fd1cffa
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
发布带有图片的通知 @param {NotificationPictureOptions} options 通知消息配置项 @returns {Promise<number>} number 返回通知ID
export async function sendPicture(options: NotificationPictureOptions): Promise<number> { const notificationId: number = Date.now(); // 通知ID基于时间戳生成,确保唯一性 const pictureContent: notificationManager.NotificationPictureContent = { title: options.mainTitle, text: options.mainContent, brie...
AST#export_declaration#Left export AST#function_declaration#Left async function sendPicture AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationPictureOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A...
export async function sendPicture(options: NotificationPictureOptions): Promise<number> { const notificationId: number = Date.now(); const pictureContent: notificationManager.NotificationPictureContent = { title: options.mainTitle, text: options.mainContent, briefText: options.summa...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L120-L142
e0569a5f747561a81e03ead09c09171c0d63c79c
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
arkts
键盘类型枚举
export enum EKeyboardType { NUMERIC, //数字键盘 UPPERCASE, // 大写字母键盘 LOWERCASE, // 小写字母键盘 SPECIAL, // 特殊字符键盘 }
AST#export_declaration#Left export AST#enum_declaration#Left enum EKeyboardType AST#enum_body#Left { AST#enum_member#Left NUMERIC AST#enum_member#Right , //数字键盘 AST#enum_member#Left UPPERCASE AST#enum_member#Right , // 大写字母键盘 AST#enum_member#Left LOWERCASE AST#enum_member#Right , // 小写字母键盘 AST#enum_member#Left SPECIAL ...
export enum EKeyboardType { NUMERIC, UPPERCASE, LOWERCASE, SPECIAL, }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L19-L24
2cd595053e96f08c44822c2d32ba768580a5d256
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
clear
@deprecated @see {ZRouter.getInstance().clear}
public static clear() { ZRouter.getRouterMgr().clear() }
AST#method_declaration#Left public static clear 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 AST#call_expression#Left AST#expression#Left...
public static clear() { ZRouter.getRouterMgr().clear() }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L496-L498
4cd3a24ffa368a50dc17957f891e7dfa98fbf7c4
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/PreviewUtil.ets
arkts
previewImage
预览图片 @param uri 预览uri
static async previewImage(uri: string): Promise<void> { await PreviewUtil.openPreview('image', uri); }
AST#method_declaration#Left static async previewImage AST#parameter_list#Left ( AST#parameter#Left uri : 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...
static async previewImage(uri: string): Promise<void> { await PreviewUtil.openPreview('image', uri); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L51-L53
0e70c136cda10e23c525de91e0fac8f37c451267
gitee
changweizhang/ChatUI
36df7ce41aeb281d8472ca9182f449da6dc109f7
chatui/src/main/ets/components/ChatDataSource.ets
arkts
notifyDataDelete
通知LazyForEach组件需要在index对应索引处删除该子组件
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
AST#method_declaration#Left notifyDataDelete 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 void AST#primary_type#R...
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://github.com/changweizhang/ChatUI/blob/36df7ce41aeb281d8472ca9182f449da6dc109f7/chatui/src/main/ets/components/ChatDataSource.ets#L75-L79
065738c3db5f8e201a09595196ccb961690f9030
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/Pointer.ets
arkts
clear
Clears this map and resets all pointers.
clear(): void { for (let pointer of this.pointers) { pointer.reset(); } }
AST#method_declaration#Left clear 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#for_statement#Left for ( let pointer of AST#expression#Left AST#member_expressio...
clear(): void { for (let pointer of this.pointers) { pointer.reset(); } }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/Pointer.ets#L51-L55
25fccba5713c777dee24ea08f1fcf0d5737d65fa
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets
arkts
若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在所有controller的后面
build() { Column() { Text('CustomDialog').fontSize(20).margin({ top: 10, bottom: 10 }) TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%') .onChange((value: string) => { this.textValue = value }) Text('Whether to change a text?').fontSize(16).marg...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left 'CustomDialog' AST#expressio...
build() { Column() { Text('CustomDialog').fontSize(20).margin({ top: 10, bottom: 10 }) TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%') .onChange((value: string) => { this.textValue = value }) Text('Whether to change a text?').fontSize(16).marg...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/common/CustomDialogController.ets#L324-L348
79d79879f9df98d0765bc3685f46f87fad948f3c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseDataSet.ets
arkts
setColorsByArrAndAlpha
Sets colors with a specific alpha value. @param colors @param alpha
public setColorsByArrAndAlpha(colors: number[], alpha: number): void { this.resetColors(); for (let color of colors) { this.addColor(ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color))); } }
AST#method_declaration#Left public setColorsByArrAndAlpha AST#parameter_list#Left ( AST#parameter#Left colors : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : AST#type_an...
public setColorsByArrAndAlpha(colors: number[], alpha: number): void { this.resetColors(); for (let color of colors) { this.addColor(ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color))); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L225-L230
f140fb0e6f3debbdcbac8e14aa2e9d5a16830552
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/dialog/DialogHelper.ets
arkts
getMainUIContext
获取MainWindow的UIContext @returns
static getMainUIContext(): UIContext | undefined { if (DialogHelper.mainUIContext) { return DialogHelper.mainUIContext; } const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext(); if (uiContext) { DialogHelper.mainUIContext = uiContext; } re...
AST#method_declaration#Left static getMainUIContext AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left UIContext AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block...
static getMainUIContext(): UIContext | undefined { if (DialogHelper.mainUIContext) { return DialogHelper.mainUIContext; } const uiContext = DialogHelper.getUIAbilityContext().windowStage.getMainWindowSync().getUIContext(); if (uiContext) { DialogHelper.mainUIContext = uiContext; } re...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-dialog@1.1.7/oh_modules/@pura/harmony-dialog/src/main/ets/dialog/DialogHelper.ets#L90-L99
2b30f6124535a3b9d043cdbcd33164c91cfd0e6b
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
ToolBarOption
Declare type ToolBarOption @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare type ToolBarOption @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
@Observed export declare class ToolBarOption { /** * Define text content. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Define text content. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice *...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class ToolBarOption AST#class_body#Left { /** * Define text content. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Def...
@Observed export declare class ToolBarOption { content: ResourceStr; action?: () => void; icon?: Resource; state?: ItemState; textColor?: ResourceColor; activatedTextColor?: ResourceColor; iconColor?: ResourceColor; activatedIco...
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L111-L210
909753cbb72dd6eba5c1e346bc09e78366449327
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets
arkts
getSearchHistoryCount
获取搜索历史记录数量 @returns {Promise<number>} 搜索历史数量
async getSearchHistoryCount(): Promise<number> { return this.orm.query(SearchHistoryEntity).find().length; }
AST#method_declaration#Left async getSearchHistoryCount 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 number AST#primary_type#Right AST#type_annotation#Right > A...
async getSearchHistoryCount(): Promise<number> { return this.orm.query(SearchHistoryEntity).find().length; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/database/src/main/ets/datasource/searchhistory/SearchHistoryLocalDataSourceImpl.ets#L80-L82
4c53eb79c84e7d40ad22114251178bbbe6f79e66
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/navigation/src/main/ets/user/UserParam.ets
arkts
收货地址详情参数
export interface UserAddressDetailParam { /** * 是否为编辑模式 */ isEditMode?: boolean; /** * 地址 ID(0表示新增) */ addressId?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserAddressDetailParam AST#object_type#Left { /** * 是否为编辑模式 */ AST#type_member#Left isEditMode ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 地址...
export interface UserAddressDetailParam { isEditMode?: boolean; addressId?: number; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/user/UserParam.ets#L19-L28
4a5174c57cd564ee170d9cc17b5e1cfed887a673
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/constraint.ets
arkts
KeyboardUtil回调
export declare type KeyboardCallBack = (show: boolean, height: number) => void;
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type KeyboardCallBack = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left show : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotatio...
export declare type KeyboardCallBack = (show: boolean, height: number) => void;
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L53-L53
cab0095d3b09f79eceef3ac2cc497893d89a6fcb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModuleOptimize.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 let dataOptimize2 = 'data from side effect module';
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left dataOptimize2 = AST#expression#Left 'data from side effect module' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export let dataOptimize2 = 'data from side effect module';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/sideEffectModuleOptimize.ets#L16-L16
a22b222a2309ea156020c60a2e52a5587a7105bf
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ComposeTitleBar.d.ets
arkts
Declaration of the menu item on the right side. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declaration of the menu item on the right side. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declaration of the menu item on the right side. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatf...
export declare class ComposeTitleBarMenuItem { /** * Icon resource for this menu item. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Icon resource for this menu item. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomic...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class ComposeTitleBarMenuItem AST#class_body#Left { /** * Icon resource for this menu item. * @type { ResourceStr }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Icon resource for t...
export declare class ComposeTitleBarMenuItem { value: ResourceStr; symbolStyle?: SymbolGlyphModifier; label?: ResourceStr; isEnabled?: boolean; action?: () => void; accessibilityText?: ResourceStr; accessibilityDescription?: ResourceStr; ac...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets#L43-L209
ca21ffe22fbfe7f01a1c6c4522eaae8fbc89c946
gitee
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/FlowLocale.ets
arkts
from
Constructs a new FlorisLocale with given language, country, and variant. @param language A two-letter language code. @param country A two-letter country code. @param variant A two-letter variant code. @return A new FlorisLocale.
public static from(language: string, country: string, variant: string): FlorisLocale { return FlorisLocale.from(new Locale(language, country, variant)); }
AST#method_declaration#Left public static from AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
public static from(language: string, country: string, variant: string): FlorisLocale { return FlorisLocale.from(new Locale(language, country, variant)); }
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L67-L69
3d64c4301c5bc4857dcde92a8b01b29202491efb
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
fireServicesChanged
触发多个服务的属性变化,SDK自动上报变化的属性到平台 @param serviceIds 发生变化的服务id列表
public fireServicesChanged(serviceIds: string[]): void { const serviceProperties: ServiceProperty[] = []; serviceIds.forEach(serviceId => { const deviceService = this.getService(serviceId); if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) { LogUt...
AST#method_declaration#Left public fireServicesChanged AST#parameter_list#Left ( AST#parameter#Left serviceIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_a...
public fireServicesChanged(serviceIds: string[]): void { const serviceProperties: ServiceProperty[] = []; serviceIds.forEach(serviceId => { const deviceService = this.getService(serviceId); if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) { LogUt...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L251-L277
731d6668e30b67e426a7d3a103e83106b94ac685
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/animation/AnimBlink.ets
arkts
执行闪烁动画(类似 SwiftUI 中 blink 效果)
export function blink(options: BlinkOptions): void { const times = options.times ?? 3 const duration = options.duration ?? 300 const set = options.set let count = 0 let visible = true /** * 执行一步闪烁 */ const blinkStep = () => { if (count >= times * 2) { // 所有闪烁完成,恢复为可见 ...
AST#export_declaration#Left export AST#function_declaration#Left function blink AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BlinkOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AS...
export function blink(options: BlinkOptions): void { const times = options.times ?? 3 const duration = options.duration ?? 300 const set = options.set let count = 0 let visible = true const blinkStep = () => { if (count >= times * 2) { set(1) options.onFinishe...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/animation/AnimBlink.ets#L14-L48
9107ee63da2d8fe01cf3f35b146abc0a7aa5452b
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
BaseViewModel
@file 通用基础视图模型,提供生命周期钩子 @author Joker.X
@ObservedV2 export class BaseViewModel { /** * 页面出现前(组件创建后、build 前) * @returns {void} 无返回值 */ aboutToAppear(): void { } /** * 页面隐藏前 * @returns {void} 无返回值 */ aboutToDisappear(): void { } /** * 组件构建完成(API 12+) * @returns {void} 无返回值 */ onDidBuild(): void { } /** * 组件即...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class BaseViewModel AST#class_body#Left { /** * 页面出现前(组件创建后、build 前) * @returns {void} 无返回值 */ AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Le...
@ObservedV2 export class BaseViewModel { aboutToAppear(): void { } aboutToDisappear(): void { } onDidBuild(): void { } aboutToRecycle(): void { } onWillApplyTheme(theme: Theme): void { } aboutToBeDeleted(): void { } onShown(reason: VisibilityChangeReason): void { }...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseViewModel.ets#L5-L65
5770fba68fd05e522bee7e8d5d38b1630c31441a
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets
arkts
selectCA
选择CA证书文件
selectCA() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.caFileUri = result[0] this.msgHistory += "select file: " + this.caFileUri + "\r\n"; } }).catch((e: BusinessError) => { this.msgHistory...
AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
selectCA() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { this.caFileUri = result[0] this.msgHistory += "select file: " + this.caFileUri + "\r\n"; } }).catch((e: BusinessError) => { this.msgHistory...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets#L197-L207
4c67a4123caae88f3b01ccf469ecd9dc7e38495c
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
getTempDirPath
获取临时目录下的文件夹路径或文件路径。 @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getTempDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined, blHap: boolean = true): string { let filePath = blHap ? ArkWebHelper.getContext().tempDir : ArkWebHelper.getContext().getApplicationContext().tempDir; //根目录 if (StrUtils.isNotEmpty(dirPath)) { if (...
AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#expressi...
static getTempDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined, blHap: boolean = true): string { let filePath = blHap ? ArkWebHelper.getContext().tempDir : ArkWebHelper.getContext().getApplicationContext().tempDir; if (StrUtils.isNotEmpty(dirPath)) { if (FileU...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L96-L113
bdfb826d778053007cd679160160b816e58483be
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/checker/GeneralChecker.ets
arkts
使用系统提供的方法检测是否有权限
export class GeneralChecker implements PermissionChecker { hasPermission(permissions: Array<Permissions>): boolean { for (let i = 0; i < permissions.length; i++) { const permission = permissions[i] let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let grantStatus...
AST#export_declaration#Left export AST#class_declaration#Left class GeneralChecker AST#implements_clause#Left implements PermissionChecker AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left hasPermission AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#p...
export class GeneralChecker implements PermissionChecker { hasPermission(permissions: Array<Permissions>): boolean { for (let i = 0; i < permissions.length; i++) { const permission = permissions[i] let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let grantStatus...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/checker/GeneralChecker.ets#L8-L33
7f8d310278bfdb5db4959182df7f000d52288834
gitee
RicardoWesleyli/HarmonyNEXT_Examples.git
6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670
Chapter6/entry/src/main/ets/pages/Index.ets
arkts
todayWeatherView
今日天气代码块
@Builder todayWeatherView(){ Column({space:20}) { this.textView('香港特别行政区',32,600,Color.White) this.textView('26°C',48,600,Color.White) Row({space:10}){ this.textView('最高',23,600,Color.White) this.textView('25°C',32,600,Color.White) this.textView('最低',23,600,Color.White) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right todayWeatherView 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 Column ( AST#component_parameters#Left { AST#component_pa...
@Builder todayWeatherView(){ Column({space:20}) { this.textView('香港特别行政区',32,600,Color.White) this.textView('26°C',48,600,Color.White) Row({space:10}){ this.textView('最高',23,600,Color.White) this.textView('25°C',32,600,Color.White) this.textView('最低',23,600,Color.White) ...
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples.git/blob/6a9cc1a06e3c7b126faa61ccf1b91ac6cea47670/Chapter6/entry/src/main/ets/pages/Index.ets#L75-L90
20546f0aa19cad4603906042ba1e4aeb2ba8f746
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/web/src/main/ets/WebViewManager.ets
arkts
init
初始化 @param debug 日志显示
static init(debug: boolean = false) { Logger.init(debug) webview.WebviewController.initializeWebEngine() webview.WebviewController.setWebDebuggingAccess(debug) }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left debug : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Right ) A...
static init(debug: boolean = false) { Logger.init(debug) webview.WebviewController.initializeWebEngine() webview.WebviewController.setWebDebuggingAccess(debug) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/web/src/main/ets/WebViewManager.ets#L16-L20
af6115158fce7e8a0b6cf9936a15c03e3b050d02
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
clearContextVariables
清除上下文变量
clearContextVariables(sessionId: string, keepPersistent: boolean = true): void { try { const sessionVars = this.contextVariables.get(sessionId); if (!sessionVars) return; if (keepPersistent) { // 只删除非持久化变量 for (const [name, variable] of sessionVars.entries()) { if (!vari...
AST#method_declaration#Left clearContextVariables AST#parameter_list#Left ( AST#parameter#Left sessionId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left keepPersistent : AST#type_annotation#Left AST#primary_type#Left boole...
clearContextVariables(sessionId: string, keepPersistent: boolean = true): void { try { const sessionVars = this.contextVariables.get(sessionId); if (!sessionVars) return; if (keepPersistent) { for (const [name, variable] of sessionVars.entries()) { if (!variable.persist...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L313-L336
7f970eca0e029e2378f9355b33cf0ecd41abf543
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/components/EventsDialog.ets
arkts
EventsDialog
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...
@CustomDialog export struct EventsDialog { private customDialogController?: CustomDialogController build() { Column() { Column() { Image($r('app.media.product004')) .objectFit(ImageFit.Contain) .height(300) .aspectRatio(1.5) Column() { Text($r('app....
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct EventsDialog AST#component_body#Left { AST#property_declaration#Left private customDialogController ? : AST#type_annotation#Left AST#primary_type#Left CustomDialogController AST#primary_type#Right AST#type_annotati...
@CustomDialog export struct EventsDialog { private customDialogController?: CustomDialogController build() { Column() { Column() { Image($r('app.media.product004')) .objectFit(ImageFit.Contain) .height(300) .aspectRatio(1.5) Column() { Text($r('app....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/detailPageHsp/src/main/ets/components/EventsDialog.ets#L16-L59
528ee9dce9c4bf5d7cf00113f0307501ef5a995c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NdkDrawing/entry/src/main/ets/pages/Index.ets
arkts
draw
background image
draw(context: DrawContext): void { // Call the Native onDraw interface on the native side to draw, and pass in the background image this.pMap and the graphic drawing context as parameters testNapi.nativeOnDraw(666, context, uiContext?.vp2px(this.size.width), uiContext?.vp2px(this.size.height), this.drawTy...
AST#method_declaration#Left draw AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left DrawContext 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#Right ...
draw(context: DrawContext): void { testNapi.nativeOnDraw(666, context, uiContext?.vp2px(this.size.width), uiContext?.vp2px(this.size.height), this.drawType, this.pMap); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NdkDrawing/entry/src/main/ets/pages/Index.ets#L42-L46
dc0527b09c5aac698fbcc2858752d755fee546fa
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_002_F.ets
arkts
Introduction 库函数-string_concat
export function string_lib_func_002_F(taint_src : string) { let clean = "clean"; let t = clean.concat("_"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_002_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_stateme...
export function string_lib_func_002_F(taint_src : string) { let clean = "clean"; let t = clean.concat("_"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_002_F.ets#L7-L11
fc248ba2808e1e9f31c4fd411a165baa1ae30399
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
LoadingProgressBuilder
LoadingProgress加载进度弹窗view
@Builder export function LoadingProgressBuilder(options: ILoadingProgressOptions) { //, observedData: LoadingProgressObserved LoadingProgressView({ options: options }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoadingProgressBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ILoadingProgressOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right...
@Builder export function LoadingProgressBuilder(options: ILoadingProgressOptions) { LoadingProgressView({ options: options }); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L285-L288
a51999e7c9dada0f4988fa84316d04f9332771de
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/TaskConfig.ets
arkts
TaskConfig Builder
export class TaskConfigBuilder { public useHardwareDecoder: boolean = false; // 默认软解 public timeoutMs: number = 0; // 默认不超时 public retryCount: number = 0; // 默认不重试 public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder { this.useHardwareDecoder = useHardwa...
AST#export_declaration#Left export AST#class_declaration#Left class TaskConfigBuilder AST#class_body#Left { AST#property_declaration#Left public useHardwareDecoder : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left fal...
export class TaskConfigBuilder { public useHardwareDecoder: boolean = false; public timeoutMs: number = 0; public retryCount: number = 0; public setHardwareDecoder(useHardwareDecoder: boolean): TaskConfigBuilder { this.useHardwareDecoder = useHardwareDecoder; return t...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskConfig.ets#L51-L80
a62f7868b12f8be7347373d59d96a5e52ea34254
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AuthRepository.ets
arkts
register
用户注册 @param {Record<string, string>} params - 注册参数 @returns {Promise<NetworkResponse<Auth>>} 注册结果
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> { return this.networkDataSource.register(params); }
AST#method_declaration#Left async register AST#parameter_list#Left ( AST#parameter#Left params : 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_annotat...
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> { return this.networkDataSource.register(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AuthRepository.ets#L45-L47
4b5362423a491ee8adaa1e4bfab5e45ac8f752e3
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets
arkts
isDistributedEnabled
判断是否支持分布式通知 @returns
static isDistributedEnabled(): Promise<boolean>{ return notificationManager.isDistributedEnabled() }
AST#method_declaration#Left static isDistributedEnabled 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 boolean AST#primary_type#Right AST#type_annotation#Right > ...
static isDistributedEnabled(): Promise<boolean>{ return notificationManager.isDistributedEnabled() }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/notification/NotificationPermissionChecker.ets#L19-L21
04866580b90b7eb70405cfa0ea4965774a497f83
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
decryptSync
解密,同步 @param data 加密或者解密的数据。data不能为null。 @param priKey 指定解密私钥。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合。
static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob { return CryptoUtil.decryptSync(data, priKey, null, 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 priKey :...
static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, transformation: string = 'SM2_256|SM3'): cryptoFramework.DataBlob { return CryptoUtil.decryptSync(data, priKey, null, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L75-L78
5fc7a2bdd8266ae0141e57f2a30ae594506bff6e
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_017_T.ets
arkts
Introduction 库函数-string_toUpperCase
export function string_lib_func_017_T(taint_src : string) { let t = taint_src.toUpperCase(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_017_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_stateme...
export function string_lib_func_017_T(taint_src : string) { let t = taint_src.toUpperCase(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_017_T.ets#L7-L10
aeb8aeeecc0c5a0aded5e97c12875779f17ccd52
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets
arkts
decodeGCM
解密-GCM模式 @param str 加密的字符串 @param aesKey AES密钥
static async decodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> { //转换密钥 let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256); // 初始化加解密操作环境:开始解密 let mode = crypto.CryptoMode.DECRYPT_MODE; //创建解密器 let cipher = crypto.createCipher('AES256|GCM|PKCS7'); //初始化加密 ...
AST#method_declaration#Left static async decodeGCM 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
static async decodeGCM(str: string, aesKey: string): Promise<OutDTO<string>> { let symKey = await CryptoUtil.convertKeyFromStr(aesKey, 'AES256', 256); let mode = crypto.CryptoMode.DECRYPT_MODE; let cipher = crypto.createCipher('AES256|GCM|PKCS7'); await cipher.init(mode, symKey, AES....
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L158-L173
7cbeec701f18bded1da21f8bde39e6aad1aa17ec
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/components/common/Index.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 * from './src/main/ets/components';
AST#export_declaration#Left export * from './src/main/ets/components' ; AST#export_declaration#Right
export * from './src/main/ets/components';
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/components/common/Index.ets#L16-L16
a6bbeb6cdde0e125ce469593a0920fe4d78cfde6
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DateUtils.ets
arkts
padZero
左侧补零函数(私有静态方法) @param value 需要补零的数字 @param len 目标长度,默认2位 @returns 补零后的字符串
private static padZero(value: number, len: number = 2): string { return value.toString().padStart(len, '0'); }
AST#method_declaration#Left private static padZero AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
private static padZero(value: number, len: number = 2): string { return value.toString().padStart(len, '0'); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DateUtils.ets#L339-L341
9dab53410b4b72b32fdb12a4eb02749f2c381600
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/TimedReminderService.ets
arkts
cancelAllReminders
取消所有提醒
public async cancelAllReminders(): Promise<number> { try { let cancelledCount = 0; const reminders = Array.from(this.activeReminders.keys()); for (const reminderId of reminders) { if (await this.cancelReminder(reminderId)) { cancelledCount++; } } hilog.info(...
AST#method_declaration#Left public async cancelAllReminders 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 number AST#primary_type#Right AST#type_annotation#Right...
public async cancelAllReminders(): Promise<number> { try { let cancelledCount = 0; const reminders = Array.from(this.activeReminders.keys()); for (const reminderId of reminders) { if (await this.cancelReminder(reminderId)) { cancelledCount++; } } hilog.info(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/TimedReminderService.ets#L188-L208
68b1aecfe15eff0453f58d6a598584117ef10aac
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets
arkts
getData
获取真实数据的方法
async getData() { try { this.isDreamsLoading = true; // 获取当前登录用户ID const userId = this.userSession.getUserId(); if (this.selectedCategory === '全部') { // 获取所有梦想 this.dreams = await getDreamsByUserId(userId); } else { // 获取特定分类的梦想 this.dreams...
AST#method_declaration#Left async getData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Lef...
async getData() { try { this.isDreamsLoading = true; const userId = this.userSession.getUserId(); if (this.selectedCategory === '全部') { this.dreams = await getDreamsByUserId(userId); } else { this.dreams = await getDreamsByUserIdAndCateg...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamPage.ets#L72-L93
57706e0bb774ebb7b1db4f8cba48cf9180bde642
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ResponsiveLayout/entry/src/main/ets/constants/BreakpointConstants.ets
arkts
Constants for breakpoint.
export class BreakpointConstants { /** * Breakpoints that represent small device types. */ static readonly BREAKPOINT_SM: string = 'sm'; /** * Breakpoints that represent middle device types. */ static readonly BREAKPOINT_MD: string = 'md'; /** * Breakpoints that represent large device types. ...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /** * Breakpoints that represent small device types. */ AST#property_declaration#Left static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
export class BreakpointConstants { static readonly BREAKPOINT_SM: string = 'sm'; static readonly BREAKPOINT_MD: string = 'md'; static readonly BREAKPOINT_LG: string = 'lg'; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ResponsiveLayout/entry/src/main/ets/constants/BreakpointConstants.ets#L19-L32
f453109b04fb1ff0f9ad7c6cb594e06855aec53d
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/Utils.ets
arkts
getStartOfToday
Get start of today (00:00:00) as timestamp @returns Timestamp of start of today
static getStartOfToday(): number { const now = new Date(); now.setHours(0, 0, 0, 0); return now.getTime(); }
AST#method_declaration#Left static getStartOfToday 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#variable_declaration#Left const AST#variable_declarator#Left ...
static getStartOfToday(): number { const now = new Date(); now.setHours(0, 0, 0, 0); return now.getTime(); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/Utils.ets#L43-L47
e310ea4c02a5fd6b3a324b0fa800bfa896364d75
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
arkts
transitionFromUp
顶部弹出动画 @param duration 动画时间 @returns
static transitionFromUp(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ delay: du...
AST#method_declaration#Left static transitionFromUp AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 200 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_anno...
static transitionFromUp(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ delay: du...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets#L22-L29
05e9794fdd093e852c3a30e62585f5c792fbd701
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/CategoryListSample/entry/src/main/ets/common/bean/ListItemData.ets
arkts
List item data.
export class ListItemData { /** * List item title. */ title: Resource; /** * Summary. */ summary: Resource; /** * Arrow image. */ imageArrow: Resource; }
AST#export_declaration#Left export AST#class_declaration#Left class ListItemData AST#class_body#Left { /** * List item title. */ AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * ...
export class ListItemData { title: Resource; summary: Resource; imageArrow: Resource; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategoryListSample/entry/src/main/ets/common/bean/ListItemData.ets#L4-L19
f93153e0101e41b2e678b1c9bbc172a04a1e2753
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets
arkts
downloadFile
下载文件 @param fileName - 文件名 @param proccessing - 进度回调,返回当前下载进度百分比 @param finished - 完成回调,返回文件URL、元数据信息或错误信息
public downloadFile(fileName: string, proccessing: (progress: number) => void, finished: (fileUrl: string | null, metaInfo: CMetaInfo | null, error: string | null) => void): void { // 校验文件名有效性 if (!fileName || fileName.trim().length === 0) { finished(null, null, "文件名为空"); return; } // 检查网络连...
AST#method_declaration#Left public downloadFile AST#parameter_list#Left ( AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left proccessing : AST#type_annotation#Left AST#function_type#Left AST#parame...
public downloadFile(fileName: string, proccessing: (progress: number) => void, finished: (fileUrl: string | null, metaInfo: CMetaInfo | null, error: string | null) => void): void { if (!fileName || fileName.trim().length === 0) { finished(null, null, "文件名为空"); return; } if (!NetWorkTo...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CFileDownloader.ets#L167-L182
8b26706a5b6230535b9f0ce07223dc398f1d2b6a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
arkts
initToastDefault
初始化ToastOptions参数 @param options
static initToastDefault(options: ToastOptions, type: number = 0) { if (type == 2) { options.duration = options.duration ?? ActionParameter.config.toast_durationLong; } else if (type == 1) { options.duration = options.duration ?? ActionParameter.config.toast_durationShort; } else { options....
AST#method_declaration#Left static initToastDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ToastOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AS...
static initToastDefault(options: ToastOptions, type: number = 0) { if (type == 2) { options.duration = options.duration ?? ActionParameter.config.toast_durationLong; } else if (type == 1) { options.duration = options.duration ?? ActionParameter.config.toast_durationShort; } else { options....
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L644-L667
22fb8d53f77b6c9e4f6b2bee839282cbf9a6ea8e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
isSameDay
判断是否是同一天
static isSameDay(date1: number | string | Date, date2: number | string | Date) { date1 = DateUtil.getFormatDate(date1); date2 = DateUtil.getFormatDate(date2); let blSameYear = date1.getFullYear() === date2.getFullYear(); let blSameMonth = date1.getMonth() === date2.getMonth(); let blSameDay = date1....
AST#method_declaration#Left static isSameDay AST#parameter_list#Left ( AST#parameter#Left date1 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Righ...
static isSameDay(date1: number | string | Date, date2: number | string | Date) { date1 = DateUtil.getFormatDate(date1); date2 = DateUtil.getFormatDate(date2); let blSameYear = date1.getFullYear() === date2.getFullYear(); let blSameMonth = date1.getMonth() === date2.getMonth(); let blSameDay = date1....
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L214-L221
63280155ed709b64f21a53ef2ec1d09cd1f74327
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
isLoggedIn
是否已登录 @returns {boolean} 是否登录
private isLoggedIn(): boolean { return this.userState.isLoggedIn(); }
AST#method_declaration#Left private isLoggedIn 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 AST#call_expres...
private isLoggedIn(): boolean { return this.userState.isLoggedIn(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L214-L216
3f662f60976230ba955854ffce6d27dde783922e
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/addDevice/utils/base64Util.ets
arkts
base64encode
base64编码 @param {Object} str
static base64encode(str){ var out, i, len; var c1, c2, c3; len = str.length; i = 0; out = ""; while (i < len) { c1 = str.charCodeAt(i++) & 0xff; if (i == len) { out += this.base64EncodeChars.charAt(c1 >> 2); out += this.base64EncodeChars.charAt((c1 & 0x3) << 4); ...
AST#method_declaration#Left static base64encode AST#parameter_list#Left ( AST#parameter#Left str AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left out AST#variable_declarator#Right , AST#variable_declarator#Left i ...
static base64encode(str){ var out, i, len; var c1, c2, c3; len = str.length; i = 0; out = ""; while (i < len) { c1 = str.charCodeAt(i++) & 0xff; if (i == len) { out += this.base64EncodeChars.charAt(c1 >> 2); out += this.base64EncodeChars.charAt((c1 & 0x3) << 4); ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/addDevice/utils/base64Util.ets#L28-L57
1df74a5d0782ee474eb0fad466c74570e4c65834
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/extension_actions.ets
arkts
Selects and installs a zip or crx. @returns True if success, false if failed, undefined for a duplicated id.
export function select_install_extension(uiContext: UIContext) { return document_pick_to_uri(['zip', 'crx']).then(async (result) => { if (!result) { // storage.set('universal_fail_prompt_desc_gateway', $r('app.string.Fail_select_bad_file')); return false; } console.log(`[select_install_extensi...
AST#export_declaration#Left export AST#function_declaration#Left function select_install_extension AST#parameter_list#Left ( AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s...
export function select_install_extension(uiContext: UIContext) { return document_pick_to_uri(['zip', 'crx']).then(async (result) => { if (!result) { return false; } console.log(`[select_install_extension] ${result}`); let path = uri_2_path(result); let id = extension_id_for_path(path)...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L86-L150
b1ad149677798d0f9033835dfeff678026d0056c
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/SimulateLogin/entry/src/main/ets/pages/Index.ets
arkts
login
模拟登录
login() { //http请求对象 let httpRequest = http.createHttp(); //请求的登录名和密码参数 let params = "username=" + this.loginName + "&password=" + this.passwd let opt: http.HttpRequestOptions = { method: http.RequestMethod.POST, extraData: params, header: {'Content-Type': 'application/x-www-form-...
AST#method_declaration#Left login AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //http请求对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left httpRequest = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
login() { let httpRequest = http.createHttp(); let params = "username=" + this.loginName + "&password=" + this.passwd let opt: http.HttpRequestOptions = { method: http.RequestMethod.POST, extraData: params, header: {'Content-Type': 'application/x-www-form-urlencoded' }, ex...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/SimulateLogin/entry/src/main/ets/pages/Index.ets#L146-L167
fd5b930bd5ba85f616053707e26fd0eb6fc93c14
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/TypingStart.ets
arkts
get
应用约束:1. 强制使用静态类型
get elapsedTime(): number { return Date.now() - this.since.getTime(); }
AST#method_declaration#Left get AST#ERROR#Left elapsedTime AST#ERROR#Right 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#expr...
get elapsedTime(): number { return Date.now() - this.since.getTime(); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/TypingStart.ets#L71-L73
210267a81de02250a121208ced57f7fc48999307
github
2763981847/Accounting-app.git
cf8302a42588ecce1561b82e8533798157157257
entry/src/main/ets/pages/StatisticPage.ets
arkts
StatisticPage
使用@Link和@State修饰符管理组件的数据和状态
@Component export default struct StatisticPage { @Link @Watch('refreshClassifiedStatistics') accounts: Array<Account>; // 由于@State修饰Date类型可能出错,因此这里存储的是时间戳 @State @Watch('refreshClassifiedStatistics') endDate: number = getEndOfTheDay(new Date()).getTime(); @State @Watch('refreshClassifiedStatistics') beginDate: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct StatisticPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'refreshClassifiedStatistics' AST#expression...
@Component export default struct StatisticPage { @Link @Watch('refreshClassifiedStatistics') accounts: Array<Account>; @State @Watch('refreshClassifiedStatistics') endDate: number = getEndOfTheDay(new Date()).getTime(); @State @Watch('refreshClassifiedStatistics') beginDate: number = getFirstDateOfThisMonth(th...
https://github.com/2763981847/Accounting-app.git/blob/cf8302a42588ecce1561b82e8533798157157257/entry/src/main/ets/pages/StatisticPage.ets#L14-L183
44cbb2145dc546473e83dcd42a7ab94b4d06bc69
github