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
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/SafeAreaDemoPage.ets
arkts
SafeAreaDemoPage
@file 安全区示例页视图 @author Joker.X
@ComponentV2 export struct SafeAreaDemoPage { /** * 安全区示例页 ViewModel */ @Local private vm: SafeAreaDemoViewModel = new SafeAreaDemoViewModel(); /** * 窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 构建安全区示例页 * @returns {void} 无返回值 *...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SafeAreaDemoPage AST#component_body#Left { /** * 安全区示例页 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Saf...
@ComponentV2 export struct SafeAreaDemoPage { @Local private vm: SafeAreaDemoViewModel = new SafeAreaDemoViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); build() { AppNavDestination({ title: $r("app.string.demo_safe_area_title"), viewMo...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/SafeAreaDemoPage.ets#L11-L88
d3ea242ee8cdd3ff7b15f1b364a83c5e4b629ab0
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/model/VideoData.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 interface VideoData { video?: string; url?: string; name: Resource; description: ResourceStr; time: string; controller?: VideoController; auto: boolean; head: Resource; likeCount: string; commentCount: string; shareCount: string; play: boolean; index: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface VideoData AST#object_type#Left { AST#type_member#Left video ? : 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 url ? : AST#type_annotation#Left...
export interface VideoData { video?: string; url?: string; name: Resource; description: ResourceStr; time: string; controller?: VideoController; auto: boolean; head: Resource; likeCount: string; commentCount: string; shareCount: string; play: boolean; index: number; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/model/VideoData.ets#L16-L30
cf507d1fcd321757c9243b49ad90f7c61a4b77de
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/ITextInputOptions.ets
arkts
文本输入框(TextInput)参数配置接口 @extends BaseInputOptions
export interface ITextInputOptions extends IBaseInputOptions { /** * 输入框类型(可选) * @default InputType.Normal */ inputType?: InputType; /** * 是否以明文显示密码(可选) * @description 仅在 `inputType` 为 `InputType.Password` 时生效 * @default false */ showPassword?: boolean; /** * 是否显示密码切换图标(可选) * @des...
AST#export_declaration#Left export AST#interface_declaration#Left interface ITextInputOptions AST#extends_clause#Left extends IBaseInputOptions AST#extends_clause#Right AST#object_type#Left { /** * 输入框类型(可选) * @default InputType.Normal */ AST#type_member#Left inputType ? : AST#type_annotation#Left AST#primary_...
export interface ITextInputOptions extends IBaseInputOptions { inputType?: InputType; showPassword?: boolean; showPasswordIcon?: boolean; passwordIcon?: PasswordIcon; passwordRules?: string; cancelButton?: CancelButtonOptions; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/ITextInputOptions.ets#L7-L45
6229ece9b219e022733858a691018bff88ff6971
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/model/NavItemModel.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, softw...
export interface NavItem { icon: Resource; icon_selected: Resource; text: Resource; id: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NavItem AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left icon_selected : AST#type_annotation...
export interface NavItem { icon: Resource; icon_selected: Resource; text: Resource; id: number; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/model/NavItemModel.ets#L16-L21
d7bbb8d69a216538d8d695ecb6d057b27a773cde
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
arkts
根据名称获取图标资源的直接引用 这个函数在实际开发中应被弃用,因为ArkTS不支持动态引用资源 @param name 图标名称 @returns 资源直接引用
export function getIconResource(name: string): ResourceStr { // 使用SystemIcon组件而不是直接引用资源 return AppIcons.default_icon; }
AST#export_declaration#Left export AST#function_declaration#Left function getIconResource 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_list#Right : AST#type_annotation#Left A...
export function getIconResource(name: string): ResourceStr { return AppIcons.default_icon; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L230-L233
1531d011826afa4d1c36fba8c8c23a177a387e9f
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/listener/EventControl.ets
arkts
eventIsEnable
事件是否启用
public eventIsEnable(evType: EventType) { return this.eventMap.get(evType); }
AST#method_declaration#Left public eventIsEnable AST#parameter_list#Left ( AST#parameter#Left evType : AST#type_annotation#Left AST#primary_type#Left EventType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_stateme...
public eventIsEnable(evType: EventType) { return this.eventMap.get(evType); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/listener/EventControl.ets#L33-L35
e686f3096aef6854a58334149e9e555133017ddd
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/CommonConstants.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, softw...
export class CommonConstants { /** * database preference id. */ static readonly PREFERENCE_ID = 'storageId'; /** * database alarm data key. */ static readonly ALARM_KEY = 'alarmData'; /** * common full length */ static readonly FULL_LENGTH: string = '100%'; /** * default string space....
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * database preference id. */ AST#property_declaration#Left static readonly PREFERENCE_ID = AST#expression#Left 'storageId' AST#expression#Right ; AST#property_declaration#Right /** * database alarm dat...
export class CommonConstants { static readonly PREFERENCE_ID = 'storageId'; static readonly ALARM_KEY = 'alarmData'; static readonly FULL_LENGTH: string = '100%'; static readonly DEFAULT_STRING_SPACE: string = ' '; static readonly DEFAULT_STRING_COMMA: string = ','; static readonly DEFAULT...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/constants/CommonConstants.ets#L16-L129
b5bb627b08a50b702b93440785feb9fa2cbe0083
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/setting/SettingPage.ets
arkts
跳转到系统设置的权限页面
export class SettingPage implements Setting { private mOnGranted: ((permissions: Array<Permissions>) => void) | null = null private mOnDenied: ((permissions: Array<Permissions>) => void) | null = null private mOnPartialGranted: ((partialGranted: Array<Permissions>) => void) | null = null private mOnFailed: ((p...
AST#export_declaration#Left export AST#ERROR#Left class SettingPage AST#implements_clause#Left implements Setting AST#implements_clause#Right { AST#property_declaration#Left private mOnGranted : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST...
export class SettingPage implements Setting { private mOnGranted: ((permissions: Array<Permissions>) => void) | null = null private mOnDenied: ((permissions: Array<Permissions>) => void) | null = null private mOnPartialGranted: ((partialGranted: Array<Permissions>) => void) | null = null private mOnFailed: ((p...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/setting/SettingPage.ets#L17-L25
4691851787af7f97456530fcf158a88bc0b50677
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
onRequestSuccess
请求成功后处理分类树数据 @param {Category[]} data - 分类列表 @returns {void} 无返回值
protected onRequestSuccess(data: Category[]): void { this.categoryTrees = this.convertToTree(data); this.categoryTitles = this.categoryTrees.map((item: CategoryTree): string => item.name); this.isSideBarScrolling = false; this.lastSideBarIndex = 0; this.clearSideBarUnlockTimer(); if (this.catego...
AST#method_declaration#Left protected onRequestSuccess AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Category [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot...
protected onRequestSuccess(data: Category[]): void { this.categoryTrees = this.convertToTree(data); this.categoryTitles = this.categoryTrees.map((item: CategoryTree): string => item.name); this.isSideBarScrolling = false; this.lastSideBarIndex = 0; this.clearSideBarUnlockTimer(); if (this.catego...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CategoryViewModel.ets#L59-L73
b40be3cc71dbeae7300e44932c4a1887c012db04
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/entryability/EntryAbility.ets
arkts
initializeServices
初始化应用服务
private async initializeServices(): Promise<void> { try { // 初始化数据库服务 await DatabaseService.getInstance().initialize(this.context); // 初始化首选项服务 await PreferencesService.getInstance().initialize(this.context); // 初始化设置服务 await SettingsService.getInstance().initialize...
AST#method_declaration#Left private async initializeServices 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 ...
private async initializeServices(): Promise<void> { try { await DatabaseService.getInstance().initialize(this.context); await PreferencesService.getInstance().initialize(this.context); await SettingsService.getInstance().initialize(); hilog.info(LogC...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/entryability/EntryAbility.ets#L118-L135
be37072a24b8e0531f690b02875950a1eab2e19c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/report/RadarView.ets
arkts
drawCanvas
========== 绘制主入口 ==========
private drawCanvas(): void { if (!this.isCanvasReady || !this.ctx) return; try { const width = this.chartWidth; const height = this.chartHeight; this.ctx.clearRect(0, 0, width, height); const centerX = width / 2; const centerY = height / 2; const radius = Math.min(width, h...
AST#method_declaration#Left private drawCanvas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Le...
private drawCanvas(): void { if (!this.isCanvasReady || !this.ctx) return; try { const width = this.chartWidth; const height = this.chartHeight; this.ctx.clearRect(0, 0, width, height); const centerX = width / 2; const centerY = height / 2; const radius = Math.min(width, h...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/report/RadarView.ets#L119-L146
c913237e47b2994ee987093524f5bd4c9844b8ef
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/MessagesDataSource.ets
arkts
聊天界面(ChatPage.ets)中的List列表对应的数据源实现类(负责聊天消息数据的UI显示)。 注意:本类中的数据来源为全局消息缓存管理类 MessageProvider 中缓存消息集合的对象引用(浅拷贝),相当于共用同一个缓存,无需单 独维护数据,实现了聊天消息数据的管理(MessageProvider负责)和UI界面显示(MessagesDataSource负责)的解偶。 @author JackJang @since 1.0
export default class MessagesDataSource extends BasicDataSource<Message> { /** 引用全局消息缓存管理类 MessageProvider 中缓存消息集合(浅拷贝)*/ private messages: Array<Message> = IMClientManager.getInstance().getMessageProvider().getMessages(); notifyDataReload(): void { super.notifyDataReload(); } totalCount(): number { ...
AST#export_declaration#Left export default AST#class_declaration#Left class MessagesDataSource extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right > ...
export default class MessagesDataSource extends BasicDataSource<Message> { private messages: Array<Message> = IMClientManager.getInstance().getMessageProvider().getMessages(); notifyDataReload(): void { super.notifyDataReload(); } totalCount(): number { return this.messages.length } getData(i...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesDataSource.ets#L24-L52
6fd08d25005c40917366c275ee17e0ec560f932c
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DeviceUtils.ets
arkts
HarmonyOS 设备信息工具类 (Stage模型) 功能等效于原Android的DeviceUtility
export class DeviceUtil { // 设备类型常量 private static readonly DEVICE_TYPE = AppSettings.App.deviceType; static getStableUUID(): string { // 打开或创建 Preferences 存储(持久化) let pref = preferences.getPreferencesSync(getContext(), {name: Pref.Name}); // 尝试读取已保存的 UUID let uuid = pref.getSync(Pref.KEY_DEV...
AST#export_declaration#Left export AST#class_declaration#Left class DeviceUtil AST#class_body#Left { // 设备类型常量 AST#property_declaration#Left private static readonly DEVICE_TYPE = AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppSettings AST#expression#...
export class DeviceUtil { private static readonly DEVICE_TYPE = AppSettings.App.deviceType; static getStableUUID(): string { let pref = preferences.getPreferencesSync(getContext(), {name: Pref.Name}); let uuid = pref.getSync(Pref.KEY_DEVICE_UUID, '') as string; if (uuid && uuid.length ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DeviceUtils.ets#L19-L107
afa75b169bd205c5471b958b3b85ed9b09d80e67
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DisplayUtils.ets
arkts
isLandscapeByAspectRatio
方法1: 基于屏幕宽高比的判断(最常用) 通过宽高比判断是否为横屏 @returns 宽 > 高时返回true(横屏)
public static isLandscapeByAspectRatio(): boolean { const width = DisplayUtils.getScreenWidthPx(); const height = DisplayUtils.getScreenHeightPx(); return width > height; }
AST#method_declaration#Left public static isLandscapeByAspectRatio 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#variable_declaration#Left const AST#variable...
public static isLandscapeByAspectRatio(): boolean { const width = DisplayUtils.getScreenWidthPx(); const height = DisplayUtils.getScreenHeightPx(); return width > height; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L82-L86
b094c997095def593aa6f9a90bc757d1a147dda9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarChartModel.ets
arkts
isDrawValueAboveBarEnabled
returns true if drawing values above bars is enabled, false if not @return
public isDrawValueAboveBarEnabled(): boolean { return this.mDrawValueAboveBar; }
AST#method_declaration#Left public isDrawValueAboveBarEnabled 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 ...
public isDrawValueAboveBarEnabled(): boolean { return this.mDrawValueAboveBar; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarChartModel.ets#L212-L214
ca4222a7098afbf609cb7524d18a313b53355a89
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentinstancesharedinpages/src/main/ets/components/MapComponent.ets
arkts
MapComponent
使用image组件模拟地图组件
@Component export struct MapComponent { // Image组件模拟地图,拖拽时修改这些状态变量,调整地图图片位置。地图图片宽高是页面的3倍,初始化xy偏移适当距离使地图显示在合适的位置 @State mapOffsetX: number = MapCommonConstants.mapInitOffsetX; @State mapOffsetY: number = MapCommonConstants.mapInitOffsetY; // 保存拖拽前xy的偏移位置 private mapPoxX: number = 0; private mapPoxY: number =...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MapComponent AST#component_body#Left { // Image组件模拟地图,拖拽时修改这些状态变量,调整地图图片位置。地图图片宽高是页面的3倍,初始化xy偏移适当距离使地图显示在合适的位置 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right mapOffsetX : AST#type_annotat...
@Component export struct MapComponent { @State mapOffsetX: number = MapCommonConstants.mapInitOffsetX; @State mapOffsetY: number = MapCommonConstants.mapInitOffsetY; private mapPoxX: number = 0; private mapPoxY: number = 0; @Consume mapResponseRegionHeight: number; @State thumbTackState: ThumbTack...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentinstancesharedinpages/src/main/ets/components/MapComponent.ets#L22-L158
6aad7d4c2eccf69e925101b6270186f545802f0d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/Tcp2TwoWayTlsWorker.ets
arkts
sendMessageToServer
Send message to the server
function sendMessageToServer(message: string) { if (!tlsSocket) { workerPort.postMessage({ type: 'sendMessageFailure', message: 'TLS connection not established' }); return; } tlsSocket.send(message + '\r\n').then(() => { workerPort.postMessage({ type: 'sendMessageSuccess', message: message }); }).c...
AST#function_declaration#Left function sendMessageToServer 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#block_statement#Left { AST#statement#Left AST#if_sta...
function sendMessageToServer(message: string) { if (!tlsSocket) { workerPort.postMessage({ type: 'sendMessageFailure', message: 'TLS connection not established' }); return; } tlsSocket.send(message + '\r\n').then(() => { workerPort.postMessage({ type: 'sendMessageSuccess', message: message }); }).c...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/Tcp2TwoWayTlsWorker.ets#L151-L162
d5e90a54bf576616289ad808b0fa96a2469d634b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets
arkts
getCaptcha
获取图片验证码 @returns {Promise<NetworkResponse<Captcha>>} 图片验证码
async getCaptcha(): Promise<NetworkResponse<Captcha>> { const response: AxiosResponse<NetworkResponse<Captcha>> = await NetworkClient.http.get("user/login/captcha"); return response.data; }
AST#method_declaration#Left async getCaptcha 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 < AST#ty...
async getCaptcha(): Promise<NetworkResponse<Captcha>> { const response: AxiosResponse<NetworkResponse<Captcha>> = await NetworkClient.http.get("user/login/captcha"); return response.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/auth/AuthNetworkDataSourceImpl.ets#L92-L96
ab57840f35dbd1cc7c1b8cd4b32101286003ca31
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/iab/huawei/HwSubscriber.ets
arkts
finishPurchase
完成购买(确认发货)
private async finishPurchase(purchaseOrder: PurchaseOrderPayload): Promise<void> { if (!purchaseOrder.productType) { DebugLog.e('finishPurchase: productType missing'); return; } const param: iap.FinishPurchaseParameter = { productType : Number(purchaseOrder.productType), purchas...
AST#method_declaration#Left private async finishPurchase AST#parameter_list#Left ( AST#parameter#Left purchaseOrder : AST#type_annotation#Left AST#primary_type#Left PurchaseOrderPayload AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary...
private async finishPurchase(purchaseOrder: PurchaseOrderPayload): Promise<void> { if (!purchaseOrder.productType) { DebugLog.e('finishPurchase: productType missing'); return; } const param: iap.FinishPurchaseParameter = { productType : Number(purchaseOrder.productType), purchas...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L196-L215
d71e939ba6126abf5f2ab546b504dbba00be5f88
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/sheet/ShowEpisodeSheet.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/23 19:27 @Version V1.0 @Description
export class ShowEpisodeSheet extends Sheet { private readonly args: FinItem private playArgs?: PlayerArgs private readonly callback: Callback<PlayerArgs> = (args) => { this.playArgs = args this.dismiss(true) } constructor
AST#export_declaration#Left export AST#ERROR#Left class ShowEpisodeSheet extends AST#type_annotation#Left AST#primary_type#Left Sheet AST#primary_type#Right AST#type_annotation#Right { AST#property_declaration#Left private readonly args : AST#type_annotation#Left AST#primary_type#Left FinItem AST#primary_type#Right AST...
export class ShowEpisodeSheet extends Sheet { private readonly args: FinItem private playArgs?: PlayerArgs private readonly callback: Callback<PlayerArgs> = (args) => { this.playArgs = args this.dismiss(true) } constructor
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/sheet/ShowEpisodeSheet.ets#L16-L27
3f260324afee9788d555efb4aed18402e2295bfb
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/pages/StickOnTopPage.ets
arkts
getResourceStringArray
[StartExclude quick_start]
getResourceStringArray(resource: Resource): Array<string> { let result: Array<string> = new Array<string>(); try { result = this.getUIContext().getHostContext()?.resourceManager.getStringArrayValueSync(resource.id) as string[]; } catch (e) { hilog.error(0x0000, TAG, `[getResourceString]getString...
AST#method_declaration#Left getResourceStringArray AST#parameter_list#Left ( AST#parameter#Left resource : 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 AST#generic_...
getResourceStringArray(resource: Resource): Array<string> { let result: Array<string> = new Array<string>(); try { result = this.getUIContext().getHostContext()?.resourceManager.getStringArrayValueSync(resource.id) as string[]; } catch (e) { hilog.error(0x0000, TAG, `[getResourceString]getString...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/StickOnTopPage.ets#L155-L163
97185933d080eca9a7d8816a1672358904cca70a
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/Base64Utils.ets
arkts
encodeSync
编码,通过输入参数编码后输出Uint8Array对象。 @param array @returns
static encodeSync(array: Uint8Array): Uint8Array { let base64 = new util.Base64Helper(); let result = base64.encodeSync(array); return result; }
AST#method_declaration#Left static encodeSync AST#parameter_list#Left ( AST#parameter#Left array : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#pri...
static encodeSync(array: Uint8Array): Uint8Array { let base64 = new util.Base64Helper(); let result = base64.encodeSync(array); return result; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/Base64Utils.ets#L16-L20
fd14c647f432e28f2d8c563d52fa306d409e0a5d
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
getRequiredHeightSpace
This is for HorizontalBarChart vertical spacing. @param p @return
public getRequiredHeightSpace(p: Paint): number { p.setTextSize(this.mTextSize); var label: string = super.getLongestLabel(); return Utils.calcTextHeight(p, label) + super.getYOffset() * 2; }
AST#method_declaration#Left public getRequiredHeightSpace AST#parameter_list#Left ( AST#parameter#Left p : AST#type_annotation#Left AST#primary_type#Left Paint 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#prim...
public getRequiredHeightSpace(p: Paint): number { p.setTextSize(this.mTextSize); var label: string = super.getLongestLabel(); return Utils.calcTextHeight(p, label) + super.getYOffset() * 2; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L377-L382
18b0478e0c8a7816f452e2776481f566d635ee4e
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
arkts
clear
/ 移除所有
public static clear() { PreferencesUtil.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 PreferencesUtil AST#expression#Right . clear...
public static clear() { PreferencesUtil.clear() }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L69-L71
e6861119b9c8a246dd1cb460351998676de96980
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/RegexUtils.ets
arkts
isEmail
判断传入的邮箱格式是否正确 @param content @returns
static isEmail(content: string): boolean { return RegexUtils.isMatch(content, RegexUtils.REG_EMAIL); }
AST#method_declaration#Left static isEmail AST#parameter_list#Left ( AST#parameter#Left content : 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 boolean AST#primary_typ...
static isEmail(content: string): boolean { return RegexUtils.isMatch(content, RegexUtils.REG_EMAIL); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/RegexUtils.ets#L221-L223
5de5e5f5e40adb263230c5525e6524df4aa3b14f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
月度活动数据接口
export interface MonthlyActivity { month: string; activities: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface MonthlyActivity AST#object_type#Left { AST#type_member#Left month : 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 activities : AST#type_annota...
export interface MonthlyActivity { month: string; activities: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L203-L206
b45dc6a61538b30509a3e083980f4618f4e074d4
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets
arkts
updateGroupShow
批量更新分组是否显示
async updateGroupShow(groupId:number|number[], isShow?:boolean){ let Ids:number[] = toolsUtils.numberArrays(groupId) Ids.forEach((item:number)=>{ BookGroupsDao.updateGroupShow(item,isShow) }) }
AST#method_declaration#Left async updateGroupShow AST#parameter_list#Left ( AST#parameter#Left groupId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#union_type#Righ...
async updateGroupShow(groupId:number|number[], isShow?:boolean){ let Ids:number[] = toolsUtils.numberArrays(groupId) Ids.forEach((item:number)=>{ BookGroupsDao.updateGroupShow(item,isShow) }) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/bookGroupUtils.ets#L75-L80
a3921505ed8f691244d0156c1b6793252f2707ab
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
生产版本:移除测试联系人功能 主布局构建 采用现代卡片式设计,参考DESIGN_SPEC.md布局规范
build() { Stack() { Column() { // 顶部状态栏(设计规范:固定头部) this.buildHeader() // 主内容区域(滚动容器) Scroll() { Column({ space: 16 }) { // 根据当前Tab显示对应内容 if (this.currentTab === 0) { this.buildHomeContent() } else if (this.currentTab ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 顶部状态栏(设计...
build() { Stack() { Column() { this.buildHeader() Scroll() { Column({ space: 16 }) { if (this.currentTab === 0) { this.buildHomeContent() } else if (this.currentTab === 1) { this.buildContactsContent(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L976-L1191
d765da59a09cab72306f0633dd710e134534595c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets
arkts
savePicture
Read Image
async savePicture(buffer: ArrayBuffer, img: image.Image) { try { Logger.info(this.tag, 'savePicture start'); let imgFileAsset: photoAccessHelper.PhotoAsset = await this.mediaUtil.createAndGetUri(Constants.IMAGE); let imgPhotoUri = imgFileAsset.uri; Logger.info(this.tag, `photoUri = ${imgPhot...
AST#method_declaration#Left async savePicture AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left img : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type...
async savePicture(buffer: ArrayBuffer, img: image.Image) { try { Logger.info(this.tag, 'savePicture start'); let imgFileAsset: photoAccessHelper.PhotoAsset = await this.mediaUtil.createAndGetUri(Constants.IMAGE); let imgPhotoUri = imgFileAsset.uri; Logger.info(this.tag, `photoUri = ${imgPhot...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/views/ModeSwitchPage.ets#L252-L271
a48a3fd2e71d12182f76c21c4b48294045529807
gitee
Classaspen/ArkTS_PasswordManagement.git
66aea6e4f8ee3a78e5029c63186dba70707ca2d9
entry/src/main/ets/components/database/Database.ets
arkts
getTableColumns
修复 getTableColumns 方法,确保返回 Promise
private async getTableColumns(rdbStore: relationalStore.RdbStore, tableName: string): Promise<string[]> { return new Promise((resolve, reject) => { let predicates = new relationalStore.RdbPredicates(tableName); rdbStore.query(predicates, [], (err, resultSet) => { if (err) { reject(err)...
AST#method_declaration#Left private async getTableColumns AST#parameter_list#Left ( AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramete...
private async getTableColumns(rdbStore: relationalStore.RdbStore, tableName: string): Promise<string[]> { return new Promise((resolve, reject) => { let predicates = new relationalStore.RdbPredicates(tableName); rdbStore.query(predicates, [], (err, resultSet) => { if (err) { reject(err)...
https://github.com/Classaspen/ArkTS_PasswordManagement.git/blob/66aea6e4f8ee3a78e5029c63186dba70707ca2d9/entry/src/main/ets/components/database/Database.ets#L102-L115
57aa5ed33439911c6bba908694e1e770e9178bc4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ImageUtil.ets
arkts
TODO 图片相关工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class ImageUtil { /** * 图片base64字符串转PixelMap * @param base64 图片base64字符串 * @returns */ static base64ToPixelMap(base64: string): Promise<image.PixelMap> { //将原始图片base64字符串转变为通过base64字符串 const reg = new RegExp('data:image/\\w+;base64,'); const base64Str = base64.replace(reg, ''); ...
AST#export_declaration#Left export AST#class_declaration#Left class ImageUtil AST#class_body#Left { /** * 图片base64字符串转PixelMap * @param base64 图片base64字符串 * @returns */ AST#method_declaration#Left static base64ToPixelMap AST#parameter_list#Left ( AST#parameter#Left base64 : AST#type_annotation#Left AST#prim...
export class ImageUtil { static base64ToPixelMap(base64: string): Promise<image.PixelMap> { const reg = new RegExp('data:image/\\w+;base64,'); const base64Str = base64.replace(reg, ''); let arrayBuffer = Base64Util.decodeSync(base64Str).buffer as ArrayBuffer; let imageSource = imag...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L32-L379
c3f8dce3e3f2b689550aaa1cd886aaf93518c5c5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
fdopenStreamSync
基于文件描述符打开文件流,以同步方法。 @param fd number 已打开的文件描述符。 @param mode string 文件打开类型 r:打开只读文件,该文件必须存在。 r+:打开可读写的文件,该文件必须存在。 w:打开只写文件,若文件存在则文件长度清0,即该文件内容会消失。若文件不存在则建立该文件。 w+:打开可读写文件,若文件存在则文件长度清0,即该文件内容会消失。若文件不存在则建立该文件。 a:以附加的方式打开只写文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文件尾,即文件原先的内容会被保留。 a+:以附加方式打开可读写的文件。若文件不存在,则会建立该文件,如果文件存在,写入的数据会被加到文...
static fdopenStreamSync(fd: number, mode: string = 'r'): fs.Stream { return fs.fdopenStreamSync(fd, mode) }
AST#method_declaration#Left static fdopenStreamSync AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static fdopenStreamSync(fd: number, mode: string = 'r'): fs.Stream { return fs.fdopenStreamSync(fd, mode) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L827-L829
ff24e0f2d2eb98b6c39911e7043379fcdf4471f6
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
TODO 文件操作相关工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class FileUtils { static readonly separator: string = '/'; static readonly KB: number = 1024; /** * 获取文件目录下的文件夹路径或文件路径。 * @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 * @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 * @param blHap true:HAP级别文件路径、 false:App级别文件路径 ...
AST#export_declaration#Left export AST#class_declaration#Left class FileUtils AST#class_body#Left { AST#property_declaration#Left static readonly separator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/' AST#expression#Right ; AST#proper...
export class FileUtils { static readonly separator: string = '/'; static readonly KB: number = 1024; static getFilesDirPath(dirPath: string | undefined = undefined, fileName: string | undefined = undefined, blHap: boolean = true): string { let filePath: string = blHap ? ArkWebHelper.getContext().filesDir...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L29-L749
b92bd95275e353458d733b3b78e05c9ff54bab88
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageloading/src/main/ets/model/CommodityDataSource.ets
arkts
registerDataChangeListener
该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { logger.info('add listener'); this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { logger.info('add listener'); this.listeners.push(listener); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageloading/src/main/ets/model/CommodityDataSource.ets#L43-L48
50dfecf950c8028d56c1e88658017ddba31272a9
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
showSpecModal
显示规格选择弹窗 @returns {void} 无返回值
showSpecModal(): void { this.showSpecSelectModal = true; // 显示弹窗时加载规格数据 this.loadGoodsSpecs(); }
AST#method_declaration#Left showSpecModal AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb...
showSpecModal(): void { this.showSpecSelectModal = true; this.loadGoodsSpecs(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets#L218-L222
dcae3f085ad5a6c546ce5af071037ce11a7e32bb
github
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/BaseMapper.ets
arkts
count
统计行数 @param wrapper 查询条件 @returns 行数
async count(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<number> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.count(myWrapper.getWhere...
AST#method_declaration#Left async count AST#parameter_list#Left ( AST#parameter#Left wrapper : AST#type_annotation#Left AST#primary_type#Left Wrapper AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Wrappe...
async count(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<number> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.count(myWrapper.getWhere...
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/BaseMapper.ets#L61-L80
629f6983fad145cc8ccbfa1e44a62ce4914940da
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets
arkts
updateTransactions
更新交易记录
public async updateTransactions(userTx: TransactionTableBasis) { const condition: TablePredicateParams = { field: TransactionTableFields.TRANSACTION_ID, value: userTx.transactionId, operator: DBOperator.EQUAL, }; const tx: TransactionTableBasis = { transactionId: userTx.transactionId...
AST#method_declaration#Left public async updateTransactions AST#parameter_list#Left ( AST#parameter#Left userTx : AST#type_annotation#Left AST#primary_type#Left TransactionTableBasis AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#...
public async updateTransactions(userTx: TransactionTableBasis) { const condition: TablePredicateParams = { field: TransactionTableFields.TRANSACTION_ID, value: userTx.transactionId, operator: DBOperator.EQUAL, }; const tx: TransactionTableBasis = { transactionId: userTx.transactionId...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L167-L203
80e5ea6850b9542e91155c7835bdf7dec8d28f7e
github
conradsheeran/steam-totp.git
af0eba089e77ff73e6983ce61fa89190c628721e
src/main/ets/pages/SteamTOTP.ets
arkts
SecretToBuffer
如果 secret 是字符串格式,则将其转换为 Buffer @param secret - 作为 Buffer、hex 或 base64 字符串的 secret @returns { buffer.Buffer }
private static SecretToBuffer(secret: buffer.Buffer | string): buffer.Buffer { if (buffer.isBuffer(secret)) { return secret as buffer.Buffer; } else if (/^[0-9a-f]{40}$/i.test(secret as string)) { return buffer.from(secret as string, 'hex'); } else { return buffer.from(secret as string, 'b...
AST#method_declaration#Left private static SecretToBuffer AST#parameter_list#Left ( AST#parameter#Left secret : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left buffer . Buffer AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right...
private static SecretToBuffer(secret: buffer.Buffer | string): buffer.Buffer { if (buffer.isBuffer(secret)) { return secret as buffer.Buffer; } else if (/^[0-9a-f]{40}$/i.test(secret as string)) { return buffer.from(secret as string, 'hex'); } else { return buffer.from(secret as string, 'b...
https://github.com/conradsheeran/steam-totp.git/blob/af0eba089e77ff73e6983ce61fa89190c628721e/src/main/ets/pages/SteamTOTP.ets#L166-L174
2217e622a7dca79ee7976cdebea39bf1d8e9b9dd
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
clearCollectQuestion
清空所有收藏
public clearCollectQuestion(): void { this.examDetails.forEach((item: ExamDetail) => item.isCollect = false); }
AST#method_declaration#Left public clearCollectQuestion 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 ...
public clearCollectQuestion(): void { this.examDetails.forEach((item: ExamDetail) => item.isCollect = false); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L282-L284
a88881940c1a5456757a7741274de3f16328dcce
github
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/pages/HomePage.ets
arkts
WarningCard
卡片构建器
@Builder WarningCard(item: WarningItem) { Row() { // 1. 左侧图标 Column() { Image($r('sys.media.ohos_ic_public_fail')) .width(32).height(32) .fillColor(item.level === 2 ? '#FF4D4F' : '#FAAD14') } .width('15%') .justifyContent(FlexAlign.Center) // 2. 中间信息 ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right WarningCard AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left WarningItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_bod...
@Builder WarningCard(item: WarningItem) { Row() { Column() { Image($r('sys.media.ohos_ic_public_fail')) .width(32).height(32) .fillColor(item.level === 2 ? '#FF4D4F' : '#FAAD14') } .width('15%') .justifyContent(FlexAlign.Center) Column() { ...
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/HomePage.ets#L99-L181
ab885a5e0f9b678c35ceb81ffee0d6eb2d3000fe
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
getMinWidth
@return the minimum width that the axis should take (in vp).
public getMinWidth(): number { return this.mMinWidth; }
AST#method_declaration#Left public getMinWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre...
public getMinWidth(): number { return this.mMinWidth; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L195-L197
7be977d26e3ccd6db1dd0049b9b974c5f548675f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/collapsemenu/src/main/ets/constants/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 class Constants { // 普通面板 static readonly ORDINARY_MENU: number = 1; // 折叠面板 static readonly COLLAPSE_MENU: number = 2; }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { // 普通面板 AST#property_declaration#Left static readonly ORDINARY_MENU : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 1 AST#expression#Right ; ...
export class Constants { static readonly ORDINARY_MENU: number = 1; static readonly COLLAPSE_MENU: number = 2; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/collapsemenu/src/main/ets/constants/Constants.ets#L16-L21
d2edb04ee32e38841928e1a006d0c19ff6f721be
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleNotificationManager.ets
arkts
updateReminderSettings
更新提醒设置
async updateReminderSettings(settings: Partial<SimpleReminderSettings>): Promise<boolean> { try { // 手动合并设置 if (settings.taskReminderEnabled !== undefined) { this.reminderSettings.taskReminderEnabled = settings.taskReminderEnabled; } if (settings.pomodoroNotificationEnabled !== undef...
AST#method_declaration#Left async updateReminderSettings AST#parameter_list#Left ( AST#parameter#Left settings : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SimpleReminderSettings AST#primary_type#Right AST#type_an...
async updateReminderSettings(settings: Partial<SimpleReminderSettings>): Promise<boolean> { try { if (settings.taskReminderEnabled !== undefined) { this.reminderSettings.taskReminderEnabled = settings.taskReminderEnabled; } if (settings.pomodoroNotificationEnabled !== undefined) { ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleNotificationManager.ets#L143-L163
8b602ef68acea2b9cff968467788d4df8a3d21f4
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
appendMemLearn
/ 在内存中添加learn
appendMemLearn(learn: Learn): void { this.learns.push(learn); }
AST#method_declaration#Left appendMemLearn 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 void AST#primary_type#Righ...
appendMemLearn(learn: Learn): void { this.learns.push(learn); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L204-L206
3f5dfbfa908894243e27207b764cb3f2b90c722c
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/ImageAnimate.ets
arkts
getOffSetX
Get the image offset. @param index @returns offset
getOffSetX(index: number) { let offsetIndex = this.getImgCoefficients(index); let tempOffset = Math.abs(offsetIndex); let offsetX = 0; if (tempOffset === 1) { offsetX = -Const.IMAGE_X_OFFSET_MAX * offsetIndex; } else if (tempOffset === Const.HALF_COUNT) { offsetX = -Const.IMAGE_x_OFFSET_...
AST#method_declaration#Left getOffSetX 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Left le...
getOffSetX(index: number) { let offsetIndex = this.getImgCoefficients(index); let tempOffset = Math.abs(offsetIndex); let offsetX = 0; if (tempOffset === 1) { offsetX = -Const.IMAGE_X_OFFSET_MAX * offsetIndex; } else if (tempOffset === Const.HALF_COUNT) { offsetX = -Const.IMAGE_x_OFFSET_...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/ImageAnimate.ets#L65-L75
60e2a9deb78f5b48ef880520aba2977ec70a6e96
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/ImageKnife.ets
arkts
initFileCache
初始化文件缓存个数,大小,以及路径 @param context 上下文 @param size 缓存数量 @param memory 内存大小 @param path 文件目录
async initFileCache(context: Context, size: number = 256, memory: number = 256 * 1024 * 1024,path?: string) { this.fileCache = new FileCache(context, size, memory) if ( path != undefined ) { await this.fileCache.initFileCache(path) } else { await this.fileCache.initFileCache() } }
AST#method_declaration#Left async initFileCache AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
async initFileCache(context: Context, size: number = 256, memory: number = 256 * 1024 * 1024,path?: string) { this.fileCache = new FileCache(context, size, memory) if ( path != undefined ) { await this.fileCache.initFileCache(path) } else { await this.fileCache.initFileCache() } }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/ImageKnife.ets#L68-L75
5a0ea7ead600605b73c7515346939052918bd9fd
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/@xvideos_alerts/93.0.6/package/app.ets
arkts
应用约束第60条:使用import/export语法替代require和import赋值表达式
export function printMsg() {}
AST#export_declaration#Left export AST#function_declaration#Left function printMsg AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#function_declaration#Right AST#export_declaration#Right
export function printMsg() {}
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/@xvideos_alerts/93.0.6/package/app.ets#L2-L2
15c644e86d85753ec1dbf35d0f2dae565c0bd348
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets
arkts
The handler of onHoverStatusChange event @typedef { function } OnHoverStatusChangeHandler @param { HoverModeStatus } status - The status of hover mode @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export type OnHoverStatusChangeHandler = (status: HoverModeStatus) => void;
AST#export_declaration#Left export AST#type_declaration#Left type OnHoverStatusChangeHandler = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left status : AST#type_annotation#Left AST#primary_type#Left HoverModeStatus AST#primary_type#Right AST#type_annotation#Right AST#paramet...
export type OnHoverStatusChangeHandler = (status: HoverModeStatus) => void;
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L294-L294
0dbcb9d71cb0948a29c9a898b624f71806e32e62
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets
arkts
CommentDataSource
List子项评论数据源
@Observed export class CommentDataSource extends BasicDataSource { private commentArray: Comment[] = []; public totalCount(): number { return this.commentArray.length; } /** * 获取指定索引数据 * @param index * @returns */ public getData(index: number): Comment { return this.commentArray[index]; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class CommentDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private commentArray : AST#ty...
@Observed export class CommentDataSource extends BasicDataSource { private commentArray: Comment[] = []; public totalCount(): number { return this.commentArray.length; } public getData(index: number): Comment { return this.commentArray[index]; } public addData(index: number, data: Comment):...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/model/DataModel.ets#L34-L76
2838189f539bf466b8316be9bdf8cb6fc9b07af8
gitee
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/configure/device.ets
arkts
start
@throws
start() { display.getAllDisplayPhysicalResolution().then((resolutions) => { this.displayResolutions = resolutions }) }
AST#method_declaration#Left start 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 AST#member_ex...
start() { display.getAllDisplayPhysicalResolution().then((resolutions) => { this.displayResolutions = resolutions }) }
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/configure/device.ets#L115-L119
091efa865da3b4971b4e2b2d32d9e85496c69994
github
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/common/components/listitem/MessageListItem.ets
arkts
recvMsgLayout
接收消息布局 该布局包含接收文字、图片、视频、语音
@Builder recvMsgLayout(){ Flex({ direction: FlexDirection.Row , justifyContent: FlexAlign.Start}){ //头像 this.header_layout() //消息内容 Flex({ direction: FlexDirection.RowReverse , justifyContent:FlexAlign.End , alignItems:ItemAlign.Center}){ if(this.msgItem.type == msgType.Text){ ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right recvMsgLayout 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 Flex ( AST#component_parameters#Left { AST#component_paramet...
@Builder recvMsgLayout(){ Flex({ direction: FlexDirection.Row , justifyContent: FlexAlign.Start}){ this.header_layout() Flex({ direction: FlexDirection.RowReverse , justifyContent:FlexAlign.End , alignItems:ItemAlign.Center}){ if(this.msgItem.type == msgType.Text){ ...
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/common/components/listitem/MessageListItem.ets#L89-L140
626cf8db7422010f54e93eb510a291eeff945498
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/pages/VideoCoursePage.ets
arkts
getVideoState
获取指定视频的状态
getVideoState(videoId: number): VideoState { return this.videoStates.get(videoId) || { isPlaying: false, currentTime: 0, totalTime: 0, controller: new VideoController() }; }
AST#method_declaration#Left getVideoState AST#parameter_list#Left ( AST#parameter#Left videoId : 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 VideoState AST#primary_t...
getVideoState(videoId: number): VideoState { return this.videoStates.get(videoId) || { isPlaying: false, currentTime: 0, totalTime: 0, controller: new VideoController() }; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/VideoCoursePage.ets#L55-L62
9b84873bfe543fd5925b039e63e517a23228a810
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_defaults.ets
arkts
Default fontSize_Extra for texts. Usually used on titles. @returns 26
export function fontSize_Extra() { return 24; }
AST#export_declaration#Left export AST#function_declaration#Left function fontSize_Extra AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left 24 AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#...
export function fontSize_Extra() { return 24; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_defaults.ets#L11-L13
b0a7f89103e83badac825dd28bd6885b7109c60c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/icon/LogoIcon.ets
arkts
构建 Logo 图标 @returns {void} 无返回值
build(): void { CommonIcon({ icon: $r("app.media.ic_logo"), iconSize: this.iconSize, onTap: this.onTap }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left CommonIcon ( AST#component_parameters#Left { AST#component_parameter#Left icon : AST#expression#Left AST#resource_expression...
build(): void { CommonIcon({ icon: $r("app.media.ic_logo"), iconSize: this.iconSize, onTap: this.onTap }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/LogoIcon.ets#L24-L30
941115aae5591405f20cb4229583efcdbc314ef0
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets
arkts
Chart data operation tool class.
export class ChartDataUtils { /** * Get chart points. * * @param {DataRdb.RdbStore} rdbStore RDB database. * @return Return the steps value of the last three days. */ async getChartPoints(rdbStore: DataRdb.RdbStore) { let chartPoints = await DatabaseUtils.getLastThreeDaysValue(rdbStore).catch((er...
AST#export_declaration#Left export AST#class_declaration#Left class ChartDataUtils AST#class_body#Left { /** * Get chart points. * * @param {DataRdb.RdbStore} rdbStore RDB database. * @return Return the steps value of the last three days. */ AST#method_declaration#Left async getChartPoints AST#parameter_...
export class ChartDataUtils { async getChartPoints(rdbStore: DataRdb.RdbStore) { let chartPoints = await DatabaseUtils.getLastThreeDaysValue(rdbStore).catch((error: Error) => { Logger.error(CommonConstants.TAG_CHART, 'getLastThreeDaysValue error ' + JSON.stringify(error)); }); return chartPoints;...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/StepsCardJS/entry/src/main/ets/common/utils/ChartDataUtils.ets#L28-L128
6f497723b1a90b7579682e3736291968bad01b26
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/PodcastDetailPage.ets
arkts
aboutToAppear
存储所有单集
aboutToAppear() { const params = UIUtils.getParams<Record<string, Object>>(); if (params && params['podcastId']) { this.podcastId = params['podcastId'] as string; this.loadPodcastDetail(); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressio...
aboutToAppear() { const params = UIUtils.getParams<Record<string, Object>>(); if (params && params['podcastId']) { this.podcastId = params['podcastId'] as string; this.loadPodcastDetail(); } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/PodcastDetailPage.ets#L23-L29
f847e31b07b54b5d552fb21625117d6395c4bd82
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets
arkts
setZeroLineColor
Sets the color of the zero line @param color
public setZeroLineColor(color: number): void { this.mZeroLineColor = color; }
AST#method_declaration#Left public setZeroLineColor AST#parameter_list#Left ( AST#parameter#Left color : 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...
public setZeroLineColor(color: number): void { this.mZeroLineColor = color; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/YAxis.ets#L326-L328
76c1bae74a11e66b3e4359f23bc5a58a4105295c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets
arkts
onCreate
[StartExclude save_the_uiContext_to_localstorage_in_entry_ability]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/AcceleratePageAccess/entry3/src/main/ets/entry3ability/Entry3Ability.ets#L28-L30
ca3b17f23aade8475b8ee20fe88005e05f24e60e
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/TaskCallback.ets
arkts
任务回调接口 职责: 1. 定义任务的生命周期回调 2. 所有回调都在主线程执行 @author panruiqi @CreateTime 2025年12月01日
export interface TaskCallback { /** * 任务开始执行 */ onStart(): void; /** * 进度更新 * @param progress 进度值,范围0.0-1.0 */ onProgress(progress: number): void; /** * 任务成功完成 */ onSuccess(): void; /** * 任务失败 */ onFailure(): void; /** * 任务被取消(可选实现) */ onCancelled?(): voi...
AST#export_declaration#Left export AST#interface_declaration#Left interface TaskCallback AST#object_type#Left { /** * 任务开始执行 */ AST#type_member#Left onStart 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 A...
export interface TaskCallback { onStart(): void; onProgress(progress: number): void; onSuccess(): void; onFailure(): void; onCancelled?(): void; onTimeout?(): void; onError?(error: Error): void; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/TaskCallback.ets#L11-L48
b7e7140a9f82ddb9630e9f5b86371112be3b956d
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/passwordInput.ets
arkts
getPageTitle
Get page title @return : page title
getPageTitle(): Resource { let title: Resource = $r('app.string.password_enter_password'); switch (this.passwordType) { case PinSubType.PIN_SIX: case PinSubType.PIN_NUMBER: title = $r('app.string.password_title_number');
AST#method_declaration#Left getPageTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right { AST#ERROR#Left AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left title...
getPageTitle(): Resource { let title: Resource = $r('app.string.password_enter_password'); switch (this.passwordType) { case PinSubType.PIN_SIX: case PinSubType.PIN_NUMBER: title = $r('app.string.password_title_number');
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordInput.ets#L346-L352
d493448678828bc783bc102685b3f705bb75606b
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/EmitterUtils.ets
arkts
unregister
结束订阅事件 @param eventId 事件ID
static unregister(eventId: string) { LogUtils.debug("EmitterUtils unregister", `eventId=${eventId} `) emitter.off(eventId) }
AST#method_declaration#Left static unregister AST#parameter_list#Left ( AST#parameter#Left eventId : 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#builder_function_body#Left { AST#expression_statement#Left AST#ex...
static unregister(eventId: string) { LogUtils.debug("EmitterUtils unregister", `eventId=${eventId} `) emitter.off(eventId) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/EmitterUtils.ets#L59-L62
9341a5c52b526b955325d791193baed019309682
gitee
openharmony-sig/ohos_axios
75d72897982ea6e10fa99c62c62a65425af0a568
entry/src/main/ets/pages/Index.ets
arkts
post
post请求
post() { this.clear() this.showUrl = this.postUrl this.startTime = new Date().getTime(); axios<InfoModel, AxiosResponse<InfoModel>, IdModel>({ url: this.postUrl, method: 'post', data: { id: 591 }, connectTimeout: this.connectTimeout, readTimeout: this.readTim...
AST#method_declaration#Left post 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 this AST#expression#Right . clear AST#member_expression#Rig...
post() { this.clear() this.showUrl = this.postUrl this.startTime = new Date().getTime(); axios<InfoModel, AxiosResponse<InfoModel>, IdModel>({ url: this.postUrl, method: 'post', data: { id: 591 }, connectTimeout: this.connectTimeout, readTimeout: this.readTim...
https://github.com/openharmony-sig/ohos_axios/blob/75d72897982ea6e10fa99c62c62a65425af0a568/entry/src/main/ets/pages/Index.ets#L444-L469
fac56060c0a303d9022bcaca523298d2a8c73086
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
enum for the position of the x-labels relative to the chart
export enum XAxisPosition { TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE, }
AST#export_declaration#Left export AST#enum_declaration#Left enum XAxisPosition AST#enum_body#Left { AST#enum_member#Left TOP AST#enum_member#Right , AST#enum_member#Left BOTTOM AST#enum_member#Right , AST#enum_member#Left BOTH_SIDED AST#enum_member#Right , AST#enum_member#Left TOP_INSIDE AST#enum_member#Right , AST#en...
export enum XAxisPosition { TOP, BOTTOM, BOTH_SIDED, TOP_INSIDE, BOTTOM_INSIDE, }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L129-L135
15757b97b3f38b1bff4fda0eaef6212fb937d023
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets
arkts
refreshData
刷新数据
refreshData() { this.loadData(); }
AST#method_declaration#Left refreshData 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 this AST#expression#Right . loadData AST#member_expr...
refreshData() { this.loadData(); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/home/HomePage.ets#L340-L342
972fb18812022ecf831fbabb8056ef428ac4458f
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/address/AddressCard.ets
arkts
buildRegionText
拼接省市区文本 @param {Address} address - 地址数据 @returns {string} 省市区拼接结果
private buildRegionText(address: Address): string { return `${address.province}${address.city}${address.district}`; }
AST#method_declaration#Left private buildRegionText AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
private buildRegionText(address: Address): string { return `${address.province}${address.city}${address.district}`; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/address/AddressCard.ets#L216-L218
bf7219441b394f506e74a7f58bdd8ac6762c156a
github
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
The tool of local data manager.
export class LocalDataManager { private static localDataManager: LocalDataManager; private shopCartData: Product[] = []; private orderData: Order[] = []; private constructor() { this.initDefaultShopCartData(); this.initDefaultOrderData(); } static instance() { if (!LocalDataManager.localDataMa...
AST#export_declaration#Left export AST#class_declaration#Left class LocalDataManager AST#class_body#Left { AST#property_declaration#Left private static localDataManager : AST#type_annotation#Left AST#primary_type#Left LocalDataManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST...
export class LocalDataManager { private static localDataManager: LocalDataManager; private shopCartData: Product[] = []; private orderData: Order[] = []; private constructor() { this.initDefaultShopCartData(); this.initDefaultOrderData(); } static instance() { if (!LocalDataManager.localDataMa...
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L11-L188
8c5337e0f1c27301c12da650f038f33cf0247b10
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/BundleUtils.ets
arkts
getBundleInfoSync
获取Bundle信息的封装方法
static getBundleInfoSync(): bundleManager.BundleInfo { // 1. 组合标志位(关键修正) const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.Bundl...
AST#method_declaration#Left static getBundleInfoSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left bundleManager . BundleInfo AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 1. 组合标志位(关...
static getBundleInfoSync(): bundleManager.BundleInfo { const bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/BundleUtils.ets#L8-L22
5e1776f0300e7463332ecca50c4bb3e316608e8b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets
arkts
initUIRange
初始化界面
initUIRange(){ this.componentRect = [0, 0, this.componentMaxWidth, this.componentMaxHeight]; this.widthPerSecond = ((this.componentMaxWidth - (this.leftThumbWidth + this.rightThumbWidth))) / this.countRange; this.maxLeftRightPadding = ((this.maxTime * 1.0) / this.countRange) * (this.componentMaxWidth - (th...
AST#method_declaration#Left initUIRange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . componentRect AST#member_expression#Ri...
initUIRange(){ this.componentRect = [0, 0, this.componentMaxWidth, this.componentMaxHeight]; this.widthPerSecond = ((this.componentMaxWidth - (this.leftThumbWidth + this.rightThumbWidth))) / this.countRange; this.maxLeftRightPadding = ((this.maxTime * 1.0) / this.countRange) * (this.componentMaxWidth - (th...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L416-L440
84865eaa20f6f665a1fb752262c000e5f5bea94c
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/IntroductionTitle.ets
arkts
IntroductionTitle
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, softw...
@Component export struct IntroductionTitle { private introduction: Resource = $r('app.string.layout_animation_expansion_align'); build() { Text(this.introduction) .fontSize(18) .width('100%') .direction(Direction.Ltr) .margin({ left: 26, top: 8, bottom: 8 }) .fontColor($r('app.col...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct IntroductionTitle AST#component_body#Left { AST#property_declaration#Left private introduction : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
@Component export struct IntroductionTitle { private introduction: Resource = $r('app.string.layout_animation_expansion_align'); build() { Text(this.introduction) .fontSize(18) .width('100%') .direction(Direction.Ltr) .margin({ left: 26, top: 8, bottom: 8 }) .fontColor($r('app.col...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/common/IntroductionTitle.ets#L16-L28
3ac0753c5b337226397e13ccaff198a86333c9a1
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CartPage.ets
arkts
CartPage
@file 购物车页面视图 @author Joker.X
@ComponentV2 export struct CartPage { /** * 购物车页面 ViewModel */ @Local private vm: CartViewModel = new CartViewModel(); /** * 当前窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * main 页面当前选中的页面索引 */ @Param currentPageIndex: number = 0;...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CartPage AST#component_body#Left { /** * 购物车页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left CartViewMode...
@ComponentV2 export struct CartPage { @Local private vm: CartViewModel = new CartViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); @Param currentPageIndex: number = 0; @Monitor('currentPageIndex') onPageIndexChange() { if (this.currentPageI...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CartPage.ets#L14-L153
cd2a9dfe1bcd16316333689356ef1ce7e2a3315d
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderLogisticsPage.ets
arkts
PageContent
页面内容 @returns {void} 无返回值
@Builder private PageContent(): void { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderLogisticsContent() }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PageContent 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#ui_custom_component_statement#...
@Builder private PageContent(): void { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderLogisticsContent() }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderLogisticsPage.ets#L61-L68
a5ad4d97e20e34a3b0f27328635e82e6f20b1929
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets
arkts
onChange
选项改变回调 @param onChange @returns
onChange(onChange: (value: string | string[], index: number | number[]) => void) { this.builderOptions.onChange = onChange return this }
AST#method_declaration#Left onChange AST#parameter_list#Left ( AST#parameter#Left onChange : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left AST#a...
onChange(onChange: (value: string | string[], index: number | number[]) => void) { this.builderOptions.onChange = onChange return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets#L64-L67
5dc05ea40d52bcfa665e6c0bd84509485d8f6452
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/manager/UpgradeInterface.ets
arkts
倒计时弹框信息 @since 2022-12-01
export interface CountDownDialogInfo { /** * 弹框消息体 */ dialogText: Resource; /** * 弹框类型 */ dialogType: CountDownDialogType; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CountDownDialogInfo AST#object_type#Left { /** * 弹框消息体 */ AST#type_member#Left dialogText : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * 弹框类型 ...
export interface CountDownDialogInfo { dialogText: Resource; dialogType: CountDownDialogType; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/manager/UpgradeInterface.ets#L84-L94
51bc35f390066aef73656e7f26254ec1b257215e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/constraint.ets
arkts
2025-01-05
export const DATE_FORMAT5: string = "HH:mm:ss";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT5 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "HH:mm:ss" AST#expression#Right AST#variable_declarator#Right ; AST#variable_dec...
export const DATE_FORMAT5: string = "HH:mm:ss";
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L12-L12
f8b384b44f73f092becb9a08c9e83670876295a0
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
entry/src/main/ets/pages/Index.ets
arkts
documentPicker
文档选择器,拉起文档选择器不需要申请权限,只能获取选中的文档
documentPicker() { TaoYao.with(this.context) .document() .onSuccess((uris) => { uris.forEach((uri) => { console.log("yunfei", uri) }) }) .onError((err) => { console.log(err.stack) }) .select(new DocumentBuilder() // 选择媒体文件的最大数目 .s...
AST#method_declaration#Left documentPicker 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 AST#...
documentPicker() { TaoYao.with(this.context) .document() .onSuccess((uris) => { uris.forEach((uri) => { console.log("yunfei", uri) }) }) .onError((err) => { console.log(err.stack) }) .select(new DocumentBuilder() .setMaxSelectNum...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/pages/Index.ets#L211-L233
5a0520efb891cccf1cf1ea9601d700f251ba2563
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/markAnchor/NavRouterView.ets
arkts
NavRouterView
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...
@Component export struct NavRouterView { @State isActive: boolean = false @State dex: number = 0 @Link _markAnchor: Position; private componentKey: string; build() { NavRouter() { Row() { Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavRouterView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isActive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an...
@Component export struct NavRouterView { @State isActive: boolean = false @State dex: number = 0 @Link _markAnchor: Position; private componentKey: string; build() { NavRouter() { Row() { Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }) ...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_alignRules02/entry/src/main/ets/MainAbility/view/markAnchor/NavRouterView.ets#L16-L53
19d2181baba0750e66e87ae7bfb3f01402e7bcec
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
handleOrderComment
处理订单评价逻辑 @param {Order} order - 订单信息 @returns {void} 无返回值
handleOrderComment(order: Order): void { this.commentCurrentOrder = null; this.commentCartList = []; const cartList: Cart[] = this.convertOrderGoodsToCart(order); if (cartList.length > 1) { this.commentCurrentOrder = order; this.commentCartList = cartList; this.showCommentModal(); ...
AST#method_declaration#Left handleOrderComment AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order 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#...
handleOrderComment(order: Order): void { this.commentCurrentOrder = null; this.commentCartList = []; const cartList: Cart[] = this.convertOrderGoodsToCart(order); if (cartList.length > 1) { this.commentCurrentOrder = order; this.commentCartList = cartList; this.showCommentModal(); ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderListViewModel.ets#L128-L144
fd0b519cc06d11982d8555b96408cb21d6eced12
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/CustomContentBuilderProxy.ets
arkts
buttonAlignItems
Orientation为VERTICAL时,垂直排列,使用HorizontalAlign; Orientation为HORIZONTAL时,垂直排列,使用VerticalAlign @description 请根据Orientation设置对应值
buttonAlignItems(buttonAlignItems: HorizontalAlign | VerticalAlign) { this.builderOptions.buttonAlignItems = buttonAlignItems; return this; }
AST#method_declaration#Left buttonAlignItems AST#parameter_list#Left ( AST#parameter#Left buttonAlignItems : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left HorizontalAlign AST#primary_type#Right | AST#primary_type#Left VerticalAlign AST#primary_type#Right AST#union_type#Right AST#type_annotation#Rig...
buttonAlignItems(buttonAlignItems: HorizontalAlign | VerticalAlign) { this.builderOptions.buttonAlignItems = buttonAlignItems; return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/CustomContentBuilderProxy.ets#L48-L51
0811654fe8a1ee338e814cd96a4919c19af2c25d
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets
arkts
onSelectItem
选择子菜单 @param item @param hasInputText
async onSelectItem(item: TaskData, hasInputText: boolean = false): Promise<void> { if (hasInputText || item.task !== Tasks.TEXT) { // 只有hasInputText,才是图片素材模式,其他都是贴纸 this.isTextMaterial = hasInputText; this.resourceIndex = 0; this.isCancelQuit = false; if (item.task !== undefined) { ...
AST#method_declaration#Left async onSelectItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TaskData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left hasInputText : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
async onSelectItem(item: TaskData, hasInputText: boolean = false): Promise<void> { if (hasInputText || item.task !== Tasks.TEXT) { this.isTextMaterial = hasInputText; this.resourceIndex = 0; this.isCancelQuit = false; if (item.task !== undefined) { this.currentTask = item.task...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/EditImage.ets#L168-L192
90d106429087a43b4cafa032525a62d493898860
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/guide/GuideService.ets
arkts
isRedDotShown
检查红点是否显示
async isRedDotShown(key: string): Promise<boolean> { try { const redDotKey = `${this.RED_DOT_PREFIX}${key}`; return await StorageManager.getBoolean(redDotKey, false); } catch (error) { Logger.error('GuideService', `Failed to check red dot: ${String(error)}`); return false; } }
AST#method_declaration#Left async isRedDotShown AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
async isRedDotShown(key: string): Promise<boolean> { try { const redDotKey = `${this.RED_DOT_PREFIX}${key}`; return await StorageManager.getBoolean(redDotKey, false); } catch (error) { Logger.error('GuideService', `Failed to check red dot: ${String(error)}`); return false; } }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/guide/GuideService.ets#L104-L112
239ad38789f958d74fd1563a2c68995f7e738504
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets
arkts
resumeTranscoderingProcess
恢复对应的转码流程。
async resumeTranscoderingProcess() { if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) { if (this.avTranscoder != undefined) { // 仅在调用pause返回后调用resume为合理调用。 await this.avTranscoder.resume(); } } }
AST#method_declaration#Left async resumeTranscoderingProcess AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left (...
async resumeTranscoderingProcess() { if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) { if (this.avTranscoder != undefined) { await this.avTranscoder.resume(); } } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets#L100-L106
df03b3a310bf4c6ee9407448c2e41417eaff21f1
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
getTodayTasks
获取今日任务
getTodayTasks(): TaskItem[] { const today = DateUtils.getToday(); return this.tasks.filter(task => { if (task.scheduledDate) { return DateUtils.formatDate(task.scheduledDate) === today; } return DateUtils.isToday(task.createdAt); }); }
AST#method_declaration#Left getTodayTasks AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration#Le...
getTodayTasks(): TaskItem[] { const today = DateUtils.getToday(); return this.tasks.filter(task => { if (task.scheduledDate) { return DateUtils.formatDate(task.scheduledDate) === today; } return DateUtils.isToday(task.createdAt); }); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L417-L425
d5c6c9245683b4bd16908d700bfce395d4ad787c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/Index.ets
arkts
MultipleFilesDownloadComponent
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 { MultipleFilesDownloadComponent } from './src/main/ets/view/MultipleFilesDownload';
AST#export_declaration#Left export { MultipleFilesDownloadComponent } from './src/main/ets/view/MultipleFilesDownload' ; AST#export_declaration#Right
export { MultipleFilesDownloadComponent } from './src/main/ets/view/MultipleFilesDownload';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/Index.ets#L15-L15
c5de5e9b5df897577f9249a56ca49a5d7116f2a5
gitee
SeaEpoch/SepWeather.git
e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c
entry/src/main/ets/common/database/tables/LocationTable.ets
arkts
deleteData
删除
deleteData(location: LocationData, callback: Function) { let predicates = new relationalStore.RdbPredicates(CommonConstants.LOCATION_TABLE.tableName); predicates.equalTo('id', location.id); this.locationTable.deleteData(predicates, callback); }
AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left location : AST#type_annotation#Left AST#primary_type#Left LocationData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#prim...
deleteData(location: LocationData, callback: Function) { let predicates = new relationalStore.RdbPredicates(CommonConstants.LOCATION_TABLE.tableName); predicates.equalTo('id', location.id); this.locationTable.deleteData(predicates, callback); }
https://github.com/SeaEpoch/SepWeather.git/blob/e7b92b462f721fa7d1cc8ebbcda3ecf86f2cca8c/entry/src/main/ets/common/database/tables/LocationTable.ets#L28-L32
7de8afd8157eac381e976ce35104689ad7bea025
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/DrawerLayout.ets
arkts
DrawerBuilder
DrawerLayout
@Builder export function DrawerBuilder(options: DrawerOptions) { DrawerLayout({ options: options }) }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function DrawerBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DrawerOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li...
@Builder export function DrawerBuilder(options: DrawerOptions) { DrawerLayout({ options: options }) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/DrawerLayout.ets#L6-L9
790f959797327d932677ba011af8d4efba87ab6a
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets
arkts
Defines the suffix icon option. @interface SuffixIconOptions @extends IconCommonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Defines the suffix icon option. @interface SuffixIconOptions @extends IconCommonOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @...
export interface SuffixIconOptions extends IconCommonOptions { /** * Called when the suffix icon is clicked. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Called when the suffix icon is clicked. * * @type ...
AST#export_declaration#Left export AST#interface_declaration#Left interface SuffixIconOptions AST#extends_clause#Left extends IconCommonOptions AST#extends_clause#Right AST#object_type#Left { /** * Called when the suffix icon is clicked. * * @type { ?function } * @syscap SystemCapability.ArkUI.ArkUI...
export interface SuffixIconOptions extends IconCommonOptions { action?: () => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets#L173-L192
6e61a33c2b3439c77538ed44a8e878bf2336f1ad
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets
arkts
getFamilyById
根据用户id,查询家庭信息
static async getFamilyById(userId: string) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/family/userId/${userId}`, { method: RequestMethod.GET, header: { 'Content-Type': 'application/json' },...
AST#method_declaration#Left static async getFamilyById AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_de...
static async getFamilyById(userId: string) { let httpRequest = http.createHttp(); let data = await httpRequest.request( `${DistScheduleService.distScheduleServer}/family/userId/${userId}`, { method: RequestMethod.GET, header: { 'Content-Type': 'application/json' },...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L336-L358
2ed5c80e97ff4842c01df4e07c13e09efb8a259b
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets
arkts
Defines chipItem options. @interface ChipGroupItemOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ChipGroupItemOptions { /** * Prefix icon. * * @type { ?IconOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ prefixIcon?: IconOptions; /** * Prefix symbol. * * @type { ?ChipSymbolGlyp...
AST#export_declaration#Left export AST#interface_declaration#Left interface ChipGroupItemOptions AST#object_type#Left { /** * Prefix icon. * * @type { ?IconOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#type_member#Left ...
export interface ChipGroupItemOptions { prefixIcon?: IconOptions; prefixSymbol?: ChipSymbolGlyphOptions; label: LabelOptions; suffixIcon?: IconOptions; suffixSymbol?: ChipSymbolGlyphOptions; allowClose?: boolean; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets#L82-L143
8453c3fa392861cbb063129f7347163dfa535fc9
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/model/TextInputOptions.ets
arkts
TODO 输入弹出框,参数类 author: 桃花镇童长老ᥫ᭡ since: 2024/08/18
export interface TextInputOptions extends BaseInputOptions { inputType?: InputType; //输入框类型。默认值:InputType.Normal showPassword?: boolean; //是否显示密码(inputType为InputType.Password起作用) showPasswordIcon?: boolean; //是否显示密码图标(inputType为InputType.Password起作用) passwordIcon?: PasswordIcon; //设置当密码输入模式时,输入框末尾的图标。支持jpg、png...
AST#export_declaration#Left export AST#interface_declaration#Left interface TextInputOptions AST#extends_clause#Left extends BaseInputOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left inputType ? : AST#type_annotation#Left AST#primary_type#Left InputType AST#primary_type#Right AST#type_annota...
export interface TextInputOptions extends BaseInputOptions { inputType?: InputType; showPassword?: boolean; showPasswordIcon?: boolean; passwordIcon?: PasswordIcon; passwordRules?: string; cancelButton?: CancelButtonOptions; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/TextInputOptions.ets#L23-L32
d25f0a0ba6aefe339b4347b292dade0edda83e40
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/common/database/Tables/AccountingInfoApi.ets
arkts
queryAllDate
查询所有记账记录
queryAllDate(callback): void { RdbUtils.queryAll(Const.ACCOUNTING_INFO.tableName).then(resultSet => { let count = resultSet.rowCount; if (count <= 0) { const result: AccountingInfo[] = []; callback(result); } else { resultSet.goToFirstRow(); const result: Acco...
AST#method_declaration#Left queryAllDate AST#parameter_list#Left ( AST#parameter#Left callback AST#parameter#Right ) 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#expressi...
queryAllDate(callback): void { RdbUtils.queryAll(Const.ACCOUNTING_INFO.tableName).then(resultSet => { let count = resultSet.rowCount; if (count <= 0) { const result: AccountingInfo[] = []; callback(result); } else { resultSet.goToFirstRow(); const result: Acco...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/common/database/Tables/AccountingInfoApi.ets#L37-L62
9cd5cd3eb93338c935b106c4314f344c6fda259e
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initializeManagers
初始化应用管理器 按顺序初始化所有管理器 确保数据从持久化存储加载到 AppStorage
private async initializeManagers(): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Initializing managers...'); // 1. 初始化 PreferenceManager(必须先初始化,因为其他管理器依赖它) const preferenceManager = PreferenceManager.getInstance(); await preferenceManager.initialize(this.context); hilog.info(DOMAIN,...
AST#method_declaration#Left private async initializeManagers 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 ...
private async initializeManagers(): Promise<void> { try { hilog.info(DOMAIN, TAG, 'Initializing managers...'); const preferenceManager = PreferenceManager.getInstance(); await preferenceManager.initialize(this.context); hilog.info(DOMAIN, TAG, 'PreferenceManager initialized'); ...
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/entryability/EntryAbility.ets#L26-L68
9f655f22727a9ae1b58f1659d760119736b2a0fb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mainpage/CommentPage.ets
arkts
CommentPage
字体粗细
@Component export struct CommentPage { // 评论 @State commonData: CommentModel = new CommentModel("", "", "", "", "", "", new Date(), new CommentData()); // 评论中的文字 @Link replyId: string; // 回复人昵称 @Link replyUser: string; // 当前用户 @State curUser: string = ""; // 评论输入弹窗 dialogController: CustomDialogCont...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommentPage AST#component_body#Left { // 评论 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right commonData : AST#type_annotation#Left AST#primary_type#Left CommentModel AST#primary_type#Right ...
@Component export struct CommentPage { @State commonData: CommentModel = new CommentModel("", "", "", "", "", "", new Date(), new CommentData()); 中的文字 @Link replyId: string; @Link replyUser: string; @State curUser: string = ""; 输入弹窗 dialogController: CustomDialogController | null = null; build...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textoverflow/src/main/ets/components/mainpage/CommentPage.ets#L21-L177
b8a0c3026440724bd2cc2d178f84af508c571fdc
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
arkts
区名
constructor(code: string = '', name: string = '') { this.code = code; this.name = name; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left name : AST#type_annotation#Left A...
constructor(code: string = '', name: string = '') { this.code = code; this.name = name; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L66-L69
4c824226c489288feef40e6d8c82d9a54bbd6bc5
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/utils/WindowUtil.ets
arkts
setAvoidArea
Get status bar height and indicator height.
private static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void { try { let uiContext: UIContext = WindowUtil.windowClass.getUIContext(); if (type === window.AvoidAreaType.TYPE_SYSTEM) { AppStorage.setOrCreate(CommonConstants.AS_KEY_STATUS_BAR_HEIGHT, uiContext.px2vp(area.t...
AST#method_declaration#Left private static setAvoidArea AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . AvoidAreaType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left are...
private static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void { try { let uiContext: UIContext = WindowUtil.windowClass.getUIContext(); if (type === window.AvoidAreaType.TYPE_SYSTEM) { AppStorage.setOrCreate(CommonConstants.AS_KEY_STATUS_BAR_HEIGHT, uiContext.px2vp(area.t...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/utils/WindowUtil.ets#L69-L80
8119b5b913b8992761dcb23b10644ecd268a94be
gitee
2763981847/Accounting-app.git
cf8302a42588ecce1561b82e8533798157157257
entry/src/main/ets/view/DateSelectComponent.ets
arkts
DateSelectComponent
定义日期选择组件
@Component export default struct DateSelectComponent { @Link endDate: number; @Link beginDate: number; @State selectedIndex: number = 0; private dateSelectDialog: CustomDialogController = new CustomDialogController({ builder: DateSelectDialog({ beginDate: this.beginDate, endDate: this.endDate, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DateSelectComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right endDate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ...
@Component export default struct DateSelectComponent { @Link endDate: number; @Link beginDate: number; @State selectedIndex: number = 0; private dateSelectDialog: CustomDialogController = new CustomDialogController({ builder: DateSelectDialog({ beginDate: this.beginDate, endDate: this.endDate, ...
https://github.com/2763981847/Accounting-app.git/blob/cf8302a42588ecce1561b82e8533798157157257/entry/src/main/ets/view/DateSelectComponent.ets#L101-L156
a82d43760c79d8a3904da96b0d77eaacc1450d3c
github
IceTeacher/DrawingBook.git
c101a1b904388fcfa72de1ff402307bb9036b68b
entry/src/main/ets/pages/BookListPage.ets
arkts
onPageHide
生命周期钩子,页面隐藏时
onPageHide(): void { // 销毁音频对象 this.avPlayer?.pause() this.avPlayer?.release() this.currentPlayAudioItemState.playMode = false this.currentPlayAudioItemState.isShowPlayBar = false }
AST#method_declaration#Left onPageHide 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#exp...
onPageHide(): void { this.avPlayer?.pause() this.avPlayer?.release() this.currentPlayAudioItemState.playMode = false this.currentPlayAudioItemState.isShowPlayBar = false }
https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookListPage.ets#L65-L71
fb69bbe0e716669efccf1c608425c18062f8a8f9
github
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/RequestConfig.ets
arkts
getUsingProxy
Getter and setter for usingProxy
getUsingProxy(): http.HttpProxy | undefined { return this.usingProxy; }
AST#method_declaration#Left getUsingProxy AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left http . HttpProxy AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_...
getUsingProxy(): http.HttpProxy | undefined { return this.usingProxy; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/RequestConfig.ets#L31-L33
59675d3a835e71568297b0764d03c69c798266db
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/sorting/MergeSort.ets
arkts
mergeSort
归并排序的递归实现 @param arr 需要排序的数组 @param left 左边界 @param right 右边界
private static mergeSort(arr: number[], left: number, right: number): void { if (left < right) { const mid = Math.floor((left + right) / 2); // 递归排序左半部分 MergeSort.mergeSort(arr, left, mid); // 递归排序右半部分 MergeSort.mergeSort(arr, mid + 1, right); // 合并两个有序数组 MergeSort.m...
AST#method_declaration#Left private static mergeSort AST#parameter_list#Left ( AST#parameter#Left arr : 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 left : AST#type_annotation#...
private static mergeSort(arr: number[], left: number, right: number): void { if (left < right) { const mid = Math.floor((left + right) / 2); MergeSort.mergeSort(arr, left, mid); MergeSort.mergeSort(arr, mid + 1, right); MergeSort.merge(arr, left, mid, right); ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/MergeSort.ets#L22-L33
b8917c372704e62f9d893ed5fa73a64e6fb87fd2
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets
arkts
setPosition
sets the position of the x-labels @param pos
public setPosition(pos: XAxisPosition): void { this.mPosition = pos; }
AST#method_declaration#Left public setPosition AST#parameter_list#Left ( AST#parameter#Left pos : AST#type_annotation#Left AST#primary_type#Left XAxisPosition 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...
public setPosition(pos: XAxisPosition): void { this.mPosition = pos; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/XAxis.ets#L86-L88
313269616e7df31948dc8e5d6da42be90ec447d5
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
getCartItems
获取购物车商品列表
getCartItems(): CartItem[] { return [...this.cartItems]; }
AST#method_declaration#Left getCartItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CartItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left re...
getCartItems(): CartItem[] { return [...this.cartItems]; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L121-L123
56fb66f70aa78948b0da5210d8bc505747234d1c
github