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
openharmony/xts_tools
784a2e99d894e6bc2aba8c38f6bb68032442b1c8
sample/AppSampleD/entry/src/main/ets/component/MessageComponent.ets
arkts
aboutToAppear
对端用户信息
aboutToAppear(){ // globalThis.oppositeUser = new User('13222222222',$r('app.media.ic_headphoto_2')); if (AppStorage.get("currentUser")) { this.currentUser = AppStorage.get("currentUser")!; } if (AppStorage.get("oppositeUser")) { this.oppositeUser = AppStorage.get("oppositeUser")!; //...
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // globalThis.oppositeUser = new User('13222222222',$r('app.media.ic_headphoto_2')); AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#exp...
aboutToAppear(){ if (AppStorage.get("currentUser")) { this.currentUser = AppStorage.get("currentUser")!; } if (AppStorage.get("oppositeUser")) { this.oppositeUser = AppStorage.get("oppositeUser")!; this.userArr[0].setUsername(this.oppositeUser?.getUsername()); this.userA...
https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/component/MessageComponent.ets#L32-L44
268146bc9da450da74272ccd8ee43f4a0c2bb7ef
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/ScanUtil.ets
arkts
decodeImage
调用图像数据识码能力,使用Promise异步回调返回识码结果 @param image 待识别的图像数据 @param options 启动图像数据识码参数 scanTypes 设置扫码类型,默认扫码ALL(全部码类型)。 enableMultiMode 是否开启多码识别,默认false。true:多码识别、false:单码识别。 enableAlbum 是否开启相册,默认true。true-开启相册扫码、false-关闭相册扫码。 @returns
static async decodeImage(image: detectBarcode.ByteImage, options?: scanBarcode.ScanOptions): Promise<detectBarcode.DetectResult> { if (options === undefined) { options = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: false }; } return await detectBarcode.decodeImage(imag...
AST#method_declaration#Left static async decodeImage AST#parameter_list#Left ( AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left detectBarcode . ByteImage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left op...
static async decodeImage(image: detectBarcode.ByteImage, options?: scanBarcode.ScanOptions): Promise<detectBarcode.DetectResult> { if (options === undefined) { options = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: false }; } return await detectBarcode.decodeImage(imag...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/ScanUtil.ets#L105-L111
072ae844391590d31b6742ebccf49681b1556340
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/HelpDescription.ets
arkts
popupBuilder
popup构造器定义弹框内容
@Builder popupBuilder() { Column() { Text(this.info).fontSize($r('app.integer.image_compression_font_size_fourteen')) } .justifyContent(FlexAlign.SpaceAround) .padding($r('app.integer.image_compression_padding_thirteen')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right popupBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_ele...
@Builder popupBuilder() { Column() { Text(this.info).fontSize($r('app.integer.image_compression_font_size_fourteen')) } .justifyContent(FlexAlign.SpaceAround) .padding($r('app.integer.image_compression_padding_thirteen')) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/HelpDescription.ets#L25-L32
62adaa984afef49eda444746f19cacdd6e93ad43
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ResponsiveLayout/entry/src/main/ets/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * Prepared state of avPlayer. */ static readonly AV_PLAYER_PLAYING_STATE: string = 'playing'; /** * Pause state of avPlayer. */ static readonly AV_PLAYER_PAUSED_STATE: string = 'paused'; /** * Stopped state of avPlayer. */ static readonly AV_PLAYER_STOPPE...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Prepared state of avPlayer. */ AST#property_declaration#Left static readonly AV_PLAYER_PLAYING_STATE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Ri...
export class CommonConstants { static readonly AV_PLAYER_PLAYING_STATE: string = 'playing'; static readonly AV_PLAYER_PAUSED_STATE: string = 'paused'; static readonly AV_PLAYER_STOPPED_STATE: string = 'stopped'; static readonly WINDOW_UTIL: string = 'windowUtil'; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ResponsiveLayout/entry/src/main/ets/constants/CommonConstants.ets#L19-L36
f156eb9188633867b03df9c0d3248a16e39eb3c5
gitee
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets
arkts
GetWindowProperties
获取窗口的宽度和长度
async GetWindowProperties() { //获取窗口对象 let windowClass = await window.getLastWindow(this.context) //获取窗口属性 let properties = windowClass.getWindowProperties(); //获取窗口宽高 console.log("width: "+ String(properties.windowRect.width)); console.log("height: "+ String(properties.windowRect.height)); ...
AST#method_declaration#Left async GetWindowProperties AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { //获取窗口对象 AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left windowClass = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expre...
async GetWindowProperties() { let windowClass = await window.getLastWindow(this.context) let properties = windowClass.getWindowProperties(); console.log("width: "+ String(properties.windowRect.width)); console.log("height: "+ String(properties.windowRect.height)); this.Windowwidth=Str...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/window_demo/window_demo0/entry/src/main/ets/pages/Index.ets#L97-L107
51abe5ddc6abab849278fdcf29edf5b2df2d3b2b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/view/ContributorsPage.ets
arkts
构建贡献者页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "贡献者", viewModel: this.vm }) { this.ContributorsContent(); } }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left "贡献者" AST#expression#Right AST#component_parameter#Right , AST#component_p...
build() { AppNavDestination({ title: "贡献者", viewModel: this.vm }) { this.ContributorsContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/ContributorsPage.ets#L20-L27
79c2a3a74eca8eefad3e72bbeb7e957f1e8a2d8f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/nativerawfile/Index.ets
arkts
preloadSOByTaskPool
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 { preloadSOByTaskPool } from './src/main/ets/utils/TaskPool';
AST#export_declaration#Left export { preloadSOByTaskPool } from './src/main/ets/utils/TaskPool' ; AST#export_declaration#Right
export { preloadSOByTaskPool } from './src/main/ets/utils/TaskPool';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/nativerawfile/Index.ets#L16-L16
bbceff41fa34bfc46c4daea0bf80182351243e59
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_bookmarks.ets
arkts
import_html
Imports HTML format bookmarks to bunch_of_bookmarks, allowing to either overwrite totally or add to root. If overwrite is set true then removes whatever was previously in this bunch_of_bookmarks. @param html The string of .html format bookmarks. @param overwrite Set false in default. @returns -1 for no <H3> error. @re...
import_html(html: string, overwrite?: boolean) { let t0 = Date.now(); let overwrite_data = false; if (overwrite !== undefined) { overwrite_data = overwrite; } // Set overwrite options // let one_line_data: string = html.replace(/\s*\n+\s*/g, "") // Eliminate all returns // one_line_d...
AST#method_declaration#Left import_html AST#parameter_list#Left ( AST#parameter#Left html : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left overwrite ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
import_html(html: string, overwrite?: boolean) { let t0 = Date.now(); let overwrite_data = false; if (overwrite !== undefined) { overwrite_data = overwrite; } let one_line_data: string = html.replace(/<p>|<DT>|<DL>|<\/A>|<\/H3>|\s*\n+\s*/g, ''); one_li...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_bookmarks.ets#L381-L481
c895c43765ff9bbfe7f05292110d0edf468c4982
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/select/Cascade.ets
arkts
cascadeUnderLine
下划线样式
@Extend(Text) function cascadeUnderLine(selected: boolean) { .height(UiConst.VP_3) .backgroundColor(selected ? "#1989fa" : "fff") .width(UiConst.VP_45) .margin({ top: UiConst.NUMBER_5 }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function cascadeUnderLine AST#parameter_list#Left ( AST#parameter#Left selected : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Ri...
@Extend(Text) function cascadeUnderLine(selected: boolean) { .height(UiConst.VP_3) .backgroundColor(selected ? "#1989fa" : "fff") .width(UiConst.VP_45) .margin({ top: UiConst.NUMBER_5 }) }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/select/Cascade.ets#L26-L32
071525a9fd1b96b067ee9402ac55afd4596aff55
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/util/WsUtil.ets
arkts
@Author csx @DateTime 2024/3/10 21:43 @TODO WsUtil websocket工具类
export class WsUtil { private static ws = webSocket.createWebSocket(); /** * 连接websocket * @param ip 需要连接的IP(必填) * @param headers 连接时的请求头参数(非必填) */ static connect(ip: string, headers?: Record<string, string>): void { if (!ip) { Logger.error("请输入IP"); return; } let head: Reco...
AST#export_declaration#Left export AST#class_declaration#Left class WsUtil AST#class_body#Left { AST#property_declaration#Left private static ws = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left webSocket AST#expression#Right . createWebSocket AST#member_e...
export class WsUtil { private static ws = webSocket.createWebSocket(); static connect(ip: string, headers?: Record<string, string>): void { if (!ip) { Logger.error("请输入IP"); return; } let head: Record<string, Record<string, string>> = {} if (headers) { head.header = headers; ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/util/WsUtil.ets#L25-L50
bef3d75a9279b7b4690fc011adff62918f7a3090
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets
arkts
数据库访问器 private db: DBAccessor | null = null;
private constructor(){ super();}
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left super AST#expression#Right AST#argument_list#Left ( ) AST#argument_list#R...
private constructor(){ super();}
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L37-L37
f232353715a5e6d56bcb02c0b5df2d9761cf5f0c
github
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
firePropertiesChanged
触发属性变化,SDK会上报变化的属性 @param serviceId 服务id @param properties 属性列表
public firePropertiesChanged(serviceId: string, properties?: string[]): void { const deviceService = this.getService(serviceId); if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) { return; } const props = deviceService.onRead(properties); const serv...
AST#method_declaration#Left public firePropertiesChanged AST#parameter_list#Left ( AST#parameter#Left serviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left properties ? : AST#type_annotation#Left AST#primary_type#Left ...
public firePropertiesChanged(serviceId: string, properties?: string[]): void { const deviceService = this.getService(serviceId); if (deviceService === null || deviceService === undefined || deviceService.serviceId === null) { return; } const props = deviceService.onRead(properties); const serv...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets#L228-L244
44da2ed6c8bee88cc190bfd75d097e2351234e43
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/LocalSocketWorker.ets
arkts
startLocalSocket
[Start application_transmits_data_via_local_socket] 启动本地 Socket 客户端
function startLocalSocket(address: string, timeout: number, closeTime: number): void { let client: socket.LocalSocket = socket.constructLocalSocketInstance(); client.on('message', (value: socket.LocalSocketMessageInfo) => { const uintArray = new Uint8Array(value.message); let messageView = ''; for (let...
AST#function_declaration#Left function startLocalSocket AST#parameter_list#Left ( AST#parameter#Left address : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeout : AST#type_annotation#Left AST#primary_type#Left number A...
function startLocalSocket(address: string, timeout: number, closeTime: number): void { let client: socket.LocalSocket = socket.constructLocalSocketInstance(); client.on('message', (value: socket.LocalSocketMessageInfo) => { const uintArray = new Uint8Array(value.message); let messageView = ''; for (let...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/workers/LocalSocketWorker.ets#L53-L94
f56a041ec219f933857118bf3824f9106a663750
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/todo/TodoService.ets
arkts
updateTodo
更新代办事项
async updateTodo(params: UpdateTodoParams): Promise<Todo | null> { try { const index = this.todos.findIndex(todo => todo.id === params.id); if (index === -1) { return null; } const oldTodo = this.copyTodo(this.todos[index]); const changes: ChangeRecord = {} as ChangeRecord; ...
AST#method_declaration#Left async updateTodo AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left UpdateTodoParams 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_...
async updateTodo(params: UpdateTodoParams): Promise<Todo | null> { try { const index = this.todos.findIndex(todo => todo.id === params.id); if (index === -1) { return null; } const oldTodo = this.copyTodo(this.todos[index]); const changes: ChangeRecord = {} as ChangeRecord; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L194-L261
7406c3b06a914526023b8e81517614c81a2ae995
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/mock/MockData.ets
arkts
点击图标种类列表mock数据
export const ICON_LIST: Array<Resource> = [$r('app.media.click_animation_heart'), $r('app.media.click_animation_flower'), $r('app.media.click_animation_pear'), $r('app.media.click_animation_cherries'), $r('app.media.click_animation_banana')];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ICON_LIST : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right > ...
export const ICON_LIST: Array<Resource> = [$r('app.media.click_animation_heart'), $r('app.media.click_animation_flower'), $r('app.media.click_animation_pear'), $r('app.media.click_animation_cherries'), $r('app.media.click_animation_banana')];
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/mock/MockData.ets#L28-L30
58f58fe0c4fe9a869ee2eaf46a3125422b8cbd29
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
common/src/main/ets/manager/UpgradeInterface.ets
arkts
升级控制接口 @since 2022-12-01
export interface IUpgradeControl { /** * 升级UX */ page: IPage, /** * 升级提醒 */ notify: INotify }
AST#export_declaration#Left export AST#interface_declaration#Left interface IUpgradeControl AST#object_type#Left { /** * 升级UX */ AST#type_member#Left page : AST#type_annotation#Left AST#primary_type#Left IPage AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right , /** * 升级提醒 */ AST#type_me...
export interface IUpgradeControl { page: IPage, notify: INotify }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/common/src/main/ets/manager/UpgradeInterface.ets#L25-L35
916a5bef0fa4a8495c813ba09807c61b87461b57
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets
arkts
onTouchEvent
touch事件触发后绘制手指移动轨迹
onTouchEvent(event: TouchEvent): void { // 获取手指触摸位置的坐标点 const positionX: number = vp2px(event.touches[0].x); const positionY: number = vp2px(event.touches[0].y); switch (event.type) { case TouchType.Down: { this.isShowPalette = false; // 隐藏调色板 // TODO:知识点:使用hexToRgb转换函数将当前选中的HEX类型颜...
AST#method_declaration#Left onTouchEvent AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left TouchEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
onTouchEvent(event: TouchEvent): void { const positionX: number = vp2px(event.touches[0].x); const positionY: number = vp2px(event.touches[0].y); switch (event.type) { case TouchType.Down: { this.isShowPalette = false; const rgb: RgbType | null = hexToRgb(this.selectedCo...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/pages/PaletteMainPage.ets#L68-L103
54e01abab135fd7315ac7f13d47ca2d8b478b313
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the Distribution OS release type. <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS release type. distributionOSVersion will return the ISV OS release type If ISV not specified, it will return the same value as osReleaseType @syscap SystemCapability.Startup.SystemInfo @since 20 @arkts...
static get distributionOSReleaseType(): string;
AST#method_declaration#Left static get AST#ERROR#Left distributionOSRele as e Type AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get distributionOSReleaseType(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L445-L445
0c81dd669756031758b5ec8bd3ef8a9e8ac27b9b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GlobalTypes.ets
arkts
选择项接口
export interface SelectOption<T = string> { label: string; value: T; disabled?: boolean; selected?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SelectOption AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left...
export interface SelectOption<T = string> { label: string; value: T; disabled?: boolean; selected?: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GlobalTypes.ets#L106-L111
efae29066f129181b8a94f3ea2777b8249e1a19a
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/ThemeManager.ets
arkts
主题模型接口
export interface ThemeModel { type: string; name: string; description: string; colors: ThemeColors; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeModel AST#object_type#Left { AST#type_member#Left type : 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 name : AST#type_annotation#Left AS...
export interface ThemeModel { type: string; name: string; description: string; colors: ThemeColors; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L20-L25
f7396dbe4e6125534c89bce9653e018edd335f6d
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Returns the web state directory for saving. @param storage The LocalStorage of window. @returns The directory or undefined (if is neither a zone nor lord window).
export function web_state_dir(storage: LocalStorage) { let alias = storage.get('my_window_alias') as string; let is_zone = storage.get('is_zone') as boolean; if (is_zone) { return 'zones/' + alias; } // Not zone, check if is lord let is_lord = (storage.get('my_window_id') as string) == (AppStorage.get('...
AST#export_declaration#Left export AST#function_declaration#Left function web_state_dir AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#L...
export function web_state_dir(storage: LocalStorage) { let alias = storage.get('my_window_alias') as string; let is_zone = storage.get('is_zone') as boolean; if (is_zone) { return 'zones/' + alias; } let is_lord = (storage.get('my_window_id') as string) == (AppStorage.get('THE_LORD_OF_THE_WINDOWS') as ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L213-L226
05f03d8f3de5ae633d6d13a601fff48d9aed3486
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
createPreviewOutputFn
Creates the previewOutput output object
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile, surfaceId: string): camera.PreviewOutput | undefined { let previewOutput: camera.PreviewOutput; try { previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId); Logger.info(TAG, `c...
AST#method_declaration#Left createPreviewOutputFn AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ...
createPreviewOutputFn(cameraManager: camera.CameraManager, previewProfileObj: camera.Profile, surfaceId: string): camera.PreviewOutput | undefined { let previewOutput: camera.PreviewOutput; try { previewOutput = cameraManager.createPreviewOutput(previewProfileObj, surfaceId); Logger.info(TAG, `c...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L348-L360
51e7ed19b897d0da6fc20056b648c59352a777c9
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/rephone.ets
arkts
getUserData
从数据库获取用户数据
async getUserData(): Promise<void> { try { this.isLoading = true; const httpRequest = http.createHttp(); const response = await httpRequest.request( `${this.serverUrl}/api/user/${this.userId}`, { method: http.RequestMethod.GET, header: { 'Content-Typ...
AST#method_declaration#Left async getUserData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argu...
async getUserData(): Promise<void> { try { this.isLoading = true; const httpRequest = http.createHttp(); const response = await httpRequest.request( `${this.serverUrl}/api/user/${this.userId}`, { method: http.RequestMethod.GET, header: { 'Content-Typ...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/rephone.ets#L45-L78
9f878444699a484c98149206bb2448cd9aece516
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets
arkts
接收人的号码
constructor(contactsName: string, telephone: string) { this.contactsName = contactsName; this.telephone = telephone; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left contactsName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left telephone : AST#type_annotation#Left AST#primary_type#Left string AST#p...
constructor(contactsName: string, telephone: string) { this.contactsName = contactsName; this.telephone = telephone; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/sendmessage/src/main/ets/components/mainpage/MessageView.ets#L15-L18
2d7e57f6bf9b65400e8aa2d4227b101c299ab2e9
gitee
linhanlove/hormany-os-notion
a65f47bfc1a2bbce531b9af97831eb1ba934c2f8
entry/src/main/ets/view/SplashPage.ets
arkts
aboutToDisappear
销毁定时器
aboutToDisappear() { clearTimeout(this.timer) }
AST#method_declaration#Left aboutToDisappear 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 clearTimeout ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Righ...
aboutToDisappear() { clearTimeout(this.timer) }
https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/view/SplashPage.ets#L65-L67
c35b85a31762b2c457c88d46a9887361a65e996f
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Camera/entry/src/main/ets/pages/Camera.ets
arkts
rotationChange
旋转角度改变监听方法
rotationChange() { Logger.info(TAG, `rotationChange begin ${this.rotation}`); // 0° if (this.rotation == 0) { Logger.info(TAG, `rotationChange ${this.rotation}`); this.cameraModel.setImageRotation(camera.ImageRotation.ROTATION_0); // 90° } else if (this.rotation == 1) { Logger.in...
AST#method_declaration#Left rotationChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right . info AST#member_exp...
rotationChange() { Logger.info(TAG, `rotationChange begin ${this.rotation}`); if (this.rotation == 0) { Logger.info(TAG, `rotationChange ${this.rotation}`); this.cameraModel.setImageRotation(camera.ImageRotation.ROTATION_0); } else if (this.rotation == 1) { Logger.info(TAG, `ro...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Camera/entry/src/main/ets/pages/Camera.ets#L59-L79
46a98b000bca8981bff8b3e76904cd6f663a886d
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
activatePermission
对已经持久化授权的权限进行使能操作,否则已经持久化授权的权限仍存在不能使用的情况。(需要权限:ohos.permission.FILE_ACCESS_PERSIST) @returns 无返回结果的Promise对象。
static async activatePermission(policies: Array<fileShare.PolicyInfo>): Promise<void> { return fileShare.activatePermission(policies); }
AST#method_declaration#Left static async activatePermission AST#parameter_list#Left ( AST#parameter#Left policies : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fileShare . PolicyInfo AST#quali...
static async activatePermission(policies: Array<fileShare.PolicyInfo>): Promise<void> { return fileShare.activatePermission(policies); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L962-L964
ee00d9ae946233cf2a23a9b088247836c0be6e0c
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets
arkts
declaring interface, enum, class
export interface GridObjectSortComponentItem { id: number | string; text: ResourceStr; selected: boolean; order: number; url?: ResourceStr; symbolStyle?:SymbolGlyphModifier; visibility?: Visibility; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GridObjectSortComponentItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#R...
export interface GridObjectSortComponentItem { id: number | string; text: ResourceStr; selected: boolean; order: number; url?: ResourceStr; symbolStyle?:SymbolGlyphModifier; visibility?: Visibility; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets#L95-L103
5c2f4f9b88a85d2ab9b529997e4dd69a1f3722e0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
游戏结果接口
export interface GameResult { session: GameSession; isWin: boolean; finalScore: number; performance: GamePerformance; rewards: GameReward[]; statistics: GameStatistics; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GameResult AST#object_type#Left { AST#type_member#Left session : AST#type_annotation#Left AST#primary_type#Left GameSession AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left isWin : AST#type_annotatio...
export interface GameResult { session: GameSession; isWin: boolean; finalScore: number; performance: GamePerformance; rewards: GameReward[]; statistics: GameStatistics; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L87-L94
a55f4258ad0437e3c044736c1e717fa913f6422e
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
[End stage_creat]
onWindowStageDestroy(): void { // Main window is destroyed, release UI related resources Logger.info(TAG, `Ability onWindowStageDestroy`); }
AST#method_declaration#Left onWindowStageDestroy 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 { // Main window is destroyed, release UI related resources AST#expression_statement...
onWindowStageDestroy(): void { Logger.info(TAG, `Ability onWindowStageDestroy`); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/entryability/EntryAbility.ets#L66-L69
6d0b6e7b9147bb3c30414ea6c0080370878ab438
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
generateAESKey128
生成AES的对称密钥-128位-默认base64 @param resultCoding 生成AES秘钥的字符串格式(hex/base64)-默认不传为base64格式 @returns AES密钥-128位
static generateAESKey128(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('AES128', resultCoding); }
AST#method_declaration#Left static generateAESKey128 AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#exp...
static generateAESKey128(resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.generateSymKey('AES128', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L70-L72
29bc5dd6e5ca6e0a37ace0d097f6d4c205ac5c35
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
onTabChange
Tab页面切换处理 @param index 选中的Tab索引
private onTabChange(index: number): void { this.currentTabIndex = index; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Tab changed to: ${index}`); }
AST#method_declaration#Left private onTabChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
private onTabChange(index: number): void { this.currentTabIndex = index; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Tab changed to: ${index}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L153-L156
79f54849880c167588d8f6266447ea58418e4be9
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/entryability/EntryAbility.ets
arkts
cleanupBackupManager
清理备份管理器
private cleanupBackupManager(): void { try { const backupManager = SimpleBackupManager.getInstance(); backupManager.destroy(); hilog.info(0x0000, 'EntryAbility', 'Backup manager cleaned up successfully'); } catch (error) { hilog.error(0x0000, 'EntryAbility', 'Failed to cleanup backup man...
AST#method_declaration#Left private cleanupBackupManager 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#try_statement#Left try AST#block_statement#Left { AST#sta...
private cleanupBackupManager(): void { try { const backupManager = SimpleBackupManager.getInstance(); backupManager.destroy(); hilog.info(0x0000, 'EntryAbility', 'Backup manager cleaned up successfully'); } catch (error) { hilog.error(0x0000, 'EntryAbility', 'Failed to cleanup backup man...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/entryability/EntryAbility.ets#L85-L93
d5efb17b5b3849d703975004feec42bbb44852f7
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/modal/OrderGoodsModal.ets
arkts
OrderGoodsItem
订单商品条目 @param {Cart} cart - 购物车商品数据 @returns {void} 无返回值
@Builder private OrderGoodsItem(cart: Cart): void { Card({ paddingValue: $r("app.float.space_padding_medium") }) { RowStartCenter({ widthValue: P100 }) { NetWorkImage({ model: cart.goodsMainPic, sizeValue: 60, showBackground: true, cornerRadius: $r("app.float....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private OrderGoodsItem AST#parameter_list#Left ( AST#parameter#Left cart : AST#type_annotation#Left AST#primary_type#Left Cart AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotatio...
@Builder private OrderGoodsItem(cart: Cart): void { Card({ paddingValue: $r("app.float.space_padding_medium") }) { RowStartCenter({ widthValue: P100 }) { NetWorkImage({ model: cart.goodsMainPic, sizeValue: 60, showBackground: true, cornerRadius: $r("app.float....
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/OrderGoodsModal.ets#L97-L126
f759c3698e7abf3c5f918cceeb067308d8daa5f2
github
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
subscribeUnCollectUrlEvent
取消收藏Url事件 @param key @param callback
subscribeUnCollectUrlEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_UNCOLLECT_URL, key, callback) }
AST#method_declaration#Left subscribeUnCollectUrlEvent AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#paramet...
subscribeUnCollectUrlEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_UNCOLLECT_URL, key, callback) }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L133-L135
f3af049f388aef6db32058aa795ff2863d8d6ec8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
removeArg
移除 @param dialogId
private static removeArg(dialogId: string) { const args = DialogUtils.caches; const index = args.findIndex((item) => item.dialogId == dialogId); if (index >= 0) { args.splice(index, 1); } }
AST#method_declaration#Left private static removeArg AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_de...
private static removeArg(dialogId: string) { const args = DialogUtils.caches; const index = args.findIndex((item) => item.dialogId == dialogId); if (index >= 0) { args.splice(index, 1); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L154-L160
5c71ed7fc3bf2398a3f77a48aca334f5cdeb4676
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/ShareUtils.ets
arkts
shareImageByUrl
分享网络图片 @param uri 图片uri
static shareImageByUrl(uri: string, description: string = '来自--xxxAPP'): Promise<boolean> { // return DownloadApi.requestDownload({ url: url, mimeType: photoAccessHelper.PhotoType.IMAGE }).then((path) => { // let uri = fileUri.getUriFromPath(path) let shareData: systemShare.SharedData = new systemShare.Sh...
AST#method_declaration#Left static shareImageByUrl AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static shareImageByUrl(uri: string, description: string = '来自--xxxAPP'): Promise<boolean> { let shareData: systemShare.SharedData = new systemShare.SharedData({ utd: utd.UniformDataType.IMAGE, uri: uri, description: description, }) return ShareUtils.systemShare(shareData) ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ShareUtils.ets#L12-L24
c2427a00605faa9e87599dc8e361e09824e1441d
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/SetAppFontSize/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * Small font size. */ static readonly SET_SIZE_SMALL: number = 14; /** * Normal font size. */ static readonly SET_SIZE_NORMAL: number = 16; /** * Large font size. */ static readonly SET_SIZE_LARGE: number = 18; /** * Extra large font size....
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Small font size. */ AST#property_declaration#Left static readonly SET_SIZE_SMALL : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#ex...
export default class CommonConstants { static readonly SET_SIZE_SMALL: number = 14; static readonly SET_SIZE_NORMAL: number = 16; static readonly SET_SIZE_LARGE: number = 18; static readonly SET_SIZE_EXTRA_LARGE: number = 20; static readonly SET_SIZE_HUGE: number = 24; static readonly...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/SetAppFontSize/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L89
3868626d964ce91f4954af8394a35fc12469a846
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
power
计算幂 @param base 底数 @param power 指数 @returns 幂的结果
private static power(base: number, power: number): number { let result = 1; for (let i = 0; i < power; i++) { result = (result * base) % RabinKarp.PRIME; } return result; }
AST#method_declaration#Left private static power AST#parameter_list#Left ( AST#parameter#Left base : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left power : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
private static power(base: number, power: number): number { let result = 1; for (let i = 0; i < power; i++) { result = (result * base) % RabinKarp.PRIME; } return result; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L191-L197
06db796917f372ad9bb530b80d5aeab9d225d7c9
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
notifyListeners
通知所有监听器
private notifyListeners(): void { const count = this.getCartCount(); this.listeners.forEach(listener => listener(count)); }
AST#method_declaration#Left private notifyListeners 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#variable_declaration#Left const AST#variable_declarator#Left c...
private notifyListeners(): void { const count = this.getCartCount(); this.listeners.forEach(listener => listener(count)); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L46-L49
e6ee7e0a8afcd4379c02db24916fcc29150ecf73
github
smarthane/DrawerLayout.git
0f6e554c8451ff3bd28f5f718cc7d4329a5fa5ec
DrawerLayout/src/main/ets/components/DrawerLayout.ets
arkts
工具类
export class Utils { /** * 100% */ static readonly MATCH_PARENT: string = '100%'; /** * 设备 dpi. */ static readonly DEVICE_DPI: number = 160; /** * 获取屏幕高度 * @param dpi * @returns */ public static getDeviceHeight(dpi?: number): number { let displayO...
AST#export_declaration#Left export AST#class_declaration#Left class Utils AST#class_body#Left { /** * 100% */ AST#property_declaration#Left static readonly MATCH_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '100%' AST#exp...
export class Utils { static readonly MATCH_PARENT: string = '100%'; static readonly DEVICE_DPI: number = 160; public static getDeviceHeight(dpi?: number): number { let displayObject = display.getDefaultDisplaySync(); let screenPixelHeight = displayObject.height; let scree...
https://github.com/smarthane/DrawerLayout.git/blob/0f6e554c8451ff3bd28f5f718cc7d4329a5fa5ec/DrawerLayout/src/main/ets/components/DrawerLayout.ets#L454-L501
99d3cfb72b16863120061a772bffd5abd9102deb
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/PageConstants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class PageConstants { public static readonly CHAT_DETAIL_PAGE: string = 'pages/ChatDetailPage'; public static readonly DETAIL_PAGE: string = 'pages/Detail'; public static readonly SEARCH_PAGE: string = 'pages/SearchPage'; }
AST#export_declaration#Left export default AST#class_declaration#Left class PageConstants AST#class_body#Left { AST#property_declaration#Left public static readonly CHAT_DETAIL_PAGE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/Chat...
export default class PageConstants { public static readonly CHAT_DETAIL_PAGE: string = 'pages/ChatDetailPage'; public static readonly DETAIL_PAGE: string = 'pages/Detail'; public static readonly SEARCH_PAGE: string = 'pages/SearchPage'; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/utils/PageConstants.ets#L16-L20
df81e3de6ca01bafda18a0a60030124a43721eca
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/product/phone/src/main/ets/pages/Login.ets
arkts
onPageShow
在目标页面的生命周期中设置隐私模式
onPageShow(): void { window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { windowStage.setWindowPrivacyMode(true); // 开启隐私模式 }); }
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le...
onPageShow(): void { window.getLastWindow(getContext(this)).then((windowStage: window.Window) => { windowStage.setWindowPrivacyMode(true); }); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/product/phone/src/main/ets/pages/Login.ets#L11-L15
94c0134feb157f8f7242bd37066a1d1f5cbc6937
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
clear
通过获取页面栈并将其清空
public static clear(routerName: string): void { // 查找到对应的路由栈进行pop RouterModule.getRouter(routerName).clear(); }
AST#method_declaration#Left public static clear AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
public static clear(routerName: string): void { RouterModule.getRouter(routerName).clear(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L68-L71
5934fa62bf8cb4fe85172a381fa866022af88077
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/extension_actions.ets
arkts
i18n
export function get_message_from_messages(messages: object, message_name: string) { return (messages?.[message_name])?.['message'] as string; }
AST#export_declaration#Left export AST#function_declaration#Left function get_message_from_messages AST#parameter_list#Left ( AST#parameter#Left messages : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message_name : AST#t...
export function get_message_from_messages(messages: object, message_name: string) { return (messages?.[message_name])?.['message'] as string; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/extension_actions.ets#L239-L241
d797317452eb61003143086e1560f3dd78c2b4b6
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
verifySegment
对数据进行分段验签,异步 @param data 待验签数据 @param signDataBlob 签名数据 @param pubKey 公钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。 @param len 自定义的数据拆分长度。 @returns
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string, len: number): Promise<boolean> { let verifier = cryptoFramework.createVerify(algName); await verifier.init(pubKey); for (let i = 0; i < data.length; i += len) { let...
AST#method_declaration#Left static async verifySegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST...
static async verifySegment(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string, len: number): Promise<boolean> { let verifier = cryptoFramework.createVerify(algName); await verifier.init(pubKey); for (let i = 0; i < data.length; i += len) { let...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L397-L409
76729f4540d12e16eebbbf2b629f4e820f2078e8
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
goContactEdit
跳转到联系人编辑页面 @param contactId 联系人ID
async goContactEdit(contactId?: string): Promise<void> { const path = contactId ? RoutePaths.CONTACT_EDIT : RoutePaths.CONTACT_ADD; const params: RouteParams = contactId ? { contactId: contactId } : {}; const options: RouteOptions = { params: params }; await this.push(path, options); }
AST#method_declaration#Left async goContactEdit AST#parameter_list#Left ( AST#parameter#Left contactId ? : 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_ty...
async goContactEdit(contactId?: string): Promise<void> { const path = contactId ? RoutePaths.CONTACT_EDIT : RoutePaths.CONTACT_ADD; const params: RouteParams = contactId ? { contactId: contactId } : {}; const options: RouteOptions = { params: params }; await this.push(path, options); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L282-L288
396e577a718f870dfb90b1259907f90d5d4cc148
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringDealUtility.ets
arkts
clipIfNeedsWithMax
/ 截取指定长度(可指定 maxParts)
public static clipIfNeedsWithMax( srcStr : string, maxParts : number ): string | null { return StringDealUtility.clipIfNeedsFull( srcStr, Constants.TitleTextJp.wordsSperator, Constants.TitleTextJp.wordsSubSperator, maxParts ); }
AST#method_declaration#Left public static clipIfNeedsWithMax AST#parameter_list#Left ( AST#parameter#Left srcStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left maxParts : AST#type_annotation#Left AST#primary_type#Left num...
public static clipIfNeedsWithMax( srcStr : string, maxParts : number ): string | null { return StringDealUtility.clipIfNeedsFull( srcStr, Constants.TitleTextJp.wordsSperator, Constants.TitleTextJp.wordsSubSperator, maxParts ); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L89-L99
363b99faf3ed61381177d3c2a9d0b425ff7e9289
github
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/view/PersonalInformation.ets
arkts
buildHobbyItems
使用 @Builder 装饰器定义构建器函数,用于构建兴趣项列表。
@Builder function buildHobbyItems(params: Params) { Column() { // 显示兴趣和爱好的标题文本 Text($r('app.string.hobbies_and_interests')) .fontSize(20) .opacity(0.9) .lineHeight(28) .fontWeight(700) .alignSelf(ItemAlign.Start) .margin({ left: 24 }) // 使用 List 组件创建列表 List() { ...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function buildHobbyItems AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Params AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AS...
@Builder function buildHobbyItems(params: Params) { Column() { Text($r('app.string.hobbies_and_interests')) .fontSize(20) .opacity(0.9) .lineHeight(28) .fontWeight(700) .alignSelf(ItemAlign.Start) .margin({ left: 24 }) List() { ForEach(params.hobbyIt...
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/PersonalInformation.ets#L57-L151
7f70f1dadddca058ed43a9a34e7f97935d9378dd
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/view/AccountLoginPage.ets
arkts
构建账号登录页面 @returns {void} 无返回值
build(): void { AppNavDestination({ pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") }, viewModel: this.vm }) { this.AccountLoginContent(); } }
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#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left...
build(): void { AppNavDestination({ pageBackgroundColor: $r("app.color.bg_white"), titleOptions: { backgroundColor: $r("app.color.bg_white") }, viewModel: this.vm }) { this.AccountLoginContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/AccountLoginPage.ets#L28-L36
e87fc565db1300579e38b21d78a750c34bc829df
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/UserProfileComponent.ets
arkts
initDefaultProfileItems
初始化默认资料项
initDefaultProfileItems() { this.profileItems = [ { icon: $r('app.media.ic_mine_nickname'), title: 'Nickname', key: 'nickname', value: this.username || 'Not set', editable: true }, { icon: $r('app.media.ic_mine_gender'), title: 'Gender', key: 'gender', value: 'Not set', editable: true }, { icon: $...
AST#method_declaration#Left initDefaultProfileItems 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 . profileItems AST#member_ex...
initDefaultProfileItems() { this.profileItems = [ { icon: $r('app.media.ic_mine_nickname'), title: 'Nickname', key: 'nickname', value: this.username || 'Not set', editable: true }, { icon: $r('app.media.ic_mine_gender'), title: 'Gender', key: 'gender', value: 'Not set', editable: true }, { icon: $...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L109-L120
c2a5550c6fa7f249d10c741a55fb15a9edb2f927
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleBackupManager.ets
arkts
exportBackup
导出备份数据
async exportBackup(): Promise<string> { try { // 导出当前数据 const exportData = this.taskViewModel.exportTasks(); const jsonString = JSON.stringify(exportData, null, 2); hilog.info(0x0000, 'SimpleBackupManager', 'Data exported successfully'); return jsonString; } catch (error) { ...
AST#method_declaration#Left async exportBackup AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
async exportBackup(): Promise<string> { try { const exportData = this.taskViewModel.exportTasks(); const jsonString = JSON.stringify(exportData, null, 2); hilog.info(0x0000, 'SimpleBackupManager', 'Data exported successfully'); return jsonString; } catch (error) { hilog.err...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleBackupManager.ets#L89-L101
0a7d709f0c4ef9ba19e70a6cc342ec33d60281e4
github
2763981847/Klotski.git
35bfb313c07e25ea53d2f4e66df0c441dd51675b
entry/src/main/ets/common/util/IOUtils.ets
arkts
getPixelMapFromAlbum
从相册中选择并图片并获取 PixelMap @returns 选取的pixelMap
public static async getPixelMapFromAlbum(): Promise<image.PixelMap> { // 通过选择器选择照片,限制最多选择 1 张图片(maxSelectNumber: 1) // 以及指定 MIME 类型为图片类型(MIMEType: picker.PhotoViewMIMETypes.IMAGE_TYPE) const result = await IOUtils.photoPicker.select({ maxSelectNumber: 1, MIMEType: picker.PhotoViewMIMETypes.IMAG...
AST#method_declaration#Left public static async getPixelMapFromAlbum 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#qualified_type#Left image . PixelMap AST#q...
public static async getPixelMapFromAlbum(): Promise<image.PixelMap> { const result = await IOUtils.photoPicker.select({ maxSelectNumber: 1, MIMEType: picker.PhotoViewMIMETypes.IMAGE_TYPE }); let fd = fileIo.openSync(result.photoUris[0]).fd; return await image.createIma...
https://github.com/2763981847/Klotski.git/blob/35bfb313c07e25ea53d2f4e66df0c441dd51675b/entry/src/main/ets/common/util/IOUtils.ets#L49-L63
5e85cfc276cc64c2ec9627de71dc506eafad1c83
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/FileUtil.ets
arkts
getTempDirPath
获取临时目录下的文件夹路径或文件路径。 @param dirPath 文件路径,支持完整路径 和 相对路径(download/wps/doc)。dirPath传空表示根目录 @param fileName 文件名(test.text) @returns
static getTempDirPath(dirPath: string, fileName?: string): string { let filePath = getContext().tempDir; //根目录 if (!StrUtil.isEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { //路径中包含根目录,是完整路径。 filePath = dirPath; } else { //路径中不包含根目录,拼接成完整路径。 filePath = filePath + FileUtil.separ...
AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left dirPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName ? : AST#type_annotation#Left AST#primary_type#Left string AST#...
static getTempDirPath(dirPath: string, fileName?: string): string { let filePath = getContext().tempDir; if (!StrUtil.isEmpty(dirPath)) { if (FileUtil.hasDirPath(dirPath)) { filePath = dirPath; } else { filePath = filePath + FileUtil.separator + dirPath; } if (!fs.acce...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L88-L104
476f274aded0f5ded380f7685400bc28a117cec8
gitee
jianguo888/nut-recipes
262304b5d2bee2d5f1df4e29c094c9ddd58f9d51
entry/src/main/ets/MainAbility/model/materialModel.ets
arkts
Copyright (c) 2021 JianGuo 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, sof...
export class MaterialData { mname: string // type: string // amount: string // }
AST#export_declaration#Left export AST#class_declaration#Left class MaterialData AST#class_body#Left { AST#property_declaration#Left mname : AST#ERROR#Left string // type : string // amount : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right // AST#p...
export class MaterialData { mname: string type: string amount: string }
https://github.com/jianguo888/nut-recipes/blob/262304b5d2bee2d5f1df4e29c094c9ddd58f9d51/entry/src/main/ets/MainAbility/model/materialModel.ets#L15-L21
7f157fd33a486689ac48f69d0bc8bada801e1721
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/common/Utils.ets
arkts
showPromptAction
点击未开发功能按钮弹出提示函数
showPromptAction() { promptAction.showToast({ message: $r('app.string.tabcontentoverflow_toast_message'), duration: CONFIGURATION.TABCONTENT_OVERFLOW_DURATION }); }
AST#method_declaration#Left showPromptAction 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 promptAction AST#expression#Right . showToast A...
showPromptAction() { promptAction.showToast({ message: $r('app.string.tabcontentoverflow_toast_message'), duration: CONFIGURATION.TABCONTENT_OVERFLOW_DURATION }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/common/Utils.ets#L24-L29
b4d9d0cd22d55f63177ffb39cf3ce7f6612ed1e7
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsInfoCard.ets
arkts
GoodsInfoCard
@file 商品信息卡片组件 @author Joker.X
@ComponentV2 export struct GoodsInfoCard { /** * 商品信息 */ @Param goodsInfo: Goods = new Goods(); /** * 优惠券列表 */ @Param coupons: Coupon[] = []; /** * 已选规格 */ @Param selectedSpec: GoodsSpec | undefined = undefined; /** * 规格选择点击回调 */ @Param onSpecClick: () => void = (): void ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsInfoCard AST#component_body#Left { /** * 商品信息 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right goodsInfo : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_t...
@ComponentV2 export struct GoodsInfoCard { @Param goodsInfo: Goods = new Goods(); @Param coupons: Coupon[] = []; @Param selectedSpec: GoodsSpec | undefined = undefined; @Param onSpecClick: () => void = (): void => { }; @Param onCouponClick: () => void = (): void => { }; buil...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsInfoCard.ets#L18-L210
d3d80f3a1bc034912d61d93335748f614e9a1a66
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/formatter/DefaultValueFormatter.ets
arkts
setup
Sets up the formatter with a given number of decimal digits. @param digits
public setup(digits: number): void { this.mDecimalDigits = digits; }
AST#method_declaration#Left public setup AST#parameter_list#Left ( AST#parameter#Left digits : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
public setup(digits: number): void { this.mDecimalDigits = digits; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultValueFormatter.ets#L49-L52
0826cbec39fdb62a141609bd42fa420f2ddcf47d
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.deviceInfo.d.ets
arkts
get
Obtains the OS release type represented by a string. <p>The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}. The specific release type may be {@code Release}, {@code Beta1}, or others alike. @syscap SystemCapability.Startup.SystemInfo @crossplatform @since 20 @arkts 1.2
static get osReleaseType(): string;
AST#method_declaration#Left static get AST#ERROR#Left osRele as e Type AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
static get osReleaseType(): string;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L221-L221
9ce7799313e0590951a90e3ca5bd1de7d6e39640
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment.ets
arkts
Segment01Builder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function Segment01Builder() { NavDestination(){ MyComponent() } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment01Builder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left NavDestination ( ) AST#containe...
@Builder export function Segment01Builder() { NavDestination(){ MyComponent() } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment.ets#L15-L20
8c8715374121bbf9cf1e877de85458fbdd3fb51b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ClickUtil.ets
arkts
debounce
防抖:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数 @param func 要执行的函数 @param wait 延时的时间 @param clickId 设置的点击事件id,用于区分多个点击事件,不传默认单个点击事件
static debounce(func: () => void, wait: number = 1000, clickId: string = ClickUtil.defaultId) { let cacheID = CacheUtil.get<number>(`ClickUtil_debounce_timeoutID_${clickId}`); //获取id if (cacheID !== undefined && cacheID !== null) { clearTimeout(cacheID); } let timeoutID = setTimeout(() => { ...
AST#method_declaration#Left static debounce AST#parameter_list#Left ( AST#parameter#Left func : AST#type_annotation#Left AST#function_type#Left 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#function_type#R...
static debounce(func: () => void, wait: number = 1000, clickId: string = ClickUtil.defaultId) { let cacheID = CacheUtil.get<number>(`ClickUtil_debounce_timeoutID_${clickId}`); if (cacheID !== undefined && cacheID !== null) { clearTimeout(cacheID); } let timeoutID = setTimeout(() => { typeof...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ClickUtil.ets#L66-L76
8015596c3a89221fce35f7ed8c118ce8915f85de
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
checkRetestMistakeUsable
/ 检查 是否可以使用 再测一次(仅错误单词)
public checkRetestMistakeUsable(showMessage: boolean = true): boolean { if (!this.nonMember.isLockedRetestMistake) { return true } // 非会员 锁定再测一次 功能是否启用 if (this.isActive) { return true } // 非会员才做检查 if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_retest_mistake')) ...
AST#method_declaration#Left public checkRetestMistakeUsable AST#parameter_list#Left ( AST#parameter#Left showMessage : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Righ...
public checkRetestMistakeUsable(showMessage: boolean = true): boolean { if (!this.nonMember.isLockedRetestMistake) { return true } if (this.isActive) { return true } if (showMessage) { Toast.showMessage($r('app.string.member_manager_msg_limit_use_retest_mistake')) } return false }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L326-L335
65c7db0304d6c8b33b0c27b5a865c7c93b22c125
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets
arkts
@file Date tool
export default class DateTimeUtil { /** * Hour, minute, second */ getTime(): string { const DATETIME = new Date(); return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds()); } /** * Year Month Day */ getDate(): string { const DATETIME = new Date(); ...
AST#export_declaration#Left export default AST#class_declaration#Left class DateTimeUtil AST#class_body#Left { /** * Hour, minute, second */ AST#method_declaration#Left getTime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#t...
export default class DateTimeUtil { getTime(): string { const DATETIME = new Date(); return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(), DATETIME.getSeconds()); } getDate(): string { const DATETIME = new Date(); return this.concatDate(DATETIME.getFullYear(), DATETIME.getMont...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/common/utils/DateTimeUtil.ets#L19-L75
2b960923ee1ffaed42f63a1c8b52003f9aa64a51
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ImageEditTaskPool/entry/src/main/ets/utils/CropUtil.ets
arkts
Crop 16:9. @param pixelMap. @param width. @param height.
export async function rectangle(pixelMap: PixelMap, width: number, height: number): Promise<void> { if (width <= height) { const cropWidth = width; const cropHeight = Math.floor(width * (9 / 16)); const cropPosition = new RegionItem(0, Math.floor((height - cropHeight) / 2)); await cropCommon(pixelMap,...
AST#export_declaration#Left export AST#function_declaration#Left async function rectangle AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left width : AST#type_annotation#...
export async function rectangle(pixelMap: PixelMap, width: number, height: number): Promise<void> { if (width <= height) { const cropWidth = width; const cropHeight = Math.floor(width * (9 / 16)); const cropPosition = new RegionItem(0, Math.floor((height - cropHeight) / 2)); await cropCommon(pixelMap,...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ImageEditTaskPool/entry/src/main/ets/utils/CropUtil.ets#L103-L123
2a54bf8bc548424b2c7d720f7fc6477372c1dcec
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets
arkts
YearViewItem
时间计算工具类 年视图子组件
@Component export struct YearViewItem { // 年视图离屏画布列表 @State yearViewList: Array<OffscreenCanvas> = []; @Prop @Watch('updateYearData') year: number; // 年视图月份点击回调 onMonthClick: (year: number, month: number) => void = () => { }; /** * 更新年数据 */ updateYearData() { this.yearViewList = []; for (...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct YearViewItem AST#component_body#Left { // 年视图离屏画布列表 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right yearViewList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Arra...
@Component export struct YearViewItem { @State yearViewList: Array<OffscreenCanvas> = []; @Prop @Watch('updateYearData') year: number; onMonthClick: (year: number, month: number) => void = () => { }; updateYearData() { this.yearViewList = []; for (let i = 1; i <= Constants.MONTHS_NUM; i++) {...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/view/YearViewItem.ets#L23-L165
96a7f4153a22ec49fa6a53b060d1963b02118905
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets
arkts
RSA密钥对
export interface RsaKey { publicKey: string; privateKey: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RsaKey AST#object_type#Left { AST#type_member#Left publicKey : 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 privateKey : AST#type_annotation#...
export interface RsaKey { publicKey: string; privateKey: string; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets#L21-L24
da031944e816fec988941de9adf1f64015413941
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/dialog/alertDialog.ets
arkts
AlertDialogBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function AlertDialogBuilder(name: string, param: Object) { AlertDialogExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function AlertDialogBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pa...
@Builder export function AlertDialogBuilder(name: string, param: Object) { AlertDialogExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/dialog/alertDialog.ets#L16-L19
d007341694c67dea639ade15f6f1a5fb5f1b76ca
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
getDaysByYear
获取指定年份的天数
static getDaysByYear(year: number): number { if (DateUtils.isLeapYear(year)) { return 366; } else { return 365; } }
AST#method_declaration#Left static getDaysByYear AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
static getDaysByYear(year: number): number { if (DateUtils.isLeapYear(year)) { return 366; } else { return 365; } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L165-L171
4de33916de2098ea569eb9083b2b828f2513f301
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
getFormatDate
获取格式化日期,将传入的日期格式化为Date @param date number类型的时间戳10-13位数据 @returns
static getFormatDate(date?: number | string | Date): Date { if (date == undefined || date == null) { //无参数 date = new Date(); } else if (typeof date == "string") { //字符串日期 if (date.length == 0) { date = new Date(); } else if (RegexUtils.isDigits(date)) { //字符串类型的时间戳(10-13位) dat...
AST#method_declaration#Left static getFormatDate AST#parameter_list#Left ( AST#parameter#Left date ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type...
static getFormatDate(date?: number | string | Date): Date { if (date == undefined || date == null) { date = new Date(); } else if (typeof date == "string") { if (date.length == 0) { date = new Date(); } else if (RegexUtils.isDigits(date)) { date = new Date(DateUtils.padTimes...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L45-L61
edd481b8470f617aca81b98a3bae6e07b18604c2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/IPC/ObjectTransfer/IPC_Service/entry/src/main/ets/serviceextability/IPC_Service.ets
arkts
提供服务端能力
export class StubServer extends rpc.RemoteObject { public str: string | undefined; constructor(des: string) { super(des); } onRemoteMessageRequest(code: number, data: rpc.MessageSequence, reply: rpc.MessageSequence, options: rpc.MessageOption): boolean | Promise<boolean> { hilog.info(DOMAIN, TAG, ...
AST#export_declaration#Left export AST#class_declaration#Left class StubServer extends AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left rpc . RemoteObject AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public str : AST#...
export class StubServer extends rpc.RemoteObject { public str: string | undefined; constructor(des: string) { super(des); } onRemoteMessageRequest(code: number, data: rpc.MessageSequence, reply: rpc.MessageSequence, options: rpc.MessageOption): boolean | Promise<boolean> { hilog.info(DOMAIN, TAG, ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/IPC/ObjectTransfer/IPC_Service/entry/src/main/ets/serviceextability/IPC_Service.ets#L41-L65
5ee92f994083f7b5fdab3d0df621e2efa84a8665
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
logInfo
info级别日志打印 @param message 日志内容
logInfo(message: string): void { LogUtils.info('NotificationHelper', message); }
AST#method_declaration#Left logInfo AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS...
logInfo(message: string): void { LogUtils.info('NotificationHelper', message); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/notify/NotificationHelper.ets#L240-L242
90a042dce38cc144d18778687429f2a8bc73b0f7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
流式输出回调类型
export type StreamCallback = (chunk: string, isComplete: boolean) => void;
AST#export_declaration#Left export AST#type_declaration#Left type StreamCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left chunk : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramet...
export type StreamCallback = (chunk: string, isComplete: boolean) => void;
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L22-L22
a955b44b5045664b2acc220e26bb566c76e799fe
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getAfterDay
获取后一天日期
static getAfterDay(date: number | string | Date): Date { return DateUtil.getAmountDay(date, 1); }
AST#method_declaration#Left static getAfterDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Rig...
static getAfterDay(date: number | string | Date): Date { return DateUtil.getAmountDay(date, 1); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L304-L306
ec087f6028387a91e68c0e44f4c323a9f3771ee2
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List/entry/src/main/ets/common/CommonConstants.ets
arkts
list space
export const LIST_ITEM_SPACE: number = 16;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LIST_ITEM_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 16 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declarat...
export const LIST_ITEM_SPACE: number = 16;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L39-L39
8b35c2fabbcb2cfbee5b9e0bf613344da7a1159e
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
setMainWindowImmersive
当前主窗口是否开启沉浸模式 @param {boolean} enable 是否开启 @returns {void}
setMainWindowImmersive(enable: boolean): void { this.windowModel.setMainWindowImmersive(enable); }
AST#method_declaration#Left setMainWindowImmersive AST#parameter_list#Left ( AST#parameter#Left enable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
setMainWindowImmersive(enable: boolean): void { this.windowModel.setMainWindowImmersive(enable); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L156-L158
a84683b6921608a4086298b6165b069d46642b8b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/OssUpload.ets
arkts
@file OSS上传响应模型(适配腾讯云) @author Joker.X
export class OssUpload { /** * 腾讯云凭证信息 */ credentials?: TencentCredentials | null = null; /** * 请求ID */ requestId?: string | null = null; /** * 过期时间 */ expiration?: string | null = null; /** * 开始时间戳 */ startTime?: number | null = null; /** * 过期时间戳 */ expiredTime?: numbe...
AST#export_declaration#Left export AST#class_declaration#Left class OssUpload AST#class_body#Left { /** * 腾讯云凭证信息 */ AST#property_declaration#Left credentials ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left TencentCredentials AST#primary_type#Right | AST#primary_type#Left null AST#primary_t...
export class OssUpload { credentials?: TencentCredentials | null = null; requestId?: string | null = null; expiration?: string | null = null; startTime?: number | null = null; expiredTime?: number | null = null; url?: string | null = null; constructor(init?: Partial<OssUpload>) { if...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/OssUpload.ets#L5-L42
f1a60d809423b4ab02e42233a105a129dc41b160
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/AgentService.ets
arkts
handleDeepSeekResponse
Handle the response from DeepSeek API Execute function calls if present, otherwise return text response @param response - API response @returns Message to show user
private async handleDeepSeekResponse(response: DeepSeekResponse): Promise<string> { const choice = response.choices[0]; const message = choice.message; const normalizedMessageContent = this.normalizeQuotes(message.content); // Add assistant's response to history const assistantMessage: ChatMessage ...
AST#method_declaration#Left private async handleDeepSeekResponse AST#parameter_list#Left ( AST#parameter#Left response : AST#type_annotation#Left AST#primary_type#Left DeepSeekResponse AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_...
private async handleDeepSeekResponse(response: DeepSeekResponse): Promise<string> { const choice = response.choices[0]; const message = choice.message; const normalizedMessageContent = this.normalizeQuotes(message.content); const assistantMessage: ChatMessage = { role: 'assistant', con...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/AgentService.ets#L462-L523
43c24d1a0c875477744638be2700a3662b845ea7
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/paintcomponent/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 default class Constants { static readonly COLOR_HEALTHY: string = '#00CC00'; static readonly COLOR_NORMAL: string = '#7EBEDE'; static readonly COLOR_WARN: string = '#FF0000'; static readonly COLOR_TRANSPARENT: string = '#00000000'; static readonly PERCENTAGE_STR: string = '%'; static readonly PROGRES...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly COLOR_HEALTHY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '#00CC00' AST#expression#...
export default class Constants { static readonly COLOR_HEALTHY: string = '#00CC00'; static readonly COLOR_NORMAL: string = '#7EBEDE'; static readonly COLOR_WARN: string = '#FF0000'; static readonly COLOR_TRANSPARENT: string = '#00000000'; static readonly PERCENTAGE_STR: string = '%'; static readonly PROGRES...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/constants/Constants.ets#L16-L34
94e5cdd01b99d90f80ec40d4b70918f74705e202
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
isThisMonth
判断是否为本月
private isThisMonth(date: Date): boolean { const now = new Date(); return date.getMonth() === now.getMonth() && date.getFullYear() === now.getFullYear(); }
AST#method_declaration#Left private isThisMonth AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_typ...
private isThisMonth(date: Date): boolean { const now = new Date(); return date.getMonth() === now.getMonth() && date.getFullYear() === now.getFullYear(); }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L641-L644
c4f78dfe006f67a1b99be4b04818ee55975e860a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getSignatureInfo
获取应用包的签名信息 @returns
static async getSignatureInfo(): Promise<bundleManager.SignatureInfo> { return (await AppUtil.getBundleInfo()).signatureInfo; }
AST#method_declaration#Left static async getSignatureInfo 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#qualified_type#Left bundleManager . SignatureInfo AST...
static async getSignatureInfo(): Promise<bundleManager.SignatureInfo> { return (await AppUtil.getBundleInfo()).signatureInfo; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L491-L493
b45f9fe099b0cb95d806d33ce0423b880c2df746
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets
arkts
createDBPlan
====== ResultSet -> 实体 ======
private createDBPlan(rs: relationalStore.ResultSet): DBPlan { const data = new DBPlan(); data.planId = rs.getLong(rs.getColumnIndex(Tables.Plan.Col.planId)); data.planName = ResultSetTool.decodeString(rs, Tables.Plan.Col.planName); data.bookId = rs.getLong(rs.getColumnIndex(Tables.Pla...
AST#method_declaration#Left private createDBPlan AST#parameter_list#Left ( AST#parameter#Left rs : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . ResultSet AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right :...
private createDBPlan(rs: relationalStore.ResultSet): DBPlan { const data = new DBPlan(); data.planId = rs.getLong(rs.getColumnIndex(Tables.Plan.Col.planId)); data.planName = ResultSetTool.decodeString(rs, Tables.Plan.Col.planName); data.bookId = rs.getLong(rs.getColumnIndex(Tables.Pla...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plandb/PlanDbAccess.ets#L315-L325
22b523dfb4c2aa75c73ca402438c1a9bfaa9d329
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
setting/src/main/ets/views/DotSheetBind.ets
arkts
languageMenu
语言模式菜单
@Builder languageMenu() { Select([{ value: this.languageBox[0] }, { value: this.languageBox[1] }, { value: this.languageBox[2] }]) .selected(this.appGeneralData.languageId!!) .value(this.languageBox[this.appGeneralData.languageId]) .selectedOptionFontColor(Color.White) .selectedOptionBgCol...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right languageMenu 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 Select ( AST#expression#Left AST#array_literal#Left [ AST#exp...
@Builder languageMenu() { Select([{ value: this.languageBox[0] }, { value: this.languageBox[1] }, { value: this.languageBox[2] }]) .selected(this.appGeneralData.languageId!!) .value(this.languageBox[this.appGeneralData.languageId]) .selectedOptionFontColor(Color.White) .selectedOptionBgCol...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/setting/src/main/ets/views/DotSheetBind.ets#L101-L129
ce3beee12159917d3036f23ba5c9bd1644bc0098
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets
arkts
verticalFlipImage
垂直翻转图片
private verticalFlipImage() { if (this.pixelMap != undefined) { // [Start pixelmap_vertical_flip_image] // 垂直翻转 this.pixelMap.flip(false, true).then(() => { this.updateImageInfo(); }) // [End pixelmap_vertical_flip_image] } }
AST#method_declaration#Left private verticalFlipImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#ex...
private verticalFlipImage() { if (this.pixelMap != undefined) { this.pixelMap.flip(false, true).then(() => { this.updateImageInfo(); }) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L286-L295
026aa32d1408b851c294473a29b3fdac2cb62d3b
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets
arkts
每一个翻译包含: 词性 + 单字翻译
export interface TitleItem { pos: string | null; // 词性 nullable title: string; // 单字翻译 }
AST#export_declaration#Left export AST#interface_declaration#Left interface TitleItem AST#object_type#Left { AST#type_member#Left pos : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annot...
export interface TitleItem { pos: string | null; title: string; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L8-L11
7f223745b0cbb77c8e05b1faf8a090c553847055
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/view/BottomView.ets
arkts
setEventListener
设置事件监听
setEventListener(){ TextReader.on('stop', () => { this.isTextReader = false; }); TextReader.on('stateChange', (state: TextReader.ReadState) => { // TODO:当前正在播放的文章播放完成 if(state.state === CONFIGURATION.COMPLETED) { // 当朗读的为最后一页 if(Number(state.id) === this.readInfoList.lengt...
AST#method_declaration#Left setEventListener 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 TextReader AST#expression#Right . on AST#member...
setEventListener(){ TextReader.on('stop', () => { this.isTextReader = false; }); TextReader.on('stateChange', (state: TextReader.ReadState) => { if(state.state === CONFIGURATION.COMPLETED) { if(Number(state.id) === this.readInfoList.length) { this.currentPageNu...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/view/BottomView.ets#L86-L112
c3095dbeae2a45e81ce5347258640659489f7182
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
sendTestRequest
发送测试请求
private async sendTestRequest(config: LLMConfig, request: ChatRequest): Promise<TestRequestResult> { try { // 构建请求头 const headers: Record<string, string> = { 'Content-Type': 'application/json' }; // 根据不同提供商设置认证头 if (config.provider === 'openai') { headers['Authorizatio...
AST#method_declaration#Left private async sendTestRequest AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left LLMConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left request : AST#type_annotation#Left AST#primary_type#Left Chat...
private async sendTestRequest(config: LLMConfig, request: ChatRequest): Promise<TestRequestResult> { try { const headers: Record<string, string> = { 'Content-Type': 'application/json' }; if (config.provider === 'openai') { headers['Authorization'] = `Bearer ${config....
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L253-L321
7477f6022ffc5c0ab95251877c45f364fea52711
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Utils.ets
arkts
calcTextWidth
calculates the approximate width of a text, depending on a demo text avoid repeated calls (e.g. inside drawing methods) @param paint @param demoText @return
public static calcTextWidth(paint: Paint, demoText: string): number { Utils.resetContext2DFont(Utils.offCanvasContext2d, paint); let textMetrics: TextMetrics = Utils.offCanvasContext2d.measureText(demoText); return textMetrics.width; }
AST#method_declaration#Left public static calcTextWidth AST#parameter_list#Left ( AST#parameter#Left paint : AST#type_annotation#Left AST#primary_type#Left Paint AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left demoText : AST#type_annotation#Left AST#primary_type#Left string AST...
public static calcTextWidth(paint: Paint, demoText: string): number { Utils.resetContext2DFont(Utils.offCanvasContext2d, paint); let textMetrics: TextMetrics = Utils.offCanvasContext2d.measureText(demoText); return textMetrics.width; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L78-L82
53d43ffa708b9a89870e0ee3bc1d878aa9d3e588
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationManager.ets
arkts
cancelAllNotifications
取消所有通知
async cancelAllNotifications(): Promise<void> { try { await notificationManager.cancelAll(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, 'All notifications cancelled'); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Failed...
AST#method_declaration#Left async cancelAllNotifications 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 > AS...
async cancelAllNotifications(): Promise<void> { try { await notificationManager.cancelAll(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, 'All notifications cancelled'); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_NOTIFICATION, `Failed...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L577-L585
79bee3b259ec8dd862e5948ae7dee3e4ba88b61d
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/components/emoji/EmojiItemGray.ets
arkts
EmojiItemGray
无大小写的灰色组件
@Component export struct EmojiItemGray { private keyValue: string | undefined = undefined; @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; lastMenuType: number; build() { Stack() { if (this.keyValue) { Text(this.keyValue)....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct EmojiItemGray AST#component_body#Left { AST#property_declaration#Left private keyValue : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefin...
@Component export struct EmojiItemGray { private keyValue: string | undefined = undefined; @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; lastMenuType: number; build() { Stack() { if (this.keyValue) { Text(this.keyValue)....
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/emoji/EmojiItemGray.ets#L28-L57
8d385a8bc9e2c003ceefc93565cea1b80d8f6190
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/OperateRDBInTaskPool.ets
arkts
syncAddressBookListData
从json文件同步数据到数据库(数据库批量插入,模仿大量数据分批插入)
syncAddressBookListData() { this.totalValue = getJsonData('addressbook.json').length; for (let i = 0; i < this.totalValue; i += 10) { // 批量数据插入操作 (分批每10条为一个单位) taskPoolExecuteBatchInsert(context, getJsonData('addressbook.json').slice(i, i + 10)) .then((insertNum: number) => { if (i...
AST#method_declaration#Left syncAddressBookListData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . totalValue AS...
syncAddressBookListData() { this.totalValue = getJsonData('addressbook.json').length; for (let i = 0; i < this.totalValue; i += 10) { taskPoolExecuteBatchInsert(context, getJsonData('addressbook.json').slice(i, i + 10)) .then((insertNum: number) => { if (insertNum === 0 || undefin...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/src/main/ets/view/OperateRDBInTaskPool.ets#L117-L147
44a9d274e4843c6dc6f897e46c9fd1054c8bc0fb
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildChannelsPositionUpdate.ets
arkts
应用约束60: 使用ES模块导出
export default GuildChannelsPositionUpdate;
AST#export_declaration#Left export default AST#expression#Left GuildChannelsPositionUpdate AST#expression#Right ; AST#export_declaration#Right
export default GuildChannelsPositionUpdate;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildChannelsPositionUpdate.ets#L43-L43
f2d1f320b72abee7bf5b14ee692759e7aec84aee
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets
arkts
modInverse
基点G 计算模P下的加法逆元 @param a 要计算逆元的数 @returns 逆元
private static modInverse(a: number): number { a = ((a % EllipticCurveKeyExchange.P) + EllipticCurveKeyExchange.P) % EllipticCurveKeyExchange.P; for (let x = 1; x < EllipticCurveKeyExchange.P; x++) { if ((a * x) % EllipticCurveKeyExchange.P === 1) { return x; } } return 1; }
AST#method_declaration#Left private static modInverse AST#parameter_list#Left ( AST#parameter#Left a : 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 number AST#primary...
private static modInverse(a: number): number { a = ((a % EllipticCurveKeyExchange.P) + EllipticCurveKeyExchange.P) % EllipticCurveKeyExchange.P; for (let x = 1; x < EllipticCurveKeyExchange.P; x++) { if ((a * x) % EllipticCurveKeyExchange.P === 1) { return x; } } return 1; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/EllipticCurveKeyExchange.ets#L21-L29
d3f3fa3c619a06af978031b73ee1320e58675f15
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildDialogHeader
弹窗头部信息
@Builder buildDialogHeader() { if (this.selectedDateDetail) { Column({ space: 8 }) { // 公历日期 Text(`${this.selectedDateDetail.gregorianDate.getFullYear()}年${this.selectedDateDetail.gregorianDate.getMonth() + 1}月${this.selectedDateDetail.gregorianDate.getDate()}日`) .fontSize(20) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDialogHeader 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#member_expression#Left AST#expression#Left this AST#expressi...
@Builder buildDialogHeader() { if (this.selectedDateDetail) { Column({ space: 8 }) { Text(`${this.selectedDateDetail.gregorianDate.getFullYear()}年${this.selectedDateDetail.gregorianDate.getMonth() + 1}月${this.selectedDateDetail.gregorianDate.getDate()}日`) .fontSize(20) ....
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4473-L4500
28ee441862c998142cad89caba2e3d3f099ce1ff
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
getVp
Obtains the screen horizontal adaptation vp. @return number
static getVp(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return px2vp(DimensionUtil.adaptDimension(beforeVp)); }
AST#method_declaration#Left static getVp AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
static getVp(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return px2vp(DimensionUtil.adaptDimension(beforeVp)); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L63-L66
90285ae6b5da5f6136a41b5ec750c7fc43240f10
gitee
FadingLight9291117/vscode-arkts.git
f23422a9fd9e9048ef2251f9dcc985633f93c7b5
examples/components/UserCard.ets
arkts
模拟从其他文件导入组件 按 F12 或 Ctrl+Click 测试跳转
export struct UserCard { @State username: string = '' @State avatar: string = '' build() { Column() { Image(this.avatar) .width(80) .height(80) .borderRadius(40) Text(this.username) .fontSize(16) .fontWeight(FontWeight.Medium) } } }
AST#export_declaration#Left export AST#component_declaration#Left struct UserCard AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right username : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
export struct UserCard { @State username: string = '' @State avatar: string = '' build() { Column() { Image(this.avatar) .width(80) .height(80) .borderRadius(40) Text(this.username) .fontSize(16) .fontWeight(FontWeight.Medium) } } }
https://github.com/FadingLight9291117/vscode-arkts.git/blob/f23422a9fd9e9048ef2251f9dcc985633f93c7b5/examples/components/UserCard.ets#L6-L22
58654cfd09699f8ec6a8063c7ef0ed1c3ab7b92e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets
arkts
16进制字符串转字节流
export function fromHexString(hexString: string): Uint8Array { return new Uint8Array(buffer.from(hexString, 'hex').buffer); }
AST#export_declaration#Left export AST#function_declaration#Left function fromHexString AST#parameter_list#Left ( AST#parameter#Left hexString : 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#Lef...
export function fromHexString(hexString: string): Uint8Array { return new Uint8Array(buffer.from(hexString, 'hex').buffer); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/Utils.ets#L54-L56
8f2c8d12f7ed2d1da599b16c2a682f75095233de
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets
arkts
replaceOmitAndPoint
/ 替换省略号并去除末尾点
static replaceOmitAndPoint(srcText: string): string { let str = srcText; const strPoint = BaseWordUtility.STR_POINT_HALF; const strOmitHalf = BaseWordUtility.STR_OMIT_HALF; const strOmitFull = BaseWordUtility.STR_OMIT_FULL; const indexNoFound = -1; str = str.replace(strOmitHalf, strOmitFu...
AST#method_declaration#Left static replaceOmitAndPoint AST#parameter_list#Left ( AST#parameter#Left srcText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
static replaceOmitAndPoint(srcText: string): string { let str = srcText; const strPoint = BaseWordUtility.STR_POINT_HALF; const strOmitHalf = BaseWordUtility.STR_OMIT_HALF; const strOmitFull = BaseWordUtility.STR_OMIT_FULL; const indexNoFound = -1; str = str.replace(strOmitHalf, strOmitFu...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L148-L162
8ea8b2914d4826d7be739e81285c7ebdd9194fb4
github
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/view/AddDialogComponent.ets
arkts
selectAccount
选择支付或收入类型
selectAccount(item: AccountClassification) { this.newAccount.accountType = item.accountType; this.newAccount.typeText = item.typeText; this.curType = item.typeText; }
AST#method_declaration#Left selectAccount AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left AccountClassification AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Lef...
selectAccount(item: AccountClassification) { this.newAccount.accountType = item.accountType; this.newAccount.typeText = item.typeText; this.curType = item.typeText; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/AddDialogComponent.ets#L54-L58
dd911d76fc04fcdd594bf52bc9344f3ae6d9eb29
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets
arkts
delete
删除
delete() { let that = this; let intervalID = setInterval(() => { that.move(that.sx -= 0.01); if (that.sx < 0.2) { clearInterval(intervalID); that.onDelete(that.resource.getId()); } }, 10); }
AST#method_declaration#Left delete AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left that = AST#expression#Left this AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#sta...
delete() { let that = this; let intervalID = setInterval(() => { that.move(that.sx -= 0.01); if (that.sx < 0.2) { clearInterval(intervalID); that.onDelete(that.resource.getId()); } }, 10); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/multiplexSample/ScrollItem.ets#L127-L136
049c0c13c3b51aa759870d6b966fa79b7b7c46bf
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/common/MimeType.ets
arkts
资源类型与MimeType映射枚举
export enum MimeType { 'html' = 'text/html', 'css' = 'text/css', 'plain' = 'text/plain', 'json' = 'application/json', 'js' = 'text/javascript', 'jpg' = 'image/jpeg' }
AST#export_declaration#Left export AST#enum_declaration#Left enum MimeType AST#enum_body#Left { AST#ERROR#Left 'html' = 'text/html' , 'css' = 'text/css' , 'plain' = 'text/plain' , 'json' = 'application/json' , 'js' = 'text/javascript' AST#ERROR#Right , AST#ERROR#Left 'jpg' = 'image/jpeg' AST#ERROR#Right } AST#enum_body...
export enum MimeType { 'html' = 'text/html', 'css' = 'text/css', 'plain' = 'text/plain', 'json' = 'application/json', 'js' = 'text/javascript', 'jpg' = 'image/jpeg' }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/MimeType.ets#L18-L25
4fcfe264b499785320dc2af708b4a8e0a9a50755
gitee