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
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageRegistry.ets
arkts
has
检查类型是否已注册 @param typeName 消息类型名称 @returns true 如果已注册 使用示例: ```typescript if (MessageRegistry.has('test.Person')) { console.log('Person type is registered') } ```
static has(typeName: string): boolean { return MessageRegistry.types.has(typeName) }
AST#method_declaration#Left static has AST#parameter_list#Left ( AST#parameter#Left typeName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
static has(typeName: string): boolean { return MessageRegistry.types.has(typeName) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L136-L138
f884f15d7da323d91bb1448b0d63654aea2c47b3
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets
arkts
getCurrentIndicatorInfo
[End tabs_right_build] [Start get_current_indicator_info]
private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> { let nextIndex = index; if (index > 0 && event.currentOffset > 0) { nextIndex--; } else if (index < 3 && event.currentOffset < 0) { nextIndex++; } let indexInfo: [number, number] = this.te...
AST#method_declaration#Left private getCurrentIndicatorInfo 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#Left event : AST#type_annotation#Left AST#primary_type#Left TabsAnim...
private getCurrentIndicatorInfo(index: number, event: TabsAnimationEvent): Record<string, number> { let nextIndex = index; if (index > 0 && event.currentOffset > 0) { nextIndex--; } else if (index < 3 && event.currentOffset < 0) { nextIndex++; } let indexInfo: [number, number] = this.te...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets#L130-L146
53116df22c6793cb8697542b2ea22ab13ec7498f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/component/CustomImageView.ets
arkts
CustomImageView
showCustomContentDialog - 自定义的图片文本组件
@ComponentV2 export struct CustomImageView { @Require @Param content: ResourceStr; @Require @Param src: Resource; build() { Scroll() { Column() { Text(this.content) .fontSize(13) .fontStyle(FontStyle.Normal) .fontFamily('MyFont') .padding(5) .te...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CustomImageView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right content : AST#type_annotation#Left AST#primary_...
@ComponentV2 export struct CustomImageView { @Require @Param content: ResourceStr; @Require @Param src: Resource; build() { Scroll() { Column() { Text(this.content) .fontSize(13) .fontStyle(FontStyle.Normal) .fontFamily('MyFont') .padding(5) .te...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/CustomImageView.ets#L3-L37
4af556b62cb39a075204d111b292636d4f625531
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/observe/InputObserved.ets
arkts
InputObserved
输入框Observed数据 @author pll @create 2025-06-06 09:05
@ObservedV2 export class InputObserved extends CommonObservedData implements IObservedData { @Trace text: string = '' }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class InputObserved extends AST#type_annotation#Left AST#primary_type#Left CommonObservedData AST#primary_type#Right AST#type_annotation#Right AST#implements_clause#Left implements IObservedData AST#implements_clause#Right ...
@ObservedV2 export class InputObserved extends CommonObservedData implements IObservedData { @Trace text: string = '' }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/observe/InputObserved.ets#L9-L13
701919f0299d7bf7d2ee5f20e94ac34449461447
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressDetailPage.ets
arkts
buildFormCard
构建基础信息表单 @returns {void} 无返回值
@Builder private buildFormCard(): void { IBestForm({ formId: this.formId, controller: this.vm.formController, rules: this.vm.formRules }) { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestField({ ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildFormCard 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#arkts_ui_element#Left AST#ui...
@Builder private buildFormCard(): void { IBestForm({ formId: this.formId, controller: this.vm.formController, rules: this.vm.formRules }) { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestField({ ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressDetailPage.ets#L95-L174
a3fadb7e7555644a594d5d1c98dc18572b181acc
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
setWindowPrivacyMode
设置窗口是否为隐私模式。设置为隐私模式的窗口,窗口内容将无法被截屏或录屏。 @param isPrivacyMode 窗口是否为隐私模式。true表示模式开启;false表示模式关闭。 @param windowClass 不传该值,默认主窗口。 @returns
static async setWindowPrivacyMode(isPrivacyMode: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setWindowPrivacyMode(isPrivacyMode); }
AST#method_declaration#Left static async setWindowPrivacyMode AST#parameter_list#Left ( AST#parameter#Left isPrivacyMode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_t...
static async setWindowPrivacyMode(isPrivacyMode: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setWindowPrivacyMode(isPrivacyMode); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L69-L72
1ac5d44c63b2eeaddcf287088a456708790e8482
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/loop_stmt/while_body_001_T.ets
arkts
Introduction 循环结构-body语句
export function while_body_001_T(taint_src : string) { let i = 0 let t = '' while (i < 2) { t = t + taint_src i++ } taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function while_body_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le...
export function while_body_001_T(taint_src : string) { let i = 0 let t = '' while (i < 2) { t = t + taint_src i++ } taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/while_body_001_T.ets#L6-L14
3c176d8e42b8adbf597347388e18d3a7a7ebfd27
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/dialog/src/main/ets/tips/TipsDialogManager.ets
arkts
showSuccess
成功提示 弹窗 @param params
static showSuccess(msg: string = '') { TipsDialogManager.showInfo(msg, $r('app.media.dialog_tips_success_icon')) }
AST#method_declaration#Left static showSuccess AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#...
static showSuccess(msg: string = '') { TipsDialogManager.showInfo(msg, $r('app.media.dialog_tips_success_icon')) }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/dialog/src/main/ets/tips/TipsDialogManager.ets#L22-L24
44bda7fd72786f9089201bdea798b30d35020524
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/entry/src/main/ets/pages/Calc.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export function add(a: number, b: number): number { let c = a + b; console.info('DynamicImport I am a HAP, %d + %d = %d', a, b, c); return c; }
AST#export_declaration#Left export AST#function_declaration#Left function add 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#Left b : AST#type_annotation#Left AST#primary_type#Lef...
export function add(a: number, b: number): number { let c = a + b; console.info('DynamicImport I am a HAP, %d + %d = %d', a, b, c); return c; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/DynamicImport/entry/src/main/ets/pages/Calc.ets#L16-L20
fb692c07461d49378c107e9eab1a6205e8f37178
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/pages/IndexPage.ets
arkts
onWindowSizeChange
[Start device_width1] Because the width and height of the floating window are the system default, the value of isFloatWindow (whether to display the floating window or not) is only processed according to the height of the window, which is used to control the display and concealment of the interface components. [EndExcl...
onWindowSizeChange(): void { // [StartExclude index_page1] let deviceWidth: number = AppStorage.get<number>('deviceWidth') || 0; // Judge whether it is a horizontal screen or a vertical screen suspension window. if (this.isFullLandscapeScreen && Math.round((this.deviceHeight / deviceWidth) * 1000) / 100...
AST#method_declaration#Left onWindowSizeChange 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 { // [StartExclude index_page1] AST#statement#Left AST#variable_declaration#Left let AST#var...
onWindowSizeChange(): void { let deviceWidth: number = AppStorage.get<number>('deviceWidth') || 0; if (this.isFullLandscapeScreen && Math.round((this.deviceHeight / deviceWidth) * 1000) / 1000 === 0.563) { this.isFloatWindow = true; } else if (this.isFullScreen && (Math.round((deviceWi...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/pages/IndexPage.ets#L234-L248
5d9be6b10962f0bf6e98401ced1511d35a670c53
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/StudyTimeManager.ets
arkts
updateStudyTime
更新学习时长到数据库
private async updateStudyTime(): Promise<void> { if (!this.isTracking || this.startTime === 0) { return } try { const currentTime = Date.now() const sessionTime = Math.floor((currentTime - this.startTime) / 1000 / 60) // 转换为分钟 if (sessionTime > this.totalSessionTime) { ...
AST#method_declaration#Left private async updateStudyTime 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 > A...
private async updateStudyTime(): Promise<void> { if (!this.isTracking || this.startTime === 0) { return } try { const currentTime = Date.now() const sessionTime = Math.floor((currentTime - this.startTime) / 1000 / 60) if (sessionTime > this.totalSessionTime) { const ...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/StudyTimeManager.ets#L57-L79
1998369078cd1b9b58fccdaf83137054555f89a4
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/NetworkClient.ets
arkts
网络客户端 管理 Axios 实例和拦截器配置。 @author Joker.X
export class NetworkClient { // 单例实例 private static instance: NetworkClient; // Axios 实例 private axiosInstance: AxiosInstance; // 基础 URL private readonly BASE_URL = 'https://mall.dusksnow.top/app/'; private constructor() { this.axiosInstance = axios.create({ baseURL: this.BASE_URL, timeou...
AST#export_declaration#Left export AST#class_declaration#Left class NetworkClient AST#class_body#Left { // 单例实例 AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left NetworkClient AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // Axios ...
export class NetworkClient { private static instance: NetworkClient; private axiosInstance: AxiosInstance; private readonly BASE_URL = 'https://mall.dusksnow.top/app/'; private constructor() { this.axiosInstance = axios.create({ baseURL: this.BASE_URL, timeout: 10000, headers: { ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/NetworkClient.ets#L10-L53
279d1a526158963aa824c252c3b1aa74a4496346
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Linear.ets
arkts
bodyBuilder
内容展示(自定义builder渲染)
@Builder bodyBuilder() { Column(){ // Row 行组件 Text('Row 行组件') .fontSize(14) .margin({ top:20, bottom: 12}) // 横向居中 alignItems(Center),间距为10 Text('横向居中 alignItems(Center),间距为10').fontSize(14).width('100%') Row({ space: 10}) { Row().width('25%').height(30).backgr...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder 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 { // Row 行组件 AST#ar...
@Builder bodyBuilder() { Column(){ Text('Row 行组件') .fontSize(14) .margin({ top:20, bottom: 12}) Text('横向居中 alignItems(Center),间距为10').fontSize(14).width('100%') Row({ space: 10}) { Row().width('25%').height(30).backgroundColor(0xAFEEEE) Row().width('2...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Linear.ets#L61-L258
3c821464b502758c0668a729013b38313b49b334
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/LotteryDialog.ets
arkts
LotteryDetails
中奖页面
@Component export struct LotteryDetails { //关闭弹窗 @State closeDialog: boolean = true @Prop user_id: number @Prop room_id: string @Prop nickname: string @State receive_award_way: number = 0; @State bol: boolean = true @Consume lotteryResultNotice: VHLotteryResultNoticeModel | null @Consume lotteryPush: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LotteryDetails AST#ERROR#Left { //关闭弹窗 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right closeDialog : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_...
@Component export struct LotteryDetails { @State closeDialog: boolean = true @Prop user_id: number @Prop room_id: string @Prop nickname: string @State receive_award_way: number = 0; @State bol: boolean = true @Consume lotteryResultNotice: VHLotteryResultNoticeModel | null @Consume lotteryPush: VHLott...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/LotteryDialog.ets#L139-L160
a0829e9574892ce4fb25b5adb3e0a2f150a81ae3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AvoidTimeComsume/entry/src/main/ets/views/NegativeOfGrid.ets
arkts
[StartExclude negative_of_grid] [EndExclude negative_of_grid] [End negative_of_grid]
build() { Column() { Image($r('app.media.app_icon')) .width(48) .height(48) .margin({ bottom: 12 }) Text(`image${this.item}`) .fontSize(12) .textAlign(TextAlign.Center) } .width('100%') .height(82) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left AST#resource_expression#Lef...
build() { Column() { Image($r('app.media.app_icon')) .width(48) .height(48) .margin({ bottom: 12 }) Text(`image${this.item}`) .fontSize(12) .textAlign(TextAlign.Center) } .width('100%') .height(82) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/NegativeOfGrid.ets#L133-L145
9ca51e005b84739f50c79f0a6306e8d5ee4e1ebc
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
readC2
读取C2部分 @param sm2_sequence sm2序列工具 @param data 待读取的数据 @returns C2部分
private readC2(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith(ASN1Util.OCTEN_STRING)) { data = data.slice(ASN1Util.OCTEN_STRING.length, data.length); let C2_lenHex = this.getLenHex(data); data = data.slice(C2_lenHex.length, data.length); if (this.lenHex2number(C2_lenH...
AST#method_declaration#Left private readC2 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
private readC2(sm2_sequence: SM2Sequence, data: string): string { if (data.startsWith(ASN1Util.OCTEN_STRING)) { data = data.slice(ASN1Util.OCTEN_STRING.length, data.length); let C2_lenHex = this.getLenHex(data); data = data.slice(C2_lenHex.length, data.length); if (this.lenHex2number(C2_lenH...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L232-L245
adbf9e3989662bdf5d6df63149304eac414b69de
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/MultipleDialog/entry/src/main/ets/viewmodel/HobbyModel.ets
arkts
Hobby info model.
export default class HobbyModel { /** * Hobby title */ label: string = ''; /** * Hobby check status */ isChecked: boolean = false; }
AST#export_declaration#Left export default AST#class_declaration#Left class HobbyModel AST#class_body#Left { /** * Hobby title */ AST#property_declaration#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Rig...
export default class HobbyModel { label: string = ''; isChecked: boolean = false; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/MultipleDialog/entry/src/main/ets/viewmodel/HobbyModel.ets#L19-L29
4d06389c8f8c17298e8dd8459d99d3d89686f821
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/WebSocket_case/entry/src/main/ets/pages/Index.ets
arkts
connectWebSocket
[Start websocket_development_steps] 连接WebSocket
connectWebSocket() { this.connectionStatus = 'Connecting...'; this.sendMessageResult = ''; this.closeConnectionResult = ''; if (this.isConnect) { this.connectionStatus = 'WebSocket is already connected'; return; } this.ws = webSocket.createWebSocket(); this.ws.on('open', (err: ...
AST#method_declaration#Left connectWebSocket 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 . connectionStatus AST#member_expre...
connectWebSocket() { this.connectionStatus = 'Connecting...'; this.sendMessageResult = ''; this.closeConnectionResult = ''; if (this.isConnect) { this.connectionStatus = 'WebSocket is already connected'; return; } this.ws = webSocket.createWebSocket(); this.ws.on('open', (err: ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/WebSocket_case/entry/src/main/ets/pages/Index.ets#L108-L173
d5dc5d3ccfa8a1313d8e46f0e01c053afc41b751
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
arkts
TODO SM4加解密 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class SM4 { /** * 加密(GCM模式),异步 * @param data 加密或者解密的数据。data不能为null。 * @param symKey 指定加密或解密的密钥。 * @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 * @returns */ static async encryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.Sym...
AST#export_declaration#Left export AST#class_declaration#Left class SM4 AST#class_body#Left { /** * 加密(GCM模式),异步 * @param data 加密或者解密的数据。data不能为null。 * @param symKey 指定加密或解密的密钥。 * @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 * @returns */ AST#method_dec...
export class SM4 { static async encryptGCM(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYP...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L25-L376
4c0dc248ed54fdb7ac635830ecf3e07a1c85d6de
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets
arkts
定义3D立方体旋转动画轮播项的数据类型。 每个轮播项包含一个主标题 (title)、一个副标题 (subTitle) 和一个图像资源 (image)。
export class MySwiperItem { title: string; subTitle: string; image: Resource; constructor(title: string, subTitle: string, image: Resource) { this.title = title; this.subTitle = subTitle; this.image = image; } }
AST#export_declaration#Left export AST#class_declaration#Left class MySwiperItem AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left subTitle : AS...
export class MySwiperItem { title: string; subTitle: string; image: Resource; constructor(title: string, subTitle: string, image: Resource) { this.title = title; this.subTitle = subTitle; this.image = image; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets#L79-L89
1a449705b77809ffd30b42c10956b44901558410
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/SimpleAIService.ets
arkts
GenerationParams
导出接口供Index使用
export { GenerationParams, GiftRequestParams };
AST#export_declaration#Left export { GenerationParams , GiftRequestParams } ; AST#export_declaration#Right
export { GenerationParams, GiftRequestParams };
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L56-L56
485b178807eb618946b9d9cfc2388abd3a74a05f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/utils/NetRequest.ets
arkts
Download picture resources from the Internet through the http request method
export function httpRequest(): void { hiTraceMeter.startTrace('Http Request', 1); http.createHttp() // The actual development needs to "https://www.example1.com/POST?e=f&g=h"replaced with the real website address to visit .request('https://www.example1.com/POST?e=f&g=h', (error: BusinessError, data: htt...
AST#export_declaration#Left export AST#function_declaration#Left function httpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AS...
export function httpRequest(): void { hiTraceMeter.startTrace('Http Request', 1); http.createHttp() .request('https://www.example1.com/POST?e=f&g=h', (error: BusinessError, data: http.HttpResponse) => { if (error) { return; } transcodePixelMap(data)...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/utils/NetRequest.ets#L9-L23
66be954473a4e0147df06bcc13ad6d06c66c00de
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets
arkts
KeyboardAvoid
功能描述: 本示例介绍使用TextInput组件和LazyForEach实现组件随软键盘弹出避让场景 推荐场景: 需要用户手动输入文字的场景 核心组件: 1. KeyboardAvoid.liftUpComponents 2. KeyboardAvoid.scalingComponents 实现步骤: 1. 在输入按钮的点击事件中调用focusControl.requestFocus API,即可实现给TextInput组件申请焦点功能 2. 通过监听键盘高度,可以感知到键盘的拉起收起状态,实现缩放组件尺寸的调整,配合KeyboardAvoidMode.RESIZE避让模式,实现组件上抬压缩效果
@Component export struct KeyboardAvoid { @State keyboardHeight: number = 0; // 软键盘高度 @State contentData: string[] = ['第一条数据', '第二条数据', '第三条数据', '第四条数据', '第五条数据', '第六条数据', '第七条数据', '第八条数据', '第九条数据', '第十条数据', '第十一条数据', '第十二条数据']; @State isLiftUpShow: boolean = true; @State isScalingShow: boolean = false...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct KeyboardAvoid AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right keyboardHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#ty...
@Component export struct KeyboardAvoid { @State keyboardHeight: number = 0; @State contentData: string[] = ['第一条数据', '第二条数据', '第三条数据', '第四条数据', '第五条数据', '第六条数据', '第七条数据', '第八条数据', '第九条数据', '第十条数据', '第十一条数据', '第十二条数据']; @State isLiftUpShow: boolean = true; @State isScalingShow: boolean = false; @Sto...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/keyboardavoid/src/main/ets/components/KeyboardAvoidIndex.ets#L33-L238
5c6d18613a8899a138b90bc4ba96671ea1b18424
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets
arkts
onExitPhotoBrowser
退出大图页回调
private onExitPhotoBrowser(photoBrowserInfo: PhotoBrowserInfo): boolean { console.info('onExitPhotoBrowser' + JSON.stringify(photoBrowserInfo)); return false; }
AST#method_declaration#Left private onExitPhotoBrowser AST#parameter_list#Left ( AST#parameter#Left photoBrowserInfo : AST#type_annotation#Left AST#primary_type#Left PhotoBrowserInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_ty...
private onExitPhotoBrowser(photoBrowserInfo: PhotoBrowserInfo): boolean { console.info('onExitPhotoBrowser' + JSON.stringify(photoBrowserInfo)); return false; }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets#L126-L129
4fed348e6248e33dbfc56b84db909e889b68005f
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
goGreetingSend
跳转到祝福语发送页面 @param contactId 联系人ID @param greetingId 祝福语ID(可选)
async goGreetingSend(contactId: string, greetingId?: string): Promise<void> { const params: RouteParams = { contactId: contactId, greetingId: greetingId }; const options: RouteOptions = { params: params }; await this.push(RoutePaths.GREETING_SEND, options); }
AST#method_declaration#Left async goGreetingSend 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#Left greetingId ? : AST#type_annotation#Left AST#primary_type#Left string A...
async goGreetingSend(contactId: string, greetingId?: string): Promise<void> { const params: RouteParams = { contactId: contactId, greetingId: greetingId }; const options: RouteOptions = { params: params }; await this.push(RoutePaths.GREETING_SEND, options); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L295-L299
4e92b350d1164c6241f0ab80818c945db052cc0b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/auth/AuthNavigator.ets
arkts
toLogin
跳转到登录主页 @returns {void} 无返回值
static toLogin(): void { navigateTo(AuthRoutes.Login); }
AST#method_declaration#Left static toLogin AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_expre...
static toLogin(): void { navigateTo(AuthRoutes.Login); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/auth/AuthNavigator.ets#L13-L15
c8162902a9444e1d6ea8c3b48fbfa8fb8514894a
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/WeatherManager.ets
arkts
getRandomWeatherText
获取随机天气描述
private getRandomWeatherText(): string { const weatherTexts = ['晴', '多云', '阴', '小雨', '中雨', '雷阵雨', '雨夹雪']; return weatherTexts[Math.floor(Math.random() * weatherTexts.length)]; }
AST#method_declaration#Left private getRandomWeatherText AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator...
private getRandomWeatherText(): string { const weatherTexts = ['晴', '多云', '阴', '小雨', '中雨', '雷阵雨', '雨夹雪']; return weatherTexts[Math.floor(Math.random() * weatherTexts.length)]; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/WeatherManager.ets#L157-L160
dffe51e7386473bd932dedc943048c4d20352e51
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ComponentReuse/entry/src/main/ets/view/UsageRules.ets
arkts
[End usage_rules] xxx.ets
export class Message { value: string | undefined; constructor(value: string) { this.value = value } }
AST#export_declaration#Left export AST#class_declaration#Left class Message AST#class_body#Left { AST#property_declaration#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_...
export class Message { value: string | undefined; constructor(value: string) { this.value = value } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/UsageRules.ets#L18-L25
d6d55b2d26c7ff2d052fafc6f28d9c031f3d6ed4
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_json/src/main/ets/json/JSONObject.ets
arkts
convertString
迭代转换json @param iter 迭代器 @returns json字符串
private convertString(iter: IterableIterator<string>, map?: HashMap<string, JSONValue>): string { //转换的字符串 let sb: StringBuilder = new StringBuilder(); //拼接左括号 sb.append(Const.zkh); // 是否为第一个字符 let isFirst: boolean = true; //迭代获取值转换成字符串 for (const key of iter) { if (!isFirst) { ...
AST#method_declaration#Left private convertString AST#parameter_list#Left ( AST#parameter#Left iter : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left IterableIterator AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > A...
private convertString(iter: IterableIterator<string>, map?: HashMap<string, JSONValue>): string { let sb: StringBuilder = new StringBuilder(); sb.append(Const.zkh); let isFirst: boolean = true; for (const key of iter) { if (!isFirst) { sb.append(Const.dh); ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONObject.ets#L187-L251
ca69501f2165a815fad0ebe09321c51df804954a
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/ScanUtils.ets
arkts
decode
识别二维码图片 @param imagePath 本地图片地址 @param options @returns
static decode(imagePath: string, options: scanBarcode.ScanOptions = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: false }): Promise<Array<scanBarcode.ScanResult>> { return new Promise<Array<scanBarcode.ScanResult>>((resolve, reject) => { try { detectBarcode.de...
AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left imagePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L...
static decode(imagePath: string, options: scanBarcode.ScanOptions = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: false }): Promise<Array<scanBarcode.ScanResult>> { return new Promise<Array<scanBarcode.ScanResult>>((resolve, reject) => { try { detectBarcode.de...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ScanUtils.ets#L34-L53
27684c50255ac61d675c396dfeeed26a0831e745
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/Utils.ets
arkts
isNotEmpty
判断字符串是否为非空。true为非空空,否则false @param str @returns
static isNotEmpty(str: string | undefined | null): boolean { return false === Utils.isEmpty(str); }
AST#method_declaration#Left static isNotEmpty AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Ri...
static isNotEmpty(str: string | undefined | null): boolean { return false === Utils.isEmpty(str); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/Utils.ets#L41-L43
47f55a15c6a96fe7b4f86538bd287849ecb4627f
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets
arkts
pushData
TODO:知识点:存储数据到懒加载数据源中
pushData(data: Comment): void { this.comments.push(data); // 在数组头部添加数据 this.notifyDataAdd(this.comments.length - 1); }
AST#method_declaration#Left pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Comment 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 AST...
pushData(data: Comment): void { this.comments.push(data); this.notifyDataAdd(this.comments.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/model/CommentModel.ets#L117-L121
3078f697e0e9fcfb48fec6fb29ee24b637ebf3fe
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsDetailRichImageItem.ets
arkts
构建商品详情图片项 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium") } }) { NetWorkImage({ model: this.pic, widthValue: P100, imageFit: ImageFit.Contain, ...
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 ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width...
build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium") } }) { NetWorkImage({ model: this.pic, widthValue: P100, imageFit: ImageFit.Contain, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailRichImageItem.ets#L25-L44
93034fa31214b0df3ad2d1c2f6b16e6ab05b0253
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/model/BannerModel.ets
arkts
{ "desc": "我们支持订阅啦~", "id": 30, "imagePath": "https://www.wanandroid.com/blogimgs/42da12d8-de56-4439-b40c-eab66c227a4b.png", "isVisible": 1, "order": 2, "title": "我们支持订阅啦~", "type": 0, "url": "https://www.wanandroid.com/blog/show/3352" }
export class Banner { id: number; desc: string; imagePath: string; isVisible: number; type: number; order: number; title: string; url: string; }
AST#export_declaration#Left export AST#class_declaration#Left class Banner AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left desc : AST#type_annota...
export class Banner { id: number; desc: string; imagePath: string; isVisible: number; type: number; order: number; title: string; url: string; }
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/model/BannerModel.ets#L13-L22
3a427c8894e2cdae239e2c7463b937ba10f4c104
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/SimpleAIService.ets
arkts
getCurrentConfig
获取当前配置
getCurrentConfig(): AIModelConfig | null { return this.currentConfig; }
AST#method_declaration#Left getCurrentConfig AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AIModelConfig AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_stateme...
getCurrentConfig(): AIModelConfig | null { return this.currentConfig; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L105-L107
d9ecbc868a2115036d283d5483b477ee09d53c82
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets
arkts
calculateLayoutConfig
调整布局
calculateLayoutConfig() { this.mCoordinateLineEndX = this.viewWidth - PADDING_HORIZONTAL; this.mOffset = (this.viewWidth - START_X - PADDING_HORIZONTAL * 2) / (SIZE - 1); this.mHeightRatio = (this.viewHeight - PADDING_VERTICAL * 2 - X_COORDINATE_TEXT_HEIGHT * 2) / MAX_HEART_RATE; let heartRateCoordinate...
AST#method_declaration#Left calculateLayoutConfig 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 . mCoordinateLine...
calculateLayoutConfig() { this.mCoordinateLineEndX = this.viewWidth - PADDING_HORIZONTAL; this.mOffset = (this.viewWidth - START_X - PADDING_HORIZONTAL * 2) / (SIZE - 1); this.mHeightRatio = (this.viewHeight - PADDING_VERTICAL * 2 - X_COORDINATE_TEXT_HEIGHT * 2) / MAX_HEART_RATE; let heartRateCoordinate...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets#L90-L98
b1d302e1a40ce4b3e2daec98e213cbafdc8492ca
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
fontWeight
export const FONT_WEIGHT_400: number = 400;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left FONT_WEIGHT_400 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 400 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declara...
export const FONT_WEIGHT_400: number = 400;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L83-L83
20dfac3747113ff5264d2fcfc4a93ea48bc3906a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets
arkts
定义城市类型类 name: 数据名称的首字母 dataList: 字母对应的列表数据
export class AlphabetListItemType { name: string; dataList: string[]; constructor(name: string, dataList: string[]) { this.name = name; this.dataList = dataList; } }
AST#export_declaration#Left export AST#class_declaration#Left class AlphabetListItemType AST#class_body#Left { AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left dataLi...
export class AlphabetListItemType { name: string; dataList: string[]; constructor(name: string, dataList: string[]) { this.name = name; this.dataList = dataList; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/citysearch/src/main/ets/model/DetailData.ets#L37-L45
42347bd2bcdeeea59223d615ff50982a0dc28497
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
lstatSync
获取链接文件信息,以同步方法。 @param path string 文件的应用沙箱路径。 @returns
static lstatSync(path: string): fs.Stat { return fs.lstatSync(path); }
AST#method_declaration#Left static lstatSync AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ...
static lstatSync(path: string): fs.Stat { return fs.lstatSync(path); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L726-L728
28075544b6a429ebbde4e185edf769ceb344442a
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/NavigationResultViewModel.ets
arkts
updateDescInput
更新说明输入 @param {string} value - 说明输入内容 @returns {void} 无返回值
updateDescInput(value: string): void { this.descInput = value; }
AST#method_declaration#Left updateDescInput AST#parameter_list#Left ( AST#parameter#Left value : 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#Ri...
updateDescInput(value: string): void { this.descInput = value; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NavigationResultViewModel.ets#L35-L37
193cf68f0c4ba6c5bd9adf754822e77405e728aa
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
isSystemDarkMode
判断是否为系统深色模式
private isSystemDarkMode(): boolean { const hour = new Date().getHours(); return hour < 7 || hour >= 19; // 简单的时间判断 }
AST#method_declaration#Left private isSystemDarkMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Le...
private isSystemDarkMode(): boolean { const hour = new Date().getHours(); return hour < 7 || hour >= 19; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L818-L821
1604fbdbdd4514649a01fc7235259e6a19eec182
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.Dialog.d.ets
arkts
LoadingDialog
Declare CustomDialog LoadingDialog @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare CustomDialog LoadingDialog @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare CustomDialog LoadingDialog @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
@CustomDialog export declare struct LoadingDialog { /** * Sets the LoadingDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Sets the LoadingDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability....
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct LoadingDialog AST#component_body#Left { /** * Sets the LoadingDialog Controller. * @type { CustomDialogController }. * @syscap SystemCapability.ArkUI.ArkUI.Full * ...
@CustomDialog export declare struct LoadingDialog { Controller: CustomDialogController; content?: ResourceStr; theme?: Theme | CustomTheme; themeColorMode?: ThemeColorMode; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.Dialog.d.ets#L1011-L1077
3a5e325c6988c8b7261bb165216c8e2a6d978cc7
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/ConfigService.ets
arkts
摄像头设备接口
export interface CameraDevice { id: string; name: string; status: string; ip?: string; port?: number; username?: string; password?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface CameraDevice AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AS...
export interface CameraDevice { id: string; name: string; status: string; ip?: string; port?: number; username?: string; password?: string; }
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L28-L36
a68ffeafaaeb145742059c6011b7db9a7496e098
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
readTextSync
基于文本方式读取文件(即直接读取文件的文本内容),以同步方法。 @param filePath 文件的应用沙箱路径。 @param options 支持如下选项: offset,number类型,表示期望读取文件的位置。可选,默认从当前位置开始读取。 length,number类型,表示期望读取数据的长度。可选,默认文件长度。 encoding,string类型,当数据是 string 类型时有效,表示数据的编码方式,默认 'utf-8',仅支持 'utf-8'。 @returns
static readTextSync(filePath: string, options?: ReadTextOptions): string { return fs.readTextSync(filePath, options); }
AST#method_declaration#Left static readTextSync AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left ReadTextOptio...
static readTextSync(filePath: string, options?: ReadTextOptions): string { return fs.readTextSync(filePath, options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L464-L466
f82e399e0f4f900a75297f5ab192bb3ced5d8110
gitee
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/viewmodel/CommandEntryListViewModel.ets
arkts
updateEntriesOrder
私有方法 删除条目后,重新计算每个指令条目的位置 并同步到数据库
private async updateEntriesOrder(): Promise<boolean> { // 重新设置当前列表条目的位置下标,生成新的列表 const reorderedEntriesWithNewIndex = this.commandEntries.map((entry, index) => { entry.orderIndex = index; return entry; }); // 提取新列表的 [id - 位置] 下标映射(长度为2的数组) const updatePay...
AST#method_declaration#Left private async updateEntriesOrder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Rig...
private async updateEntriesOrder(): Promise<boolean> { const reorderedEntriesWithNewIndex = this.commandEntries.map((entry, index) => { entry.orderIndex = index; return entry; }); const updatePayload = reorderedEntriesWithNewIndex.map((entry, index) => ...
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/viewmodel/CommandEntryListViewModel.ets#L114-L131
68f86362e150cd886bd31fe2b221681985fadec1
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildTabItem
Tab项
@Builder buildTabItem(icon: string, title: string, index: number) { Column({ space: 4 }) { Text(icon) .fontSize(20) .opacity(this.currentTab === index ? 1 : 0.6) Text(title) .fontSize(10) .fontColor(this.currentTab === index ? this.COLORS.primary : this.COLORS.textTert...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabItem AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left A...
@Builder buildTabItem(icon: string, title: string, index: number) { Column({ space: 4 }) { Text(icon) .fontSize(20) .opacity(this.currentTab === index ? 1 : 0.6) Text(title) .fontSize(10) .fontColor(this.currentTab === index ? this.COLORS.primary : this.COLORS.textTert...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3940-L3958
74bba16edc44c242da892a9daab38da3ce461973
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Connectivity/UploadAndDownLoad/features/uploadanddownload/src/main/ets/download/model/FileModel.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 enum FileType { FOLDER = 'folder', IMAGE = 'image', Video = 'video', MUSIC = 'music', DOCUMENT = 'document' }
AST#export_declaration#Left export AST#enum_declaration#Left enum FileType AST#enum_body#Left { AST#enum_member#Left FOLDER = AST#expression#Left 'folder' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left IMAGE = AST#expression#Left 'image' AST#expression#Right AST#enum_member#Right , AST#enum_member#Le...
export enum FileType { FOLDER = 'folder', IMAGE = 'image', Video = 'video', MUSIC = 'music', DOCUMENT = 'document' }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Connectivity/UploadAndDownLoad/features/uploadanddownload/src/main/ets/download/model/FileModel.ets#L16-L22
099bcf54214b981f83688d62986609a90a7faa61
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cuberotateanimation/Index.ets
arkts
CubeRotateAnimationSwiper
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { CubeRotateAnimationSwiper } from './src/main/ets/components/CubeRotateAnimationSwiper';
AST#export_declaration#Left export { CubeRotateAnimationSwiper } from './src/main/ets/components/CubeRotateAnimationSwiper' ; AST#export_declaration#Right
export { CubeRotateAnimationSwiper } from './src/main/ets/components/CubeRotateAnimationSwiper';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/Index.ets#L29-L29
4c47added0e31b1e1a6242e8d4b06685d1123ab4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/router/AppRouter.ets
arkts
goCalendar
跳转到日历页面
async goCalendar(): Promise<void> { await this.push(RoutePaths.CALENDAR); }
AST#method_declaration#Left async goCalendar 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_argum...
async goCalendar(): Promise<void> { await this.push(RoutePaths.CALENDAR); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/router/AppRouter.ets#L250-L252
e6a8acf38e203d8ade118c9d8a4535664add995c
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
get
是否全选 @returns {boolean} 是否全选
get isAllSelected(): boolean { if (this.cartList.length === 0) { return false; } for (const cart of this.cartList) { for (const spec of cart.spec) { const key = `${cart.goodsId}_${spec.id}`; if (!this.selectedSpecIds.has(key)) { return false; } } } ...
AST#method_declaration#Left get AST#ERROR#Left isAllSelected AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#express...
get isAllSelected(): boolean { if (this.cartList.length === 0) { return false; } for (const cart of this.cartList) { for (const spec of cart.spec) { const key = `${cart.goodsId}_${spec.id}`; if (!this.selectedSpecIds.has(key)) { return false; } } } ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L71-L84
c2531697c7a0556ebedf574403249197ea53206f
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
calculateCompletionTimeAnalysis
计算任务完成时间分析
private calculateCompletionTimeAnalysis(): CompletionTimeAnalysis { const completedTasks = this.getCompletedTasks().filter(task => task.completedAt && task.timeRecord?.totalTimeSpent); if (completedTasks.length === 0) { return { averageCompletionTime: 0, fastestCompletion: 0, slow...
AST#method_declaration#Left private calculateCompletionTimeAnalysis AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CompletionTimeAnalysis AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left co...
private calculateCompletionTimeAnalysis(): CompletionTimeAnalysis { const completedTasks = this.getCompletedTasks().filter(task => task.completedAt && task.timeRecord?.totalTimeSpent); if (completedTasks.length === 0) { return { averageCompletionTime: 0, fastestCompletion: 0, slow...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L586-L624
e468febc83672c4832be7640f6c48fc01fed420c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/EmitterUtil.ets
arkts
off
取消事件订阅,支持取消指定事件回调 @param eventId 事件ID,string类型的eventId不支持空字符串。 @param callback 取消该事件的回调处理函数。不传callback,取消事件ID为eventId的所有订阅
static off<T>(eventId: string | number, callback?: Callback<emitter.GenericEventData<T>>) { if (callback) { emitter.off(eventId.toString(), callback); } else { emitter.off(eventId.toString()); //取消事件ID为eventId的所有订阅 } }
AST#method_declaration#Left static off AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left...
static off<T>(eventId: string | number, callback?: Callback<emitter.GenericEventData<T>>) { if (callback) { emitter.off(eventId.toString(), callback); } else { emitter.off(eventId.toString()); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/EmitterUtil.ets#L107-L113
af673cabd74ec701b836ff39cbb4cdbc785f30a0
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
setDefaultConfig
默认样式 设置默认统一样式 @param configs
static setDefaultConfig(configs: (config: DialogConfig) => void): void { configs(DialogUtil.defaultConfig); }
AST#method_declaration#Left static setDefaultConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left DialogConfig AST#primary_type#Right AST#type_annotation#Right AS...
static setDefaultConfig(configs: (config: DialogConfig) => void): void { configs(DialogUtil.defaultConfig); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L44-L46
3a1fb1c05f10834c41f258bdd504857e7849c47c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AuthRepository.ets
arkts
@file 认证相关仓库类,封装认证模块请求 @author Joker.X
export class AuthRepository { /** * 认证网络数据源 */ private networkDataSource: AuthNetworkDataSource; /** * 构造函数 * @param networkDataSource 可选的认证网络数据源实例 */ constructor(networkDataSource?: AuthNetworkDataSource) { this.networkDataSource = networkDataSource ?? new AuthNetworkDataSourceImpl(); } ...
AST#export_declaration#Left export AST#class_declaration#Left class AuthRepository AST#class_body#Left { /** * 认证网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left AuthNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property_d...
export class AuthRepository { private networkDataSource: AuthNetworkDataSource; constructor(networkDataSource?: AuthNetworkDataSource) { this.networkDataSource = networkDataSource ?? new AuthNetworkDataSourceImpl(); } async loginByWxApp(params: Record<string, string>): Promise<NetworkResponse<Aut...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AuthRepository.ets#L8-L92
f541ed8fc2303f88758f35988b1ff68c075a64da
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/Encode.ets
arkts
加密或者解密 @param plainText 加密或者解密内容 @param cryptoMode 加密或者解密模式 cryptoFramework.CryptoMode.DECRYPT_MODE--解密模式、cryptoFramework.CryptoMode.ENCRYPT_MODE--加密模式 @returns
export async function encryptMessagePromise(plainText: string, cryptoMode: cryptoFramework.CryptoMode) { let base = new util.Base64Helper(); // 通过指定算法名称,获取相应的Cipher实例。Cipher:提供加解密的算法操作功能。 let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7'); // 通过指定算法名称的字符串,获取相应的对称密钥生成器实例 let symKeyGenerator = cryp...
AST#export_declaration#Left export AST#function_declaration#Left async function encryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left plainText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cryptoMode : AST#...
export async function encryptMessagePromise(plainText: string, cryptoMode: cryptoFramework.CryptoMode) { let base = new util.Base64Helper(); let cipher = cryptoFramework.createCipher('AES128|ECB|PKCS7'); let symKeyGenerator = cryptoFramework.createSymKeyGenerator('AES128'); let keyMaterialBlob = genKeyM...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/livedetectionandencryptiond/src/main/ets/components/Encode.ets#L52-L77
a9e565c00d5b44d3e8d7344dce6170ecf9945497
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/util/ImageUtil.ets
arkts
计算,当固定容器宽高,选择Contain模式后,图片的实际宽高 @param componentW 容器宽 @param componentH @param imageW 图片宽 @param imageH @returns
export function getContainSize(componentW: number, componentH: number, imageW: number, imageH: number): Size { const size: Size = new Size(); const isWidthMax: boolean = componentW / componentH - imageW / imageH <= 0; if (isWidthMax) { size.width = componentW; size.height = componentW / imageW * imageH; ...
AST#export_declaration#Left export AST#function_declaration#Left function getContainSize AST#parameter_list#Left ( AST#parameter#Left componentW : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left componentH : AST#type_annotat...
export function getContainSize(componentW: number, componentH: number, imageW: number, imageH: number): Size { const size: Size = new Size(); const isWidthMax: boolean = componentW / componentH - imageW / imageH <= 0; if (isWidthMax) { size.width = componentW; size.height = componentW / imageW * imageH; ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Media/Image/photomodify/src/main/ets/components/util/ImageUtil.ets#L24-L36
50afaf19cf20c40cd022a4285eac8b119b5a57fd
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/icon/ArrowLeftIcon.ets
arkts
构建左箭头图标 @returns {void} 无返回值
build(): void { CommonIcon({ icon: $r("app.media.ic_left"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left CommonIcon ( AST#component_parameters#Left { AST#component_parameter#Left icon : AST#expression#Left AST#resource_expression...
build(): void { CommonIcon({ icon: $r("app.media.ic_left"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/ArrowLeftIcon.ets#L29-L36
fb6e3cd1ac7c9efa71d564364cb8bb3a88464ce4
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/foldableRouter/FoldableRouter.ets
arkts
设置导航栏显示改变模式枚举值
export enum NavMode { DefaultMode, // 默认模式 FoldMode, // 折叠模式 ChildPageMode, // 进入子页面模式 HomePageMode // 返回首页模式 }
AST#export_declaration#Left export AST#enum_declaration#Left enum NavMode AST#enum_body#Left { AST#enum_member#Left DefaultMode AST#enum_member#Right , // 默认模式 AST#enum_member#Left FoldMode AST#enum_member#Right , // 折叠模式 AST#enum_member#Left ChildPageMode AST#enum_member#Right , // 进入子页面模式 AST#enum_member#Left HomePag...
export enum NavMode { DefaultMode, FoldMode, ChildPageMode, HomePageMode }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/foldableRouter/FoldableRouter.ets#L27-L32
aea560f8067c87d104dcec1f11c325524cb77855
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppSettings.ets
arkts
MARK: - QQ config
export class CfgQQ { static readonly AppId = "1105391403" //QQ: WordTree static readonly AppKey = "loNT3AlvXvEbSmb0" static readonly Url = "https://www.dancishu.com" }
AST#export_declaration#Left export AST#class_declaration#Left class CfgQQ AST#class_body#Left { AST#property_declaration#Left static readonly AppId = AST#expression#Left "1105391403" AST#expression#Right //QQ: WordTree AST#property_declaration#Right AST#property_declaration#Left static readonly AppKey = AST#expression...
export class CfgQQ { static readonly AppId = "1105391403" static readonly AppKey = "loNT3AlvXvEbSmb0" static readonly Url = "https://www.dancishu.com" }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppSettings.ets#L40-L45
30415e32f17acefaf39ee393557074f0c77be1f7
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
getSolarTerms
获取二十四节气
public static getSolarTerms(): FestivalInfo[] { return SOLAR_TERMS; }
AST#method_declaration#Left public static getSolarTerms AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FestivalInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#retur...
public static getSolarTerms(): FestivalInfo[] { return SOLAR_TERMS; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L214-L216
df2facb1b52de2ccd3b6bbae29cf6c4fdd6882e6
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/utils/GestureUtils.ets
arkts
calculateSwipeProgress
计算滑动进度 @param deltaX - X轴位移 @param cardWidth - 卡片宽度 @returns 滑动进度(0-1)
static calculateSwipeProgress(deltaX: number, cardWidth: number): number { const progress: number = Math.abs(deltaX) / cardWidth; return Math.min(progress, 1); }
AST#method_declaration#Left static calculateSwipeProgress AST#parameter_list#Left ( AST#parameter#Left deltaX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cardWidth : AST#type_annotation#Left AST#primary_type#Left numbe...
static calculateSwipeProgress(deltaX: number, cardWidth: number): number { const progress: number = Math.abs(deltaX) / cardWidth; return Math.min(progress, 1); }
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L197-L200
e9240cff6413b23540f66b1d5c53b6dcb79dc05b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/ShareInfo.ets
arkts
分享信息
export interface ShareInfo { // 是否下载类别 isDownloadType: boolean; // 图片 image: Resource; // 标题 title: string; // 点击事件 onClick?: () => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShareInfo AST#object_type#Left { // 是否下载类别 AST#type_member#Left isDownloadType : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 图片 AST#type_member#Left image : ...
export interface ShareInfo { isDownloadType: boolean; image: Resource; title: string; onClick?: () => void; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/ShareInfo.ets#L20-L32
fc74b716a921e8365d409a6a155920faeeedf48f
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/viewmodel/Chat/ChatPhotoNodeController.ets
arkts
ChatPhotoBuilder
async function customGetImage(context: Context, src: string | PixelMap | Resource): Promise<ArrayBuffer | undefined> { let pixelMap = createCircleLetterPixelMap("T", undefined); let info = pixelMap.getImageInfoSync(); let size = info.size.width * info.size.height * 4 * 2; let buffer = new ArrayBuffer(size); pixelMap.re...
@Builder async function ChatPhotoBuilder(data: ChatPhotoData, myThis?: Object | undefined) { ImageKnifeComponent({ imageKnifeOption: new ImageKnifeOption({ loadSrc: "file://" + data.path, placeholderSrc: data.thumb, // errorholderSrc: createCircleLetterPixelMap("T", myThis), errorholderSrc...
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right async function ChatPhotoBuilder AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ChatPhotoData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L...
@Builder async function ChatPhotoBuilder(data: ChatPhotoData, myThis?: Object | undefined) { ImageKnifeComponent({ imageKnifeOption: new ImageKnifeOption({ loadSrc: "file://" + data.path, placeholderSrc: data.thumb, errorholderSrc: $r('app.media.fallback_vibrant_orange_gradient'), o...
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/viewmodel/Chat/ChatPhotoNodeController.ets#L68-L86
0c327b8045c5bbfaca1bec91157fcd483a60263a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/LinkView.ets
arkts
shareUrl
分享URL功能
private shareUrl() { ShareUtils.shareLink(this.url, getString(this.title)) }
AST#method_declaration#Left private shareUrl 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 ShareUtils AST#expression#Right . shareLink AST...
private shareUrl() { ShareUtils.shareLink(this.url, getString(this.title)) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkView.ets#L113-L115
6c40e848d17c1d211033d994fa45c302e8f5eb25
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIExperience/entry/src/main/ets/pages/Index.ets
arkts
confirm
确定事件
confirm() { LogUtil.info(TAG, 'click confirm:startLottery'); this.startLottery(); }
AST#method_declaration#Left confirm 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 LogUtil AST#expression#Right . info AST#member_expressio...
confirm() { LogUtil.info(TAG, 'click confirm:startLottery'); this.startLottery(); }
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/pages/Index.ets#L88-L91
7ff56957d5f31cf08bcb75e85920b8c5380f9cb7
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
Defines LongPressGesture. @extends Gesture @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare class LongPressGesture extends Gesture { /** * Set the value. * fingers: Indicates the hand index that triggers the long press. * repeat: Indicates whether to trigger event callback continuously. * duration: Minimum press and hold time, in milliseconds. * * @param { func...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class LongPressGesture extends AST#type_annotation#Left AST#primary_type#Left Gesture AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * Set the value. * fingers: Indicates the hand i...
export declare class LongPressGesture extends Gesture { static $_instantiate(factory: () => LongPressGesture, value?: LongPressGestureHandlerOptions): LongPressGesture; onAction(event: Callback<GestureEvent>): LongPressGesture; onActionEnd(event: Callback<GestureEvent>): LongPressGesture; ...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L401-L455
9e8b1586fea6305e8fbbd647307f84098b6d7988
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/device/DeviceManager.ets
arkts
setContext
设置 Context
setContext(context: common.UIAbilityContext): void { this.context = context; }
AST#method_declaration#Left setContext AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty...
setContext(context: common.UIAbilityContext): void { this.context = context; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/device/DeviceManager.ets#L59-L61
45afe7c2c78ed04fc3ca9388411a6103cf9b3b18
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Performance/PerformanceLibrary/feature/dynamicImport/src/main/ets/model/GoodsModel.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class GoodResponse { code: number = 0; data: Records = new Records(); error: string = ''; }
AST#export_declaration#Left export AST#class_declaration#Left class GoodResponse AST#class_body#Left { AST#property_declaration#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right...
export class GoodResponse { code: number = 0; data: Records = new Records(); error: string = ''; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/dynamicImport/src/main/ets/model/GoodsModel.ets#L16-L20
a265da007ae1f39453e786f80b7a70a350015794
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/blocks/modules/meowTabsHost.ets
arkts
on_THE_LORD_OF_THE_WINDOWS_change
Called when THE_LORD_OF_THE_WINDOWS changes (the #0 is closed).
on_THE_LORD_OF_THE_WINDOWS_change() { console.warn(`[meowTabsVertical][on_THE_LORD_OF_THE_WINDOWS_change] LORD ${this.THE_LORD_OF_THE_WINDOWS}`); console.warn(`[meowTabsVertical][on_THE_LORD_OF_THE_WINDOWS_change] MYID ${this.my_window_id}`); if (this.my_window_id == this.THE_LORD_OF_THE_WINDOWS) { //...
AST#method_declaration#Left on_THE_LORD_OF_THE_WINDOWS_change 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 console AST#expression#Right ....
on_THE_LORD_OF_THE_WINDOWS_change() { console.warn(`[meowTabsVertical][on_THE_LORD_OF_THE_WINDOWS_change] LORD ${this.THE_LORD_OF_THE_WINDOWS}`); console.warn(`[meowTabsVertical][on_THE_LORD_OF_THE_WINDOWS_change] MYID ${this.my_window_id}`); if (this.my_window_id == this.THE_LORD_OF_THE_WINDOWS) { ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowTabsHost.ets#L576-L588
db8888e8377f60009b2a92d4be94b865f2443654
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/pages/ApiQueryPage.ets
arkts
filterApis
搜索和筛选API
filterApis() { let filtered = this.apiList; // 按分类筛选 if (this.selectedCategory !== '全部') { filtered = filtered.filter(api => api.category === this.selectedCategory); } // 按搜索文本筛选 if (this.searchText.trim() !== '') { const searchLower = this.searchText.toLowerCase(); f...
AST#method_declaration#Left filterApis AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left filtered = AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . apiList AST#m...
filterApis() { let filtered = this.apiList; if (this.selectedCategory !== '全部') { filtered = filtered.filter(api => api.category === this.selectedCategory); } if (this.searchText.trim() !== '') { const searchLower = this.searchText.toLowerCase(); filtered = filtered...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/pages/ApiQueryPage.ets#L928-L946
dac9f7a80f68afc7cafc8f0cc21128d3efdae415
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
savePreference
MARK: - 保存 & 加载 保存当前planId
private async savePreference(): Promise<void> { if (!this.prefs) return; await this.prefs.put(Prefs.kCurrentPlanId, this.currentPlanId ?? 0); await this.prefs.flush(); // 确保保存 }
AST#method_declaration#Left private async savePreference 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...
private async savePreference(): Promise<void> { if (!this.prefs) return; await this.prefs.put(Prefs.kCurrentPlanId, this.currentPlanId ?? 0); await this.prefs.flush(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L109-L113
a34e24eeab2a445f6e766c220986dfe5341af2f3
github
lulululing/calendar.git
c87b7e3ffb50a34941a5db50afe6a513c113bd0b
entry/src/main/ets/manager/DataManager.ets
arkts
init
初始化数据存储
async init(context: Context): Promise<void> { try { this.preferences = await preferences.getPreferences(context, this.STORE_NAME) console.info('DataManager initialized successfully') } catch (err) { console.error('Failed to initialize DataManager:', JSON.stringify(err)) } }
AST#method_declaration#Left async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom...
async init(context: Context): Promise<void> { try { this.preferences = await preferences.getPreferences(context, this.STORE_NAME) console.info('DataManager initialized successfully') } catch (err) { console.error('Failed to initialize DataManager:', JSON.stringify(err)) } }
https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/DataManager.ets#L21-L28
16ba2806a0c199ab6a049bab6d53ad45283faddc
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
arkts
saveBool
/ 存 boolean
public static saveBool(key: string, value: boolean) { const newValue = value == true ? 'TRUE' : 'FALSE' JhAESPreferencesUtils.saveString(key, newValue) }
AST#method_declaration#Left public static saveBool 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 value : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary...
public static saveBool(key: string, value: boolean) { const newValue = value == true ? 'TRUE' : 'FALSE' JhAESPreferencesUtils.saveString(key, newValue) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L26-L29
3fc4f470d517bbeb36403cc4daf91f705d1321f1
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/InputMethod/KikaInput/entry/src/main/ets/components/ReturnItem.ets
arkts
ReturnItem
返回组件
@Component export struct ReturnItem { @StorageLink('enterKeyType') enterKeyType: EnterKeyType = EnterKeyType.Done; @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); private returnWidth: Resource | undefined = undefined; build() { if (this.returnWidth) { Stack(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ReturnItem AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'enterKeyType' AST#expression#Right ) AST#decorator#Right enterKeyType : AST#type_annotation#Le...
@Component export struct ReturnItem { @StorageLink('enterKeyType') enterKeyType: EnterKeyType = EnterKeyType.Done; @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); private returnWidth: Resource | undefined = undefined; build() { if (this.returnWidth) { Stack(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInput/entry/src/main/ets/components/ReturnItem.ets#L34-L74
f62ccc4d88dfa41b10900bf8b88b565a3204cd52
gitee
openharmony/applications_systemui
413f701448a7923a18a761e3cb54f0b871cfef40
features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/settingDialog.ets
arkts
SettingDialog
Setting dialog
@CustomDialog export default struct SettingDialog { @Prop itemData: NotificationItemData public controller: CustomDialogController public action: () => void = () => {} build() { Column() { Column({ space: 4 }) { Row({ space: 4 }) { if (!CheckEmptyUtils.isEmpty(this.itemData.smallIco...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct SettingDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right itemData : AST#type_annotation#Left AST#primary_type#Left NotificationItemData AST#primary...
@CustomDialog export default struct SettingDialog { @Prop itemData: NotificationItemData public controller: CustomDialogController public action: () => void = () => {} build() { Column() { Column({ space: 4 }) { Row({ space: 4 }) { if (!CheckEmptyUtils.isEmpty(this.itemData.smallIco...
https://github.com/openharmony/applications_systemui/blob/413f701448a7923a18a761e3cb54f0b871cfef40/features/noticeitem/src/main/ets/com/ohos/noticeItem/view/item/settingDialog.ets#L31-L137
90d5ec2adb6d480c2801955b71baf8059330d79d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
日历视图类型枚举
export enum CalendarViewType { MONTH = 'month', WEEK = 'week', AGENDA = 'agenda' }
AST#export_declaration#Left export AST#enum_declaration#Left enum CalendarViewType AST#enum_body#Left { AST#enum_member#Left MONTH = AST#expression#Left 'month' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left WEEK = AST#expression#Left 'week' AST#expression#Right AST#enum_member#Right , AST#enum_membe...
export enum CalendarViewType { MONTH = 'month', WEEK = 'week', AGENDA = 'agenda' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L369-L373
410294816a6e9bf7eff3d11c0dab562ac894add9
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/model/BasicDataSource.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; protected dataArray: T[] = []; totalCount(): number { return this.dataArray.length; } getData(index: number): T { return this.dataArray[index]; } registerDataChangeListener(listener: DataChang...
AST#export_declaration#Left export AST#class_declaration#Left class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left ...
export class BasicDataSource<T> implements IDataSource { private listeners: DataChangeListener[] = []; protected dataArray: T[] = []; totalCount(): number { return this.dataArray.length; } getData(index: number): T { return this.dataArray[index]; } registerDataChangeListener(listener: DataChang...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/BasicDataSource.ets#L16-L58
01776c24e7d0f1d3fa012fd00bdd612a03f64e1a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SyncTypes.ets
arkts
同步相关
export interface SyncOptions { force?: boolean; // 强制同步 direction?: SyncDirection; // 同步方向 dataTypes?: DataType[]; // 要同步的数据类型 conflictStrategy?: ConflictStrategy; // 冲突解决策略 }
AST#export_declaration#Left export AST#interface_declaration#Left interface SyncOptions AST#object_type#Left { AST#type_member#Left force ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 强制同步 AST#type_member#Left direction ? : AST#typ...
export interface SyncOptions { force?: boolean; direction?: SyncDirection; dataTypes?: DataType[]; conflictStrategy?: ConflictStrategy; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SyncTypes.ets#L38-L43
6b118ec386040e011c1d17bfa78c4ac52a5cb6d6
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/util/AopUtil.ets
arkts
@Author csx @DateTime 2024/6/11 12:18:06 @TODO AopUtil 提供统一的切面工具类 参考链接 https://developer.huawei.com/consumer/cn/forum/topic/0208150583363295032
export class AopUtil { }
AST#export_declaration#Left export AST#class_declaration#Left class AopUtil AST#class_body#Left { } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#Right
export class AopUtil { }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/util/AopUtil.ets#L23-L24
89d67cdc591ca87eb45096ef2d2266d0bbf80266
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
ToolBarOptions
Declare ToolBarOptions use in ToolBar @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare ToolBarOptions use in ToolBar @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
@Observed export declare class ToolBarOptions extends Array<ToolBarOption> { }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class ToolBarOptions extends 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 ToolBarOp...
@Observed export declare class ToolBarOptions extends Array<ToolBarOption> { }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ToolBar.d.ets#L222-L224
ca77d487d506be941225241f7c77852baf376c58
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/bluetoothSample/entry/src/main/ets/common/ScanData.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class ScanData { private deviceId: string = ''; private deviceName: string = ''; private rssi: number = 0; private connectable: boolean = false; private data: Uint8Array = new Uint8Array([0xFF, 0xFF, 0xFF, 0xFF]); constructor(deviceId: string = '', deviceName: string = 'null', rssi: number = 0, conn...
AST#export_declaration#Left export AST#class_declaration#Left class ScanData AST#class_body#Left { AST#property_declaration#Left private deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_declarat...
export class ScanData { private deviceId: string = ''; private deviceName: string = ''; private rssi: number = 0; private connectable: boolean = false; private data: Uint8Array = new Uint8Array([0xFF, 0xFF, 0xFF, 0xFF]); constructor(deviceId: string = '', deviceName: string = 'null', rssi: number = 0, conn...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/bluetoothSample/entry/src/main/ets/common/ScanData.ets#L16-L71
7eb8e755c341e50a58992a58ba7e43448d3deee4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/effectkit/src/main/ets/components/mainpage/MainPage.ets
arkts
MainPageComponent
实现步骤: 1. 通过使用滑动视图容器Swiper,将控制器SwiperController绑定Swiper组件,实现其子组件Image图片滑动轮播显示效果。 2. 在事件onAnimationStart切换动画过程中通过Image模块相关能力,获取图片颜色平均值,使用effectKit包中的ColorPicker智能取色器进行颜色取值。 3. 同时通过接口animateTo开启背景颜色渲染的属性动画。全局界面开启沉浸式状态栏。
@Component export struct MainPageComponent { // 图片资源获取 @State imgData: Resource[] = [ $r('app.media.image4'), $r('app.media.image5'), $r('app.media.image6'), $r('app.media.image7') ]; // 初始背景色赋值 @State bgColor: string = "#fffffff"; // 顶部安全高度赋值 @State topSafeHeight: number = 0; // 创建swipe...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPageComponent AST#component_body#Left { // 图片资源获取 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right imgData : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource ...
@Component export struct MainPageComponent { @State imgData: Resource[] = [ $r('app.media.image4'), $r('app.media.image5'), $r('app.media.image6'), $r('app.media.image7') ]; @State bgColor: string = "#fffffff"; @State topSafeHeight: number = 0; private swiperController: SwiperContr...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/effectkit/src/main/ets/components/mainpage/MainPage.ets#L28-L130
5e5aa7894fb51df6869a3c192a168eadce5cf513
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/NavigationParam.ets
arkts
@file 公共导航参数定义 @author Joker.X 商品 ID 参数
export interface GoodsIdParam { /** * 商品 ID */ goodsId: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GoodsIdParam AST#object_type#Left { /** * 商品 ID */ AST#type_member#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; } AST#object_type#Right AST#i...
export interface GoodsIdParam { goodsId: number; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/NavigationParam.ets#L9-L14
40936e9d8040ce255b06d09f137e257fbc36df20
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets
arkts
FitForDarkModeComponent
字体设置透明度
@Preview @Component export struct FitForDarkModeComponent { @State banner: ResourceStr = ''; // @StorageProp + @Watch 获取并监听当前颜色模式 @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number = 0; // @Watch回调函数,监听颜色模式刷新状态变量 onColorModeChange(): void { this.banner = setBanner(this.curre...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FitForDarkModeComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right banner : AST#type_annotation#Left AST#pri...
@Preview @Component export struct FitForDarkModeComponent { @State banner: ResourceStr = ''; @StorageProp('currentColorMode') @Watch('onColorModeChange') currentMode: number = 0; onColorModeChange(): void { this.banner = setBanner(this.currentMode); } aboutToAppear(): void { const applicati...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets#L39-L161
d0b9152e2790b22f76e0521c1b338389ffefc37e
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
用户登出 @returns 登出结果Promise
export async function logout(): Promise<ApiResponse<void>> { console.info('发起登出请求'); try { const response = await request<ApiResponse<void>>( RequestMethod.POST, '/auth/logout', EmptyParams ); console.info('登出响应:', JSON.stringify(response)); return response; } catch (error) { ...
AST#export_declaration#Left export AST#function_declaration#Left async function logout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ApiRes...
export async function logout(): Promise<ApiResponse<void>> { console.info('发起登出请求'); try { const response = await request<ApiResponse<void>>( RequestMethod.POST, '/auth/logout', EmptyParams ); console.info('登出响应:', JSON.stringify(response)); return response; } catch (error) { ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1283-L1304
4b3c38a12ea9d4dbe90166435b2f77cd7c39c579
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility4.ets
arkts
onCreate
Sample_009 -> Sample_010 -> Sample_009 -> Sample_011
onCreate(want:Want, launchParam: AbilityConstant.LaunchParam){ hilog.info(0x0000, 'PageAbility4 StartupTest', '%{public}s', 'Ability onCreate'); if (want.parameters && want.parameters?.keepAlive) { console.info('PageAbility4 StartupTest PageAbility4 keepAlive = true'); keepAlive = true; } i...
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil...
onCreate(want:Want, launchParam: AbilityConstant.LaunchParam){ hilog.info(0x0000, 'PageAbility4 StartupTest', '%{public}s', 'Ability onCreate'); if (want.parameters && want.parameters?.keepAlive) { console.info('PageAbility4 StartupTest PageAbility4 keepAlive = true'); keepAlive = true; } i...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/ability/ability_runtime/startup/startupmanualhelp1/entry/src/main/ets/MainAbility/PageAbility4.ets#L41-L153
9a7c5d17334511848d2ceeef1f702dd0db002cc2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/arkweb/ArkJsObject.ets
arkts
clearWebCacheEasy
清除Web缓存
clearWebCacheEasy() { try { this.controller?.removeCache(true); this.controller?.clearHistory(); this.controller?.clearMatches(); this.controller?.clearSslCache(); this.controller?.clearClientAuthenticationCache(); } catch (e) { let err = e as BusinessError; Tools.logEr...
AST#method_declaration#Left clearWebCacheEasy AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#mem...
clearWebCacheEasy() { try { this.controller?.removeCache(true); this.controller?.clearHistory(); this.controller?.clearMatches(); this.controller?.clearSslCache(); this.controller?.clearClientAuthenticationCache(); } catch (e) { let err = e as BusinessError; Tools.logEr...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L99-L110
fa27468ee3c6868825c7c361fb482c3c80d46787
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets
arkts
createSocket
创建Socket @param localIp @param port
async createSocket(localIp: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls bind localIp: ${localIp}`); try { if (this.tlsSocket) { await this.closeSocket(); } this.tlsSocket = socket.constructTLSSocketInstance(); await this.tlsSocket.bind({ address: l...
AST#method_declaration#Left async createSocket AST#parameter_list#Left ( AST#parameter#Left localIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
async createSocket(localIp: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls bind localIp: ${localIp}`); try { if (this.tlsSocket) { await this.closeSocket(); } this.tlsSocket = socket.constructTLSSocketInstance(); await this.tlsSocket.bind({ address: l...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/TlsSocket.ets#L101-L121
825f78412b6e4b1474b493fd40ee46f76de0cda4
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainAlignRadioList.ets
arkts
FlexMainAlignRadioList
Set Main Alignment in Flex
@Component export struct FlexMainAlignRadioList { private flexModuleList: ContainerModuleItem[] = getFlexModuleList(); private groupName: string = this.flexModuleList[1].groupName; private moduleName: Resource = this.flexModuleList[1].moduleName; private radioList: Array<string> = this.flexModuleList[1].attribu...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FlexMainAlignRadioList AST#component_body#Left { AST#property_declaration#Left private flexModuleList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ContainerModuleItem [ ] AST#array_type#Right A...
@Component export struct FlexMainAlignRadioList { private flexModuleList: ContainerModuleItem[] = getFlexModuleList(); private groupName: string = this.flexModuleList[1].groupName; private moduleName: Resource = this.flexModuleList[1].moduleName; private radioList: Array<string> = this.flexModuleList[1].attribu...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/view/FlexMainAlignRadioList.ets#L23-L56
e59fc29e272bc5b0f4a2589a0471025b92296c05
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
getImageRect
Get image rect. @returns
getImageRect(): RectF { let image = new RectF(); image.set(this.imageRect.left, this.imageRect.top, this.imageRect.right, this.imageRect.bottom); return image; }
AST#method_declaration#Left getImageRect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left image = AST#e...
getImageRect(): RectF { let image = new RectF(); image.set(this.imageRect.left, this.imageRect.top, this.imageRect.right, this.imageRect.bottom); return image; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets#L104-L108
f89ee94743650654dbc067cff711911cbe142153
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
getSpringFestivalDate
获取指定年份的春节日期 @param year 农历年份 @returns 春节的公历日期
static getSpringFestivalDate(year: number): SolarDate | null { return LunarCalendar.lunarToSolar(year, 1, 1, false); }
AST#method_declaration#Left static getSpringFestivalDate 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#union_type#Left AST#primary_ty...
static getSpringFestivalDate(year: number): SolarDate | null { return LunarCalendar.lunarToSolar(year, 1, 1, false); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L675-L677
724f49f7d5ae5b72398017ff7643169c9b6d9270
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Camera/entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
Entry initialization function
async aboutToAppear() { await this.requestPermissionsFn(); let mDisplay = display.getDefaultDisplaySync(); this.screenWidth = px2vp(mDisplay.width); this.screenHeight = px2vp(mDisplay.height); this.initXComponentSize(); }
AST#method_declaration#Left async aboutToAppear 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 AST#member_expression#Left AST#expression#Left AST#await_expression#Left await...
async aboutToAppear() { await this.requestPermissionsFn(); let mDisplay = display.getDefaultDisplaySync(); this.screenWidth = px2vp(mDisplay.width); this.screenHeight = px2vp(mDisplay.height); this.initXComponentSize(); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/pages/Index.ets#L101-L107
083a0424d59bb4e2e284d11cde72f786570ba756
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.RecentPhotoComponent.d.ets
arkts
RecentPhotoComponent
Declare struct RecentPhotoComponent @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
@Component export declare struct RecentPhotoComponent { /** * recentPhotoOptions * * @type { ?recentPhotoOptions } * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core * @atomicservice * @since 12 */ recentPhotoOptions?: RecentPhotoOptions; /** * Callback when check whether ph...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct RecentPhotoComponent AST#component_body#Left { /** * recentPhotoOptions * * @type { ?recentPhotoOptions } * @syscap SystemCapability.FileManagement.PhotoAccessHelper....
@Component export declare struct RecentPhotoComponent { recentPhotoOptions?: RecentPhotoOptions; onRecentPhotoCheckResult?: RecentPhotoCheckResultCallback; onRecentPhotoClick: RecentPhotoClickCallback; onRecentPhotoCheckInfo?: RecentPhotoCheckInfoCallback; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.RecentPhotoComponent.d.ets#L31-L72
15edc56662c355dfec6a110f1def31f5152d78e4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/pages/MusicPlayerPage.ets
arkts
stackStyle
通用样式
@Styles stackStyle() { .height("100%") .width("100%") .backgroundImage(this.viewModel.curMusicModel?.coverRes) .backgroundImageSize(ImageSize.Cover) .backgroundImagePosition(Alignment.Center) .backgroundBlurStyle(BlurStyle.BACKGROUND_THIN) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right stackStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . height ( AST#expression#Left "100%" AST#expression#Right ) AST#modifier_chain_expression#Left . width ( AST#exp...
@Styles stackStyle() { .height("100%") .width("100%") .backgroundImage(this.viewModel.curMusicModel?.coverRes) .backgroundImageSize(ImageSize.Cover) .backgroundImagePosition(Alignment.Center) .backgroundBlurStyle(BlurStyle.BACKGROUND_THIN) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/pages/MusicPlayerPage.ets#L46-L54
9d1b8d5d7be6cda2648bad3859f1a4995ea2aed5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets
arkts
ClickIconItem 点击出现的图标项。 包含唯一标识符、图标的资源引用以及其在界面上的位置信息。
export interface ClickIconItem { id: string; // 图标唯一标识 icon: Resource; // 图标资源 position: Position; // 图标位置 }
AST#export_declaration#Left export AST#interface_declaration#Left interface ClickIconItem AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 图标唯一标识 AST#type_member#Left icon : AST#type_annotat...
export interface ClickIconItem { id: string; icon: Resource; position: Position; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/src/main/ets/model/ClickIconDataModel.ets#L22-L26
217f44286eac0090de33b0b57ef11f5e8db1f47a
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets
arkts
getValsForTouch
Returns a recyclable MPPointD instance. Returns the corresponding xPos for a given touch-position in pixels. @param x @param y @return
protected getValsForTouch(x: number, y: number): MPPointD { // take any transformer to determine the x-axis value var pos: MPPointD = this.mChart.getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(x, y); return pos; }
AST#method_declaration#Left protected getValsForTouch AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left y : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
protected getValsForTouch(x: number, y: number): MPPointD { var pos: MPPointD = this.mChart.getTransformer(AxisDependency.LEFT).getValuesByTouchPoint(x, y); return pos; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/highlight/ChartHighlighter.ets#L61-L65
b5aa7dc94155f17d7a9900adbe4882e02cb651d8
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/NotificationUtil.ets
arkts
authorizeNotification
添加跳转设置权限开启通知 https://developer.huawei.com/consumer/cn/forum/topic/0208150584794898034 校验是否已授权通知服务 @param callBack 回调函数 @returns
static async authorizeNotification(callBack: (index: number) => void): Promise<void> { //判断用户是否授权通知服务 let isAuth = await notificationManager.isNotificationEnabled(); //true为授权 if (!isAuth) { //未授权,尝试拉起授权 notificationManager.requestEnableNotification(getContext() as common.UIAbilityContext, ...
AST#method_declaration#Left static async authorizeNotification AST#parameter_list#Left ( AST#parameter#Left callBack : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Rig...
static async authorizeNotification(callBack: (index: number) => void): Promise<void> { let isAuth = await notificationManager.isNotificationEnabled(); if (!isAuth) { notificationManager.requestEnableNotification(getContext() as common.UIAbilityContext, (err: Base.BusinessError) =>...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/NotificationUtil.ets#L39-L56
e2f1f6ee66e848fdfc82f0e83d43fa9bdc600a23
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/feature/EmitterClass.ets
arkts
showEventsDialog
单次订阅回调
public showEventsDialog(callback: () => void): void { let dialogShowEventsId: EventsId = new EventsId(EmitterConst.DIALOG_EVENT_ID); let dialogShowEventsData: EventsData = new EventsData(new Data(EmitterConst.DIALOG_EVENT_ID)); // 单次订阅事件--广告 emitter.once(dialogShowEventsId, callback); // 事件发布 em...
AST#method_declaration#Left public showEventsDialog AST#parameter_list#Left ( AST#parameter#Left callback : 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#fun...
public showEventsDialog(callback: () => void): void { let dialogShowEventsId: EventsId = new EventsId(EmitterConst.DIALOG_EVENT_ID); let dialogShowEventsData: EventsData = new EventsData(new Data(EmitterConst.DIALOG_EVENT_ID)); emitter.once(dialogShowEventsId, callback); emitter.emit(dialogSho...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/feature/EmitterClass.ets#L47-L54
e15a4a6bc2bc3a61610f74fb4de1cb3d171dca7b
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/ToolComponent.ets
arkts
功能数组 暂只有语音通话
build() { Row() { ForEach(this.toolArray, (item: ToolData, index) => { Button() { Image(item.getImgResource()) .width(40) .height(40) .objectFit(ImageFit.Contain) } .width(100) .height(100) .borderRadius(10) .type(Bu...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#ex...
build() { Row() { ForEach(this.toolArray, (item: ToolData, index) => { Button() { Image(item.getImgResource()) .width(40) .height(40) .objectFit(ImageFit.Contain) } .width(100) .height(100) .borderRadius(10) .type(Bu...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/components/ToolComponent.ets#L25-L56
5004011d75ffece0e1097b61dea18f90c0efc286
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/interceptor/Interceptor.ets
arkts
Navigation路由拦截: 如何封装: 1、在路由模块增加路由拦截器interceptor.ets,定义拦截容器、注册方法和公共拦截逻辑。 2、当点击本案例时,触发在路由模块的动态路由.pushUri()中的interceptor的公共拦截方法(此处需动态路由完成加载后执行否则首次路由拦截失败)。 3、子模块中定义业务具体拦截逻辑,做具体的拦截实现:通过routerInfo判断目的地为"我的页面"时判断登录状态是"未登录",此时执行跳转到登录页并返回true给拦截容器list(告知需拦截),已登录返回false,放行。并且注册到拦截器容器list中 4、拦截器获取拦截容器list中所有注册过的子模块的拦截函数,如果子模块拦截函数...
export interface InterceptorExecute { executeFunction(appUri: string, param?: string): boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface InterceptorExecute AST#object_type#Left { AST#type_member#Left executeFunction AST#parameter_list#Left ( AST#parameter#Left appUri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#para...
export interface InterceptorExecute { executeFunction(appUri: string, param?: string): boolean; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/interceptor/Interceptor.ets#L35-L37
4d08b87290e7afc25359f5d06f89bc5336b46ba1
gitee