nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/communication_wifi
387ba7fa8f98578629a6148635a4d630b2b99aa1
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/model/BaseModel.ets
arkts
Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 l...
export default class BaseModel { constructor() { } }
AST#export_declaration#Left export default AST#class_declaration#Left class BaseModel AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right } AST#class_body#Right AS...
export default class BaseModel { constructor() { } }
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/model/BaseModel.ets#L16-L19
f0cc18e203b64f6af2d9304cea3ab2c2b3508611
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_search_engines.ets
arkts
import_string
Import search engines in a specific plain text format. In default overwrites whatever was in this list_of_search_engines. @param imp The string in the correct format: @example 'Bing\nhttps://www.cn.bing.com/search?q=%s\nGoogle\nhttps://www.google.com/search?q=%s'
static import_string(imp: string) { // Clear bunch_of_search_engines.list_of_search_engines = []; if (imp == "") { return; } // Import let import_list: string[] = imp.split("\n"); for (let index = 0; index < import_list.length; index += 2) { if (import_list[index] != "") { ...
AST#method_declaration#Left static import_string AST#parameter_list#Left ( AST#parameter#Left imp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { // Clear AST#statement#Left AST#expression_...
static import_string(imp: string) { bunch_of_search_engines.list_of_search_engines = []; if (imp == "") { return; } let import_list: string[] = imp.split("\n"); for (let index = 0; index < import_list.length; index += 2) { if (import_list[index] != "") { bunch_of_search...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L74-L87
a37b633bc18c10b546b2b8f190d04751e93976c5
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Buttons.ets
arkts
buttonStyle
自定义样式:button
@Styles buttonStyle(){ .width(180) .height(40) .margin({ bottom: 10}) }
AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 180 AST#expression#Right ) AST#modifier_chain_expression#Left . height ( AST#expre...
@Styles buttonStyle(){ .width(180) .height(40) .margin({ bottom: 10}) }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Buttons.ets#L33-L37
5ba0d2ab66b1a39e5d4c6ad04417ebc6c896c78f
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets
arkts
年、月、周视图切换场景的相关设置
export interface CalendarSwitch { controller?: CalendarController; // 自定义日历控制器,用于视图切换后的数据刷新。 currentSelectDay?: DayInfo; // 记录月、周视图中点击选中的日期信息。 isYearMonthHidden?: boolean; // 是否隐藏自定义日历年、月、周视图中自带的年月信息标题。 }
AST#export_declaration#Left export AST#interface_declaration#Left interface CalendarSwitch AST#object_type#Left { AST#type_member#Left controller ? : AST#type_annotation#Left AST#primary_type#Left CalendarController AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 自定义日历控制器,用于视图切换后的数据刷新。 AST#t...
export interface CalendarSwitch { controller?: CalendarController; currentSelectDay?: DayInfo; isYearMonthHidden?: boolean; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/model/CalendarModel.ets#L51-L55
ab66818782429908dd378b3a87a79f1cf67f5ab0
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
单例模型私有化构造函数,使用getInstance静态方法获得单例
private constructor() { // 初始化窗口管理model const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage'); if (windowStage) { this.windowModel.setWindowStage(windowStage); } // 初始化相机流尺寸 this.updateCameraCompSize(); }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 初始化窗口管理model AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left windowStage : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qu...
private constructor() { const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage'); if (windowStage) { this.windowModel.setWindowStage(windowStage); } this.updateCameraCompSize(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L32-L41
bd5b753f1a35d8d87681b49634e2d179b2e7c19d
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets
arkts
getCircleColors
ALL CODE BELOW RELATED TO CIRCLE-COLORS returns all colors specified for the circles @return
public getCircleColors(): JArrayList<Number> { return this.mCircleColors; }
AST#method_declaration#Left public getCircleColors AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Number AST#primary_type#Right AST#type_annotation#Right > AST...
public getCircleColors(): JArrayList<Number> { return this.mCircleColors; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/LineDataSet.ets#L256-L258
3dfb17d4c7cf3d68f695eb8f90768d8ef89e8939
gitee
DompetApp/Dompet.harmony.git
ba5aae3d265458588a4866a71f9ac55bbd0a4a92
entry/src/main/ets/globals/event.ets
arkts
recentUser
User
public async recentUser() { logger.info('AppEvent.recentUser is called') return AppDatabaser.recentUser() }
AST#method_declaration#Left public async recentUser 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 logger AST#expression#Right...
public async recentUser() { logger.info('AppEvent.recentUser is called') return AppDatabaser.recentUser() }
https://github.com/DompetApp/Dompet.harmony.git/blob/ba5aae3d265458588a4866a71f9ac55bbd0a4a92/entry/src/main/ets/globals/event.ets#L55-L58
ab2ce10714653a489eb4dcbd7432b8f839beff79
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets
arkts
将 HSL 颜色模型转换为 HEX 颜色模型 @param {number} hue - 色相 (Hue),范围为 0 到 360 @param {number} saturation - 饱和度 (Saturation),范围为 0 到 100 @param {number} lightness - 亮度 (Lightness),范围为 0 到 100 @returns {string} - 返回 HEX 颜色值,格式为 '#RRGGBB'
export function hslToHex(hue: number, saturation: number, lightness: number): string { // 将 HSL 转换为 RGB const rgb: RgbType = hslToRgb(hue, saturation, lightness); // 返回 HEX 颜色值 return rgbToHex(rgb.red, rgb.green, rgb.blue); }
AST#export_declaration#Left export AST#function_declaration#Left function hslToHex AST#parameter_list#Left ( AST#parameter#Left hue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left saturation : AST#type_annotation#Left AST#...
export function hslToHex(hue: number, saturation: number, lightness: number): string { const rgb: RgbType = hslToRgb(hue, saturation, lightness); return rgbToHex(rgb.red, rgb.green, rgb.blue); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/utils/ColorTypeConverter.ets#L26-L31
5796cd9ddd926e937dd321230075ee6efec56194
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/model/MusicItem.ets
arkts
音乐文件地址
constructor(id: number, title: string, artist: string, cover: string, duration: number, url?: string) { this.id = id; this.title = title; this.artist = artist; this.cover = cover; this.duration = duration; this.url = url; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
constructor(id: number, title: string, artist: string, cover: string, duration: number, url?: string) { this.id = id; this.title = title; this.artist = artist; this.cover = cover; this.duration = duration; this.url = url; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/MusicItem.ets#L12-L19
e124286bbad048e7c821c3b7c82c10c084d09278
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
save_month_to_disk
Saves the current opened file to disk
save_month_to_disk() { sandbox_save(this.current_opened_file_path, this.export_string()); }
AST#method_declaration#Left save_month_to_disk AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left sandbox_save ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . current_opened_file_path AST#member_ex...
save_month_to_disk() { sandbox_save(this.current_opened_file_path, this.export_string()); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L465-L467
0752ca0b797b9e0269510cb27d8d69f252b88bcb
gitee
devaige/HarmonyOSOfficialDemo.git
8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c
ToDoListArkTS/entry/src/main/ets/common/constant/CommonConstant.ets
arkts
Style constants that can be used by all modules
export default class CommonConstants { /** * Full width or height. */ static readonly FULL_LENGTH: string = '100%'; /** * Title height. */ static readonly TITLE_WIDTH: string = '80%'; /** * List default width. */ static readonly LIST_DEFAULT_WIDTH: string = '93.3%'; /** * Opacity o...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Full width or height. */ AST#property_declaration#Left static readonly FULL_LENGTH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#...
export default class CommonConstants { static readonly FULL_LENGTH: string = '100%'; static readonly TITLE_WIDTH: string = '80%'; static readonly LIST_DEFAULT_WIDTH: string = '93.3%'; static readonly OPACITY_DEFAULT: number = 1; static readonly OPACITY_COMPLETED: number = 0.4; static ...
https://github.com/devaige/HarmonyOSOfficialDemo.git/blob/8b939116592cbc4e1c1b2e4f0b8fc4a57fde0f8c/ToDoListArkTS/entry/src/main/ets/common/constant/CommonConstant.ets#L19-L70
197311107baa58cf129706e12672dec4a0633e1e
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUser.ets
arkts
incrementLearnTimes
增加学习次数(类似Swift的mutating方法)
incrementLearnTimes(): void { this.learnTimes++; }
AST#method_declaration#Left incrementLearnTimes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#update_expression#Left AST#ex...
incrementLearnTimes(): void { this.learnTimes++; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUser.ets#L73-L75
41dec68307c67af2de896abef02ed15952ceae82
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/bigdata/src/main/ets/pages/Index.ets
arkts
taskFunc
在并发函数中模拟数据处理
@Concurrent async function taskFunc(obj: Test) { console.info('test task res1 is: ' + obj.data1.name + ' res2 is: ' + obj.data2.name); }
AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right async function taskFunc AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left Test AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#b...
@Concurrent async function taskFunc(obj: Test) { console.info('test task res1 is: ' + obj.data1.name + ' res2 is: ' + obj.data2.name); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ConcurrentThreadCommunication/InterThreadCommunicationObjects/SendableObject/SendableScenarios/bigdata/src/main/ets/pages/Index.ets#L22-L25
21761eba42678174cd09d580efab672bd607af97
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Temperature.ets
arkts
initCurveData
初始化数据 @param count 曲线图点的个数 @param range y轴范围
private initCurveData(): LineData { let values = new JArrayList<EntryOhos>(); for (let index: number = 0; index < this.gpData.length; index++) { const gpDataCur = this.gpData[index]; if (gpDataCur.systemHTemp == '') { continue } values.add(new EntryOhos(Number(index).valueOf(), ...
AST#method_declaration#Left private initCurveData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LineData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left v...
private initCurveData(): LineData { let values = new JArrayList<EntryOhos>(); for (let index: number = 0; index < this.gpData.length; index++) { const gpDataCur = this.gpData[index]; if (gpDataCur.systemHTemp == '') { continue } values.add(new EntryOhos(Number(index).valueOf(), ...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/Temperature.ets#L437-L471
7859cefb790a6462ac11c7ae1a80ebeef53706a9
gitee
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/src/main/ets/core/Connection.ets
arkts
数据库工具
export class Connection { private id: string private store: relationalStore.RdbStore private static context?: Context = undefined private static logger?: Logger = undefined set version(v: number) { this.store.version = v }
AST#export_declaration#Left export AST#class_declaration#Left class Connection AST#class_body#Left { AST#property_declaration#Left private id : 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 private sto...
export class Connection { private id: string private store: relationalStore.RdbStore private static context?: Context = undefined private static logger?: Logger = undefined set version(v: number) { this.store.version = v }
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/core/Connection.ets#L8-L16
3f5876aa3f549deb5b4c83f29b9ede7c208d92db
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/special_expression/nullish_coalescing_001_T.ets
arkts
Introduction 空合并运算符
export function nullish_coalescing_001_T(taint_src : string) { let t = null ?? taint_src; taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function nullish_coalescing_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_stat...
export function nullish_coalescing_001_T(taint_src : string) { let t = null ?? taint_src; taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/nullish_coalescing_001_T.ets#L6-L9
85da407f4abc449efdb03564ed68383d92a2cb67
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/style/ICustomButtonStyle.ets
arkts
自定义按钮样式
export interface ICustomButtonStyle { /** * 自定义预设样式Id,用来区分样式 ID */ customStyleId: string /** * 按钮背景颜色(可选) */ background?: ResourceColor; /** * 按钮背景颜色 渐变(可选) */ linearGradient?: ILinearGradient; /** * 按钮边框样式(可选) */ border?: BorderOptions; /** * 按钮文本颜色(可选) */ fontColor...
AST#export_declaration#Left export AST#interface_declaration#Left interface ICustomButtonStyle AST#object_type#Left { /** * 自定义预设样式Id,用来区分样式 ID */ AST#type_member#Left customStyleId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right /** ...
export interface ICustomButtonStyle { customStyleId: string background?: ResourceColor; linearGradient?: ILinearGradient; border?: BorderOptions; fontColor?: ResourceColor; fontSize?: Length; fontWeight?: FontWeight; borderRadius?: Length | BorderRadiuses; height?: Le...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/ICustomButtonStyle.ets#L6-L59
f1f4724f848be77f5031c7a41e5ae6017f22c1f4
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
module list
export const LIST: string[] = ['最近播放', '为你推荐'];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LIST : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expression#Lef...
export const LIST: string[] = ['最近播放', '为你推荐'];
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/common/constants/CommonConstants.ets#L89-L89
c03b5daac5023b312625497c99126de7d392ab1b
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/pages/inform.ets
arkts
markAsRead
标记单个为已读
private markAsRead(id: number) { this.notifications = this.notifications.map(item => { if (item.id === id) { item.read = true; } return item; }); this.unreadCount = this.calculateUnreadCount(); CommonVariable.unreadCount=this.unreadCount; }
AST#method_declaration#Left private markAsRead AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expres...
private markAsRead(id: number) { this.notifications = this.notifications.map(item => { if (item.id === id) { item.read = true; } return item; }); this.unreadCount = this.calculateUnreadCount(); CommonVariable.unreadCount=this.unreadCount; }
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/pages/inform.ets#L175-L184
8d1218bde159b377165f74c6604865301e081ad9
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/url.ets
arkts
_buildComponents
==================== 构建组件 ====================
private _buildComponents(): void { // 构建URL字符串 let url = ""; // 协议 if (this._scheme) { url += this._scheme + ":"; } // 授权部分 if (this._hostname) { url += "//"; // 用户信息 if (this._username || this._password) { ...
AST#method_declaration#Left private _buildComponents 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 { // 构建URL字符串 AST#statement#Left AST#variable_declaration#Left let AST#variable_declar...
private _buildComponents(): void { let url = ""; if (this._scheme) { url += this._scheme + ":"; } if (this._hostname) { url += "//"; if (this._username || this._password) { url += this._encodeU...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L509-L570
d5f1569feec8afe7a9fb299bd53a67ea3cee79fb
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/CopyUtils.ets
arkts
copyText
实现文本复制功能 @param text 要复制的文本
public static copyText(text: string): void { // 创建剪贴板条目 const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text); const systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteboardData); // Put data into clipboard }
AST#method_declaration#Left public static copyText AST#parameter_list#Left ( AST#parameter#Left text : 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_t...
public static copyText(text: string): void { const pasteboardData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text); const systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(pasteboardData); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/CopyUtils.ets#L11-L16
04008079e0863ca620bb5104c8adbcd04c085d8c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets
arkts
GestureJudge
[Start gesture_judge] [Start set_gesture_judge]
@Entry @Component export struct GestureJudge { scroller: Scroller = new Scroller(); // [StartExclude set_gesture_judge] scroller2: Scroller = new Scroller(); private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; private childRecognizer: GestureRecognizer = new GestureRecognizer(); private currentRecognize...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct GestureJudge AST#component_body#Left { AST#property_declaration#Left scroller : AST#type_annotation#Left AST#primary_type#Left Scroller AST#primary_type#Right AST#type_an...
@Entry @Component export struct GestureJudge { scroller: Scroller = new Scroller(); scroller2: Scroller = new Scroller(); private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; private childRecognizer: GestureRecognizer = new GestureRecognizer(); private currentRecognizer: GestureRecognizer = new GestureR...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets#L18-L169
a4bb76a3b5ec7db304944ce855c78be9f439fade
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Index.ets
arkts
页面渲染 builder
build() { Column() { // 自定义builder渲染 this.listBuilder() } .width('100%') .height('100%') .backgroundColor($r('app.color.page_background')) }
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 { // 自定义builder渲染 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left ...
build() { Column() { this.listBuilder() } .width('100%') .height('100%') .backgroundColor($r('app.color.page_background')) }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Index.ets#L75-L83
ad37ee6d7b99c21ec893f22688e448e2356ea3e2
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/CommentItem.ets
arkts
构建评论 Item @returns {void} 无返回值
build(): void { RowStartTop({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium"), onTap: this.onTap ? (_: ClickEvent): void => this.handleTap() : undefined }) { Avatar({ src: this.comment.avatarUrl ?? "", avatarSize: 32 }); SpaceHorizontalMe...
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 RowStartTop ( AST#component_parameters#Left { AST#component_parameter#Left width...
build(): void { RowStartTop({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium"), onTap: this.onTap ? (_: ClickEvent): void => this.handleTap() : undefined }) { Avatar({ src: this.comment.avatarUrl ?? "", avatarSize: 32 }); SpaceHorizontalMe...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/CommentItem.ets#L27-L70
0c0324c9da207bae5266371d8850913d88708a73
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
设置重置选项接口
export interface SettingsResetOptions { resetTheme: boolean; resetNotifications: boolean; resetDisplay: boolean; resetPrivacy: boolean; resetAI: boolean; resetData: boolean; resetAdvanced: boolean; keepUserData: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SettingsResetOptions AST#object_type#Left { AST#type_member#Left resetTheme : 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 resetNotification...
export interface SettingsResetOptions { resetTheme: boolean; resetNotifications: boolean; resetDisplay: boolean; resetPrivacy: boolean; resetAI: boolean; resetData: boolean; resetAdvanced: boolean; keepUserData: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L489-L498
a5718668c7b161fb4eb08c91240f0cd79317efb6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets
arkts
changeOpacityImage
修改图片透明度为0.5
private changeOpacityImage() { if (this.pixelMap != undefined) { // [Start pixelmap_change_opacity_image] // 透明度0.5 this.pixelMap.opacity(0.5).then(() => { this.updateImageInfo(); }) // [End pixelmap_change_opacity_image] } }
AST#method_declaration#Left private changeOpacityImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#e...
private changeOpacityImage() { if (this.pixelMap != undefined) { this.pixelMap.opacity(0.5).then(() => { this.updateImageInfo(); }) } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L310-L319
bb482424e31f5844b85841bf0cd9c9a8cc6c2a5f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/web/WebViewUtil.ets
arkts
WebViewUtil
@Author csx @DateTime 2024/9/3 23:24 @TODO WebViewUtil @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui
@Component export struct WebViewUtil { controller: webview.WebviewController = new webview.WebviewController(); aboutToAppear(): void { try { webview.WebviewController.setWebDebuggingAccess(true); } catch (error) { console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error a...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WebViewUtil AST#component_body#Left { AST#property_declaration#Left controller : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewController AST#qualified_type#Right AST#primary_...
@Component export struct WebViewUtil { controller: webview.WebviewController = new webview.WebviewController(); aboutToAppear(): void { try { webview.WebviewController.setWebDebuggingAccess(true); } catch (error) { console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error a...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/web/WebViewUtil.ets#L25-L40
b35460fd698fc32855ded697b137255203344f0b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
setListener
设置监听事件 @param listener
static setListener(listener: TextReaderListener) { if (listener?.onStateChange) { TextReaderHelper.on('stateChange', listener.onStateChange); } if (listener?.onStop) { TextReaderHelper.on('stop', listener.onStop); } if (listener?.onRelease) { TextReaderHelper.on('release', listener...
AST#method_declaration#Left static setListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left TextReaderListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Le...
static setListener(listener: TextReaderListener) { if (listener?.onStateChange) { TextReaderHelper.on('stateChange', listener.onStateChange); } if (listener?.onStop) { TextReaderHelper.on('stop', listener.onStop); } if (listener?.onRelease) { TextReaderHelper.on('release', listener...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L242-L282
0d3b2832e20926ddf0b7ecd061df51a6b0c65d76
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets
arkts
行程信息类型 @param id @param trainNumber 列车号 @param wholeCourse 全程 @param startingTime 起始时间 @param endingTime 终止时间 @param timeDifference 距出发时间 @param origin 起始位置 @param destination 目的地 @param ticketEntrance 检票口 @param vehicleModel 车型
export interface TripDataType { id: number; trainNumber: string; wholeCourse: ResourceStr; startingTime: string; endingTime: string; timeDifference: ResourceStr; origin: ResourceStr; destination: ResourceStr; ticketEntrance: ResourceStr; vehicleModel: ResourceStr; }
AST#export_declaration#Left export AST#interface_declaration#Left interface TripDataType AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left trainNumber : AST#type_annotation#...
export interface TripDataType { id: number; trainNumber: string; wholeCourse: ResourceStr; startingTime: string; endingTime: string; timeDifference: ResourceStr; origin: ResourceStr; destination: ResourceStr; ticketEntrance: ResourceStr; vehicleModel: ResourceStr; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/DataType.ets#L32-L43
b7cbeb09f40e3333dd8488ac546490a1318c744e
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
HomeModule/src/main/ets/components/QuestionDetailComp.ets
arkts
QuestionDetailComp
@desc:问题详情页 @author:hxy @time:2024/3/19
@Component export struct QuestionDetailComp { @State item: QuestionDetail = {} as QuestionDetail @State list: QuestionDetail[] = [] @State index: number = 0 mViewModel: HomeViewModel = new HomeViewModel() controller: webview.WebviewController = new webview.WebviewController() aboutToAppear() { co...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct QuestionDetailComp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right item : AST#type_annotation#Left AST#primary_type#Left QuestionDetail AST#primary_type#Right AST...
@Component export struct QuestionDetailComp { @State item: QuestionDetail = {} as QuestionDetail @State list: QuestionDetail[] = [] @State index: number = 0 mViewModel: HomeViewModel = new HomeViewModel() controller: webview.WebviewController = new webview.WebviewController() aboutToAppear() { co...
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/HomeModule/src/main/ets/components/QuestionDetailComp.ets#L14-L33
f6480110110424b7ff0cd4176578c0830e1a4ba2
github
RicardoWesleyli/ArkUI-Animations.git
a85f94156d3fde1439bfb68a2108dbc3eb4a1dca
BuyButtonAnimation/entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
生命周期方法:页面加载时执行
aboutToAppear() { this.startSpinAnimation() this.startIconAnimation() }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . startSpinAnimation AST...
aboutToAppear() { this.startSpinAnimation() this.startIconAnimation() }
https://github.com/RicardoWesleyli/ArkUI-Animations.git/blob/a85f94156d3fde1439bfb68a2108dbc3eb4a1dca/BuyButtonAnimation/entry/src/main/ets/pages/Index.ets#L92-L95
7588ca9e017529f51cf838947ecf68c313c693b7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreview.ets
arkts
getListMaxLength
获取图片数量和设置懒加载图片数据
getListMaxLength() { this.listMaxLength = this.imageList.length; this.lazyImageList.clearAndPushAll(this.imageList); }
AST#method_declaration#Left getListMaxLength 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 . listMaxLength AST#member_expressi...
getListMaxLength() { this.listMaxLength = this.imageList.length; this.lazyImageList.clearAndPushAll(this.imageList); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreview.ets#L65-L68
9de71784e5b59a48b8f8561d60d65f5a71046b33
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets
arkts
getFullFps
方法描述 计算满帧 @param maxFps maxFps @return java.lang.Integer get full fps
static getFullFps(maxFps: number): number { /*关于满帧判定,把所有帧率做一次遍历: * 1、只要有>=100帧,则判断为120帧 * 2、否则只要有>=70 且所有帧都小于100,则判断为90帧 * 1、否则只要有>=44 并且 所有帧都小于70的情况,就按照满帧60帧 * 2、只要有>=34,且所有帧率均小于44的,就按照满帧40帧 * 3、如果所有帧率均小于34帧的,就按照满帧30 */ if (maxFps >= 100) { return 120; } else if (maxFps...
AST#method_declaration#Left static getFullFps AST#parameter_list#Left ( AST#parameter#Left maxFps : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
static getFullFps(maxFps: number): number { if (maxFps >= 100) { return 120; } else if (maxFps >= 70) { return 90; } else if (maxFps >= 44) { return 60; } else if (maxFps >= 34) { return 40; } return 30; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets#L48-L67
06e76307001433a89f42f50d76cb5a6bf332d53b
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/ColumnInfo.ets
arkts
Copyright (C), 2024-06-22 @author LinXun @date 2024-06-22 10:08 @version 1.0 @description: 数据库列接口
export interface ColumnInfo{ // 实体属性名 name: string // 数据库列名 columnName: string // 列类型 type: ColumnType defaultValue?: string | number }
AST#export_declaration#Left export AST#interface_declaration#Left interface ColumnInfo AST#object_type#Left { // 实体属性名 AST#type_member#Left name : 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 columnName : AST#t...
export interface ColumnInfo{ name: string columnName: string type: ColumnType defaultValue?: string | number }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/types/ColumnInfo.ets#L8-L16
6f52238660c24875bda3509672b920e3d16872f7
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarCalendar.ets
arkts
getLunarMonthDays
获取农历月的天数
private getLunarMonthDays(year: number, month: number): number { if (year < 1900 || year > 2100 || month < 1 || month > 12) return 30; const yearInfo = this.lunarInfo[year - 1900]; return (yearInfo & (0x10000 >> month)) ? 30 : 29; }
AST#method_declaration#Left private getLunarMonthDays AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#prim...
private getLunarMonthDays(year: number, month: number): number { if (year < 1900 || year > 2100 || month < 1 || month > 12) return 30; const yearInfo = this.lunarInfo[year - 1900]; return (yearInfo & (0x10000 >> month)) ? 30 : 29; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarCalendar.ets#L183-L188
7caca4072291f4680ce0f8d602e3bf3d645fdb81
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/pages/component/PanKouComponent.ets
arkts
_drawUI
绘制UI
_drawUI() { this._clearCanvas() this._drawNewPrice() this._drawPanKouDetail() // this.panKouDetail.strokeRect(this.context, "#e2233e") }
AST#method_declaration#Left _drawUI AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . _clearCanvas AST#member_expr...
_drawUI() { this._clearCanvas() this._drawNewPrice() this._drawPanKouDetail() }
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/pages/component/PanKouComponent.ets#L47-L52
48562f99f7b33fa9ebcab834b52391faf53ebbbf
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/DES.ets
arkts
generateSymKeySync
生成对称密钥SymKey,同步 @param symAlgName 待生成对称密钥生成器的算法名称(3DES192) @returns
static generateSymKeySync(): cryptoFramework.SymKey { return CryptoUtil.generateSymKeySync('3DES192'); }
AST#method_declaration#Left static generateSymKeySync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#...
static generateSymKeySync(): cryptoFramework.SymKey { return CryptoUtil.generateSymKeySync('3DES192'); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L200-L202
a7c8f2bc7c2f361cafd5370bb30d089afdc201da
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/OnlineLunarService.ets
arkts
农历年份详细信息
export interface OnlineLunarYear { year: number; zodiac: string; ganzhi: string; leapMonth: number; isLeapYear: boolean; leapMonthDays?: number; solarTerms: SolarTermInfo[]; festivals: LunarFestival[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface OnlineLunarYear AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left zodiac : AST#type_annotation#...
export interface OnlineLunarYear { year: number; zodiac: string; ganzhi: string; leapMonth: number; isLeapYear: boolean; leapMonthDays?: number; solarTerms: SolarTermInfo[]; festivals: LunarFestival[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/OnlineLunarService.ets#L36-L45
26722763c3e428d32d20422eb00ebc83547e84db
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
isSameMinute
是否是同一分
static isSameMinute(selectDate: Date, date: Date): boolean { return DateHelper.isSameHour(selectDate, date) && selectDate.getMinutes() == date.getMinutes(); }
AST#method_declaration#Left static isSameMinute AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_t...
static isSameMinute(selectDate: Date, date: Date): boolean { return DateHelper.isSameHour(selectDate, date) && selectDate.getMinutes() == date.getMinutes(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L144-L146
ed096cc2e04489ff4ae43cdeafd44463dc5c04e0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
arkts
getCredential
/** * 获取固定密钥 仅在测试时使用 public static constCredential: CredentialCallBack = (request)=>{ return new Promise((resolve, reject) => { let credential : QCloudCredential= new QCloudCredential(); // 用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140 credential.secretID = ...
getCredential(): QCloudCredential { let credential : QCloudCredential= new QCloudCredential(); // 用户的 SecretId credential.secretID = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretId)!! //"SECRETID"; // 用户的 SecretKey credential.secretKey = StringEncoder.decodeAfterRemoveSalt(CosConfig.secret...
AST#method_declaration#Left getCredential AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left QCloudCredential AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left c...
getCredential(): QCloudCredential { let credential : QCloudCredential= new QCloudCredential(); credential.secretID = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretId)!! credential.secretKey = StringEncoder.decodeAfterRemoveSalt(CosConfig.secretKey)!! return credential ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L79-L92
6f6371fc3197b7485955db75ef7afe4bae2e7383
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/Helper.ets
arkts
isLargeScreen
是否是大屏,大于手机屏幕宽度500vp
static isLargeScreen(): boolean { return Helper.getDisplayWidth() > 500; }
AST#method_declaration#Left static isLargeScreen AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_ex...
static isLargeScreen(): boolean { return Helper.getDisplayWidth() > 500; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/Helper.ets#L202-L204
dd1fe3508eb9cb0cc6725d2da5422188a9e23146
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CandleDataSet.ets
arkts
DataSet for the CandleStickChart.
export default class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> implements ICandleDataSet { /** * the width of the shadow of the candle */ private mShadowWidth: number = 3; /** * should the candle bars show? * when false, only "ticks" will show * <p/> * - default: true *...
AST#export_declaration#Left export default AST#class_declaration#Left class CandleDataSet extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left LineScatterCandleRadarDataSet AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left CandleEntry AST#primary_type#Right AST#type_annota...
export default class CandleDataSet extends LineScatterCandleRadarDataSet<CandleEntry> implements ICandleDataSet { private mShadowWidth: number = 3; private mShowCandleBar: boolean = true; private mBarSpace: number = 0.1; private mShadowColorSameAsCandle: boolean = false; protected mIncreasingPa...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CandleDataSet.ets#L29-L285
795d6bf48958ae08bf044fbf06379f5de65fefd6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/Index.ets
arkts
BuilderNodePoolDemoComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { BuilderNodePoolDemoComponent } from './src/main/ets/pages/BuilderNodePoolDemo';
AST#export_declaration#Left export { BuilderNodePoolDemoComponent } from './src/main/ets/pages/BuilderNodePoolDemo' ; AST#export_declaration#Right
export { BuilderNodePoolDemoComponent } from './src/main/ets/pages/BuilderNodePoolDemo';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/Index.ets#L16-L16
8ad7312b4b5089cd001ce0027d90fb2e63582b8c
gitee
hefengbao/jingmo-for-HarmonyOS.git
a208f3fdc95c0914749072e811301b9dfd6678d6
commons/constants/src/main/ets/DbConst.ets
arkts
为了保证平稳升级,所有的修改、删除操作都通过 SQL 语句完成,即不更改以前版本的 SQL 语句
export class DbMigrationConst { // Version 1 static readonly CREATE_CHINA_WORLDCULTUREHERITAGE_TABLE: string = 'create table if not exists ' + DbTableConst.CHINA_WORLDCULTUREHERITAGE_TABLE + ' (id integer primary key autoincrement not null, type text not null, name text not null, year text not null, ' + ...
AST#export_declaration#Left export AST#class_declaration#Left class DbMigrationConst AST#class_body#Left { // Version 1 AST#property_declaration#Left static readonly CREATE_CHINA_WORLDCULTUREHERITAGE_TABLE : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#exp...
export class DbMigrationConst { static readonly CREATE_CHINA_WORLDCULTUREHERITAGE_TABLE: string = 'create table if not exists ' + DbTableConst.CHINA_WORLDCULTUREHERITAGE_TABLE + ' (id integer primary key autoincrement not null, type text not null, name text not null, year text not null, ' + 'year2 ...
https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/commons/constants/src/main/ets/DbConst.ets#L42-L133
2c0f1d776fab97500a13ed54ad0ebbadb64619b1
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppAspectProgrammingDesign/entry/src/main/ets/components/someThirdParty.ets
arkts
[Start webhandler] someThirdParty.ets
export class WebHandler { getWebAddrHttps(): string { let ret = 'http'; // ... return ret; } }
AST#export_declaration#Left export AST#class_declaration#Left class WebHandler AST#class_body#Left { AST#method_declaration#Left getWebAddrHttps 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_stateme...
export class WebHandler { getWebAddrHttps(): string { let ret = 'http'; return ret; } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/components/someThirdParty.ets#L22-L28
0c2b199512b5b15b01fd08a5845bf8da209a00fc
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets
arkts
drawPan
绘制表盘
private drawPan(): void{ this.renderContext.beginPath(); let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL); let imgWidth = this.clockRadius * 2; this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth); this.renderContext.restore(); }
AST#method_declaration#Left private drawPan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left...
private drawPan(): void{ this.renderContext.beginPath(); let secondImg = new ImageBitmap(MainConstant.CLOCK_PAN_IMAGE_URL); let imgWidth = this.clockRadius * 2; this.renderContext.drawImage(secondImg, -this.clockRadius, -this.clockRadius, imgWidth, imgWidth); this.renderContext.restore(); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets#L94-L100
604c90fb8c97c3763ff577e678c5a9ed085facdf
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
完整农历系统设计.ets
arkts
getLunarYearCn
获取农历年份中文表示
private static getLunarYearCn(lunarYear: number): string { const yearStr = lunarYear.toString(); const cnNumbers = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"]; let result = ""; for (let i = 0; i < yearStr.length; i++) { result += cnNumbers[parseInt(yearStr[i])]; } return r...
AST#method_declaration#Left private static getLunarYearCn AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string...
private static getLunarYearCn(lunarYear: number): string { const yearStr = lunarYear.toString(); const cnNumbers = ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"]; let result = ""; for (let i = 0; i < yearStr.length; i++) { result += cnNumbers[parseInt(yearStr[i])]; } return r...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L399-L409
d78c4885f10122c0460c231de987fbd5050f1941
github
jianguo888/nut-weather
d37553c8d4c994c5e69134e7591318c4790a8245
entry/src/main/ets/MainAbility/common/RealtimeWeather.ets
arkts
RealtimeWeather
@ts-nocheck 该组件为实时天气预报组件 powered by 坚果 2022/7/20
@Entry @Component export struct RealtimeWeather{ @State temp: string = "9" @State text: string = "坚果" @State isRequestSucceed: boolean = true build(){ Column() { Text($r("app.string.city")) .fontSize(30) Row() { Text(this.temp) .fontSize(100) Text('℃') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct RealtimeWeather AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right temp : AST#type_annotation#Left AST#primary_type#Le...
@Entry @Component export struct RealtimeWeather{ @State temp: string = "9" @State text: string = "坚果" @State isRequestSucceed: boolean = true build(){ Column() { Text($r("app.string.city")) .fontSize(30) Row() { Text(this.temp) .fontSize(100) Text('℃') ...
https://github.com/jianguo888/nut-weather/blob/d37553c8d4c994c5e69134e7591318c4790a8245/entry/src/main/ets/MainAbility/common/RealtimeWeather.ets#L23-L57
a861e400014ba0fb927a87114d73914efe9140fc
gitee
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/common/utils/windowManager.ets
arkts
disableFullScreen
关闭沉浸式模式
static async disableFullScreen() { const win = await window.getLastWindow(getContext()) //使用window这个API的getLastWindow方法获取页面 win.setWindowLayoutFullScreen(false) //使用setWindowLayoutFullScreen设置false关闭沉浸式模式 AppStorage.setOrCreate('topHeight', 0) //将高度重置为零 }
AST#method_declaration#Left static async disableFullScreen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left win = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left...
static async disableFullScreen() { const win = await window.getLastWindow(getContext()) win.setWindowLayoutFullScreen(false) AppStorage.setOrCreate('topHeight', 0) }
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/windowManager.ets#L14-L18
af50ef2e757e7e9b8e9f91eee24c349c158833f6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/i18n/LanguageDetector.ets
arkts
detectBestLanguage
检测最佳语言
async detectBestLanguage(): Promise<LanguageDetectionResult> { try { // 1. 检测系统语言 const systemResult = await this.detectSystemLanguage(); // 2. 检测地区偏好 const regionResult = await this.detectRegionLanguage(); // 3. 综合分析 const finalResult = this.combineDetectionResults...
AST#method_declaration#Left async detectBestLanguage 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 LanguageDetectionResult AST#primary_type#Right AST#type_annota...
async detectBestLanguage(): Promise<LanguageDetectionResult> { try { const systemResult = await this.detectSystemLanguage(); const regionResult = await this.detectRegionLanguage(); const finalResult = this.combineDetectionResults([systemResult, regionResult]); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/LanguageDetector.ets#L186-L213
ef3e1f6dbc53683e3f6252ade6a7c05148bf8284
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SimpleBirthdayApp.ets
arkts
buildTabBarItem
构建Tab栏项
@Builder buildTabBarItem(title: string, icon: string, index: number) { Column({ space: 4 }) { Text(icon) .fontSize(20) .opacity(this.currentTabIndex === index ? 1 : 0.6) Text(title) .fontSize(10) .fontColor(this.currentTabIndex === index ? '#4ECDC4' : '#999999') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabBarItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon : AST#type_annotation#Lef...
@Builder buildTabBarItem(title: string, icon: string, index: number) { Column({ space: 4 }) { Text(icon) .fontSize(20) .opacity(this.currentTabIndex === index ? 1 : 0.6) Text(title) .fontSize(10) .fontColor(this.currentTabIndex === index ? '#4ECDC4' : '#999999') ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SimpleBirthdayApp.ets#L1639-L1654
068a5b3b805d167b7e82bb61c9b203b34b4ee471
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets
arkts
XComponent's Y方向的偏移量
constructor() { this.width = 1080; this.height = 720; this.offsetX = 0; this.offsetY = 0; }
AST#constructor_declaration#Left constructor 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 . width AST#member_exp...
constructor() { this.width = 1080; this.height = 720; this.offsetX = 0; this.offsetY = 0; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/model/ScanSize.ets#L29-L34
7d367a731e3617f1d5eaeb0b38cd391815dbe201
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/practice/CaloriePage.ets
arkts
OneWeekTrainTime
************************************统计图处理*********************************************
@Builder OneWeekTrainTime(workoutdata:WorkoutData,day:number){ Column(){ Row(){ Text(this.Month.toString()+'月'+day.toString()+'日-'+this.Month.toString()+'月'+(day+6).toString()+'日') .fontSize(20) .fontColor('#222B45') .fontWeight('500') Row(){ Text(work...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right OneWeekTrainTime AST#parameter_list#Left ( AST#parameter#Left workoutdata : AST#type_annotation#Left AST#primary_type#Left WorkoutData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : AST#type_ann...
@Builder OneWeekTrainTime(workoutdata:WorkoutData,day:number){ Column(){ Row(){ Text(this.Month.toString()+'月'+day.toString()+'日-'+this.Month.toString()+'月'+(day+6).toString()+'日') .fontSize(20) .fontColor('#222B45') .fontWeight('500') Row(){ Text(work...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/CaloriePage.ets#L82-L141
330c4b8de96215d1b97090704c9a3a449ddbfc4b
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatBotItemUI.ets
arkts
typewriterFun
打印机字体显示效果函数 @param msg
typewriterFun(msg:string) { let id = 0; let timer = setInterval(() => { if (id < msg.length) { this.textMsg += msg[id++]; } else { clearInterval(timer); } }, 100); }
AST#method_declaration#Left typewriterFun 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#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left l...
typewriterFun(msg:string) { let id = 0; let timer = setInterval(() => { if (id < msg.length) { this.textMsg += msg[id++]; } else { clearInterval(timer); } }, 100); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/view/ChatBotItemUI.ets#L47-L56
7c240e70cf2522521d85415ed2470bbc0246384d
gitee
openharmony/arkcompiler_ets_frontend
ddf0cc059556d046c2896e7a27e23ac9eefda70c
ets2panda/linter/homecheck/resources/thirdPartyModules/@ohos/gif-drawable/index.ets
arkts
default
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { default as GIFComponentV2 } from './src/main/ets/components/gif/display/GIFComponentV2';
AST#export_declaration#Left export { default as GIFComponentV2 } from './src/main/ets/components/gif/display/GIFComponentV2' ; AST#export_declaration#Right
export { default as GIFComponentV2 } from './src/main/ets/components/gif/display/GIFComponentV2';
https://github.com/openharmony/arkcompiler_ets_frontend/blob/ddf0cc059556d046c2896e7a27e23ac9eefda70c/ets2panda/linter/homecheck/resources/thirdPartyModules/@ohos/gif-drawable/index.ets#L15-L15
2bde2b311f08b26ea328a81c6bd6ee6cd6f150d4
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DatabaseService.ets
arkts
getDatabaseVersion
获取数据库版本
private async getDatabaseVersion(): Promise<number> { if (!this.rdbStore) return 0; try { // 使用 PRAGMA user_version 存储版本号 const resultSet = await this.rdbStore.querySql('PRAGMA user_version'); let version = 0; if (resultSet.goToFirstRow()) { version = resultSet.getLong(0); ...
AST#method_declaration#Left private async getDatabaseVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Righ...
private async getDatabaseVersion(): Promise<number> { if (!this.rdbStore) return 0; try { const resultSet = await this.rdbStore.querySql('PRAGMA user_version'); let version = 0; if (resultSet.goToFirstRow()) { version = resultSet.getLong(0); } resultSet.close(); ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DatabaseService.ets#L103-L119
e474d6ee3c7518a085185ad5efa4b1c2c519e954
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/ets/entryability/EntryAbility.ets
arkts
[Start register_init_scheme]
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { // 注册三方协议的配置。 testNapi.registerCustomSchemes(); // 初始化Web组件内核,该操作会初始化Browser进程以及创建BrowserContext。 webview.WebviewController.initializeWebEngine(); // 设置SchemeHandler。 te...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty...
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { testNapi.registerCustomSchemes(); webview.WebviewController.initializeWebEngine(); testNapi.setSchemeHandler(); } onDestroy(): void { } onWindowStageCre...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/ManageWebPageLoadBrowse/NetReqInterceptCacheWinOps/entry/src/main/ets/entryability/EntryAbility.ets#L24-L59
90f3cf6bae16e2c0c5159a819146a2d1879aef87
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_axios/src/main/ets/axios/EfClientApi.ets
arkts
getByParams
get请求 - json格式 @param efClientParams get请求入参实体 @returns
async getByParams<E>(efClientParams: efClientParams<null>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> { try { //如果当前请求efClientParams.loadingTxt传入参数 则 更改当前的loading文本 if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let response: Axio...
AST#method_declaration#Left async getByParams AST#type_parameters#Left < AST#type_parameter#Left E AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left efClientParams : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left efClientParams AST#type_arguments#Lef...
async getByParams<E>(efClientParams: efClientParams<null>, cls?: ClassConstructor<E>): Promise<E | EfAxiosError> { try { if (efClientParams.loadingTxt) { efAxiosParams.loadingTxt = efClientParams.loadingTxt; } let response: AxiosResponse<E> = await efAxios.get<E, AxiosResponse<E>, n...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L192-L222
d7f5d4144a0a2917fbe106ea7bb1d470cb55a2d4
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
encryptGCM
加密(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.SymKey, gcmParams: cryptoFramework.GcmParamsSpec): Promise<cryptoFramework.DataBlob> { let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); await cipher.init(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams)...
AST#method_declaration#Left static async encryptGCM AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
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.ENCRYPT_MODE, symKey, gcmParams)...
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#L35-L43
1f068d3aa29a384ae99c1163699730e3ecdd91e6
github
dloong49/wallpaper-app.git
ef84f33ba56fbe333c50c0de59ae56d28f556c0b
entry/src/main/ets/component/ToLoad.ets
arkts
到底了
build() { Text("到底了~").fontSize(13).lineHeight(50).textAlign(TextAlign.Center) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left "到底了~" AST#expression#Right ) AST#ui_component#Right AST#modifier_chain_expression#Left . fontSize ( AST#expression#Left 13 AST#expression#Right ) AST#modif...
build() { Text("到底了~").fontSize(13).lineHeight(50).textAlign(TextAlign.Center) }
https://github.com/dloong49/wallpaper-app.git/blob/ef84f33ba56fbe333c50c0de59ae56d28f556c0b/entry/src/main/ets/component/ToLoad.ets#L36-L38
3bcff3ba1f6746360c8e3fb367561b004a260f3c
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Web General Initialization of a window's web environment.
export function init_web(storage: LocalStorage) { // Init download delegate (AppStorage.get('bunch_of_downloads') as bunch_of_downloads).init_delegate(storage); // Enable third party cookies webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(AppStorage.get('enable_third_party_cookies') as boolean); // ...
AST#export_declaration#Left export AST#function_declaration#Left function init_web AST#parameter_list#Left ( AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left {...
export function init_web(storage: LocalStorage) { (AppStorage.get('bunch_of_downloads') as bunch_of_downloads).init_delegate(storage); webview.WebCookieManager.putAcceptThirdPartyCookieEnabled(AppStorage.get('enable_third_party_cookies') as boolean); }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L57-L63
e86c489193d87a9fe5d483f97748d8cd0ed9c68c
gitee
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
calculateTotalPrice
计算选中商品的总价
calculateTotalPrice(): string { const selectedItems: Type1[] = this.datas.filter((item: Type1): boolean => item.selected); const total: number = selectedItems.reduce((sum: number, item: Type1): number => { // 从avalue中提取价格数字 const price: number = parseInt(item.avalue.replace('币', '')); return s...
AST#method_declaration#Left calculateTotalPrice 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#Left sel...
calculateTotalPrice(): string { const selectedItems: Type1[] = this.datas.filter((item: Type1): boolean => item.selected); const total: number = selectedItems.reduce((sum: number, item: Type1): number => { const price: number = parseInt(item.avalue.replace('币', '')); return sum + (isNaN(price...
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L249-L257
e42cc20f7d4887e0bb91c1d73f4dacbf8952f374
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/utils/StorageUtils.ets
arkts
putNumber
存储数值数据 @param key 存储键 @param value 存储值
static async putNumber(key: string, value: number): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.put(key, value); await dataPreferences.flush(); ...
AST#method_declaration#Left static async putNumber 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 number AST#primary_...
static async putNumber(key: string, value: number): Promise<void> { const dataPreferences = StorageUtils.dataPreferences; if (!dataPreferences) { console.error('Preferences not initialized'); return; } try { await dataPreferences.put(key, value); await dataPreferences.flush(); ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/StorageUtils.ets#L66-L79
93bc7f66ce370723ee39a307a1c6276518647274
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteItemModel.ets
arkts
套餐信息,包括时间、套餐名称、套餐价格、套餐类型
export declare class TimeList { time: string; // 套餐时间 name?: ResourceStr; // 套餐名称 price?: ResourceStr; // 套餐价格 type: string; // 套餐类型 }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class TimeList AST#class_body#Left { AST#property_declaration#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 套餐时间 A...
export declare class TimeList { time: string; name?: ResourceStr; price?: ResourceStr; type: string; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplescreening/src/main/ets/model/SiteItemModel.ets#L19-L24
b46e22aa9801078b959e4544eeabc6e559ffb448
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
decryptCBC
解密(CBC模式),异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param ivParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|CBC|PKCS7、SM4_128|CBC|PKCS5、等) @returns
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> { return SM4.decrypt(data, symKey, ivParams, transformation); }
AST#method_declaration#Left static async decryptCBC AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sym...
static async decryptCBC(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, ivParams: cryptoFramework.IvParamsSpec, transformation: string = 'SM4_128|CBC|PKCS7'): Promise<cryptoFramework.DataBlob> { return SM4.decrypt(data, symKey, ivParams, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L137-L140
45fbbce6e7e9181268d2b1d18d8424b7f81b6a1a
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/NotificationService.ets
arkts
setVoiceReminderEnabled
设置语音提醒开关 @param enabled - 是否启用语音提醒
setVoiceReminderEnabled(enabled: boolean): void { this.voiceReminderEnabled = enabled; console.info(`[NotificationService] 语音提醒${enabled ? '已启用' : '已禁用'}`); }
AST#method_declaration#Left setVoiceReminderEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prim...
setVoiceReminderEnabled(enabled: boolean): void { this.voiceReminderEnabled = enabled; console.info(`[NotificationService] 语音提醒${enabled ? '已启用' : '已禁用'}`); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L227-L230
b6f5f99f56a484252ec7d18ba2759862d9134fcb
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DisplayUtils.ets
arkts
getDefaultDisplay
获取默认屏幕信息
public static getDefaultDisplay(): display.Display { return DisplayUtils._defaultDisplay; }
AST#method_declaration#Left public static getDefaultDisplay AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left display . Display AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#L...
public static getDefaultDisplay(): display.Display { return DisplayUtils._defaultDisplay; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L13-L15
2a8813b650738307c597af138451d8c984a940d8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CrashUtil.ets
arkts
writeStr
将数据写入文件,并关闭文件。
private static writeStr(path: string, str: string): number { const file = FileUtil.openSync(path); let offset = FileUtil.statSync(file.fd).size; if (offset === 0) { str = `[${str}]`; } else { offset = offset - 1; str = `,${str}]`; } const options: WriteOptions = { offset: offse...
AST#method_declaration#Left private static writeStr AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
private static writeStr(path: string, str: string): number { const file = FileUtil.openSync(path); let offset = FileUtil.statSync(file.fd).size; if (offset === 0) { str = `[${str}]`; } else { offset = offset - 1; str = `,${str}]`; } const options: WriteOptions = { offset: offse...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CrashUtil.ets#L212-L225
007df6388af7d4f6ea385e9cb031a947d8f3a64e
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets
arkts
添加任务进度记录 @param progress 进度记录对象 @returns 创建的进度记录
export function addTaskProgress(progress: Progress): Promise<Progress> { try { // 创建符合接口的数据结构 const queryParams: QueryParams = {}; const requestData: RequestData = { taskId: progress.taskId, dreamId: progress.dreamId, userId: progress.userId, description: progress.description, ...
AST#export_declaration#Left export AST#function_declaration#Left function addTaskProgress AST#parameter_list#Left ( AST#parameter#Left progress : AST#type_annotation#Left AST#primary_type#Left Progress AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#...
export function addTaskProgress(progress: Progress): Promise<Progress> { try { const queryParams: QueryParams = {}; const requestData: RequestData = { taskId: progress.taskId, dreamId: progress.dreamId, userId: progress.userId, description: progress.description, }; ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L138-L165
02d544f99838520940e3a82ab3c31339396d802a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/ErrorHandler.ets
arkts
logError
记录错误日志
private logError(errorInfo: ErrorInfo): void { const logMessage = `[${errorInfo.type.toUpperCase()}] ${errorInfo.message}`; if (errorInfo.originalError) { hilog.error( LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `${logMessage} | Original: ${errorInfo.originalError.message}` ...
AST#method_declaration#Left private logError AST#parameter_list#Left ( AST#parameter#Left errorInfo : AST#type_annotation#Left AST#primary_type#Left ErrorInfo 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...
private logError(errorInfo: ErrorInfo): void { const logMessage = `[${errorInfo.type.toUpperCase()}] ${errorInfo.message}`; if (errorInfo.originalError) { hilog.error( LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `${logMessage} | Original: ${errorInfo.originalError.message}` ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L83-L104
7986ae60e63207c89eddb391336771f3a101ef25
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleStatsManager.ets
arkts
日统计数据
export interface SimpleDailyStats { tasksCompleted: number; tasksTotal: number; focusTime: number; pomodoroSessions: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SimpleDailyStats AST#object_type#Left { AST#type_member#Left tasksCompleted : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left tasksTotal : AST#t...
export interface SimpleDailyStats { tasksCompleted: number; tasksTotal: number; focusTime: number; pomodoroSessions: number; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleStatsManager.ets#L8-L13
5e4f764456fba738c9cb9037ff5957ca8517c673
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets
arkts
delete
删除数据 @param predicates 条件 @returns
delete(predicates: relationalStore.RdbPredicates): Promise<number> { return new Promise((resolve, reject) => { this.rdbStore?.delete(predicates, (err, rows) => { if (err) { Logger.error(`[${CommonConstants.RDB_TAG}]`,'删除失败!,', JSON.stringify(err)); reject(err); } else { ...
AST#method_declaration#Left delete AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : A...
delete(predicates: relationalStore.RdbPredicates): Promise<number> { return new Promise((resolve, reject) => { this.rdbStore?.delete(predicates, (err, rows) => { if (err) { Logger.error(`[${CommonConstants.RDB_TAG}]`,'删除失败!,', JSON.stringify(err)); reject(err); } else { ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DbUtil.ets#L149-L161
81d4815fd6719745eebda2855ea216e9059a838f
github
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/model/WeatherResult.ets
arkts
天气请求结果数据类型。与高德地图天气 API 请求结果向对应。
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/model/WeatherResult.ets#L6-L6
3846a74ac829a298fcf83a20b844d01f7beae5ba
github
zhonghaojie/ArkTSComponentPractice.git
73f56243f10439a872d0990320bb3f8df17d0001
entry/src/main/ets/pages/Login.ets
arkts
blueTextStyle
蓝字样式
@Extend(Text) function blueTextStyle () { .fontColor($r('app.color.login_blue_text_color')) .fontSize($r("app.float.small_text_size")) .fontWeight(FontWeight.Medium) .padding({ top: $r('app.float.forgot_margin_top'), bottom: $r('app.float.forgot_margin_top') }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function blueTextStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#r...
@Extend(Text) function blueTextStyle () { .fontColor($r('app.color.login_blue_text_color')) .fontSize($r("app.float.small_text_size")) .fontWeight(FontWeight.Medium) .padding({ top: $r('app.float.forgot_margin_top'), bottom: $r('app.float.forgot_margin_top') }) }
https://github.com/zhonghaojie/ArkTSComponentPractice.git/blob/73f56243f10439a872d0990320bb3f8df17d0001/entry/src/main/ets/pages/Login.ets#L30-L35
2abc17d65908a7641cd580bd136ce821e1da19f0
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets
arkts
WeekViewItem
时间计算工具类 周视图子组件
@Component export struct WeekViewItem { // 周视图日期数据 @State @Watch('getFirstDayData') weekDays: Day[][] = []; // 当前选中的日期 @State currentSelectDay: DayInfo = new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0); // 当前选中的日期 // 当前选中的日期,格式'year-month-date' @Link @Watch('OnC...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct WeekViewItem AST#component_body#Left { // 周视图日期数据 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left 'getFirstDayData' AST#expression#Right ) ...
@Component export struct WeekViewItem { @State @Watch('getFirstDayData') weekDays: Day[][] = []; @State currentSelectDay: DayInfo = new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1, new Date().getDate(), 0); ,格式'year-month-date' @Link @Watch('OnChangeSelectDate') currentSelectDate: str...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/view/WeekViewItem.ets#L25-L164
6ba5ec9a4976d0d65f86d6f09c973965c5dd3c41
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/TaoYao.ets
arkts
requestLocationGlobalSwitch
拉起全局开关弹窗,通过异步的方式告知是否打开了定位开关 @param context @returns true 打开了定位开关
static requestLocationGlobalSwitch(context: Context): Promise<boolean> { const locationGlobalSwitch = new LocationGlobalSwitch() return locationGlobalSwitch.requestGlobalSwitch(context) }
AST#method_declaration#Left static requestLocationGlobalSwitch 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 AS...
static requestLocationGlobalSwitch(context: Context): Promise<boolean> { const locationGlobalSwitch = new LocationGlobalSwitch() return locationGlobalSwitch.requestGlobalSwitch(context) }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L115-L118
9a516d024021cb574bfb681305a30c1795e4d0d2
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets
arkts
ExceptionPrompt
Declare struct ExceptionPrompt higher-order component. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @since 11 Declare struct ExceptionPrompt higher-order component. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
@Component export declare struct ExceptionPrompt { /** * Configuration information of ExceptionPrompt. * @type { PromptOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @since 11 */ /** * Configuration information of ExceptionPrompt. * @type { PromptO...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ExceptionPrompt AST#component_body#Left { /** * Configuration information of ExceptionPrompt. * @type { PromptOptions } * @syscap SystemCapability.ArkUI.ArkUI.Full...
@Component export declare struct ExceptionPrompt { @Prop options: PromptOptions; onTipClick?: () => void; onActionTextClick?: () => void; build(): void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets#L190-L257
a30395e4d6850af8dd2662a349d951930b28fdec
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FormatUtil.ets
arkts
getParamsUrl
将参数拼接在url上,返回新的url。 @param url 拼接的url @param params 拼接的参数 @param append true-直接拼接(可能会出现相同key),false-拼接值,并删除重复值 @returns
static getParamsUrl(url: string, params: Map<string, Any> | Record<string, Any>, append: boolean = false): string { const urlObj = OsUrl.URL.parseURL(url); const paramsObj = urlObj.params; if (params instanceof Map) { params.forEach((value: Any, key: string) => { if (key && value != undefined)...
AST#method_declaration#Left static getParamsUrl AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left A...
static getParamsUrl(url: string, params: Map<string, Any> | Record<string, Any>, append: boolean = false): string { const urlObj = OsUrl.URL.parseURL(url); const paramsObj = urlObj.params; if (params instanceof Map) { params.forEach((value: Any, key: string) => { if (key && value != undefined)...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L172-L198
2ea5213d9927f1c2333ccf86042451979f0c4316
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets
arkts
isToday
检查日期是否为今天 @param date 需要检查的日期 @returns 是否为今天
static isToday(date: Date): boolean { const today = new Date(); return date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear(); }
AST#method_declaration#Left static isToday AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig...
static isToday(date: Date): boolean { const today = new Date(); return date.getDate() === today.getDate() && date.getMonth() === today.getMonth() && date.getFullYear() === today.getFullYear(); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L206-L211
3bd399dd610c694540045b7fdef06691a0d6b67b
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/viewmodel/CoreViewModel.ets
arkts
@file 核心页面 ViewModel @author Joker.X
@ObservedV2 export default class CoreViewModel extends BaseViewModel { /** * 核心模块卡片数据 */ @Trace readonly cards: CoreCardItem[] = [ { title: $r("app.string.main_core_network_demo_title"), description: $r("app.string.main_core_network_demo_desc"), onClick: () => DemoNavigator.toNetworkDe...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class CoreViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 核心模块卡片数据 */ AST#...
@ObservedV2 export default class CoreViewModel extends BaseViewModel { @Trace readonly cards: CoreCardItem[] = [ { title: $r("app.string.main_core_network_demo_title"), description: $r("app.string.main_core_network_demo_desc"), onClick: () => DemoNavigator.toNetworkDemo() }, { ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/CoreViewModel.ets#L9-L47
abfe0c904cfe7caf6852c7883f4e2a22d540f707
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
buildEpisodeItem
单集项
@Builder buildEpisodeItem(episode: Episode) { Column() { Row() { // 封面图 Image(episode.imageUrl) .width(60) .height(60) .borderRadius(6) .objectFit(ImageFit.Cover) .alt($r('app.media.app_icon')) // 单集信息 Column() { Te...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEpisodeItem AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function...
@Builder buildEpisodeItem(episode: Episode) { Column() { Row() { Image(episode.imageUrl) .width(60) .height(60) .borderRadius(6) .objectFit(ImageFit.Cover) .alt($r('app.media.app_icon')) Column() { Text(episode.ti...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1066-L1136
ed81f0fda0453038c50ec4593fee37f64a11346e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
评论接口
export interface Comment { id: string; postId: string; authorId: string; author: UserProfile; content: string; parentId?: string; // 回复评论的ID replies?: Comment[]; likes: number; isLiked: boolean; createdAt: string; updatedAt: string; status: 'active' | 'hidden' | 'deleted'; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Comment 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 postId : AST#type_annotation#Left AST#p...
export interface Comment { id: string; postId: string; authorId: string; author: UserProfile; content: string; parentId?: string; replies?: Comment[]; likes: number; isLiked: boolean; createdAt: string; updatedAt: string; status: 'active' | 'hidden' | 'deleted'; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L114-L127
93f0b995104653a521a77345ab903e6712e3e6f4
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/model/SectionsWaterFlowDataSource.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 SectionsWaterFlowDataSource implements IDataSource { dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i: number = 0; i < 100; i++) { this.dataArray.push(i); } } public getData(index: number): number { return this.dataArray[index]...
AST#export_declaration#Left export AST#class_declaration#Left class SectionsWaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#...
export class SectionsWaterFlowDataSource implements IDataSource { dataArray: number[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i: number = 0; i < 100; i++) { this.dataArray.push(i); } } public getData(index: number): number { return this.dataArray[index]...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/SectionsWaterFlowDataSource.ets#L16-L121
d6f76b7f8513f86a26d3b6b4c28854e6f6a7d879
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
contains
检查文本是否包含模式串 @param text 文本字符串 @param pattern 模式串 @returns 是否包含模式串
static contains(text: string, pattern: string): boolean { if (!text || !pattern || pattern.length === 0) { return false; } const m = pattern.length; const n = text.length; const patternHash = RabinKarp.hash(pattern); let textHash = RabinKarp.hash(text.substring(0, m)); const highestPo...
AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static contains(text: string, pattern: string): boolean { if (!text || !pattern || pattern.length === 0) { return false; } const m = pattern.length; const n = text.length; const patternHash = RabinKarp.hash(pattern); let textHash = RabinKarp.hash(text.substring(0, m)); const highestPo...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L149-L173
8e2843c9535f9a006b15883e7d6817832885aa5c
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/complete/FormKitDemo/entry/src/main/ets/common/CommonConstants.ets
arkts
公共常量类
export default class CommonConstants{ // font-size static readonly GOODS_LIST_PADDING: number = 8; static readonly GOODS_EVALUATE_FONT_SIZE: number = 12; static readonly NORMAL_FONT_SIZE: number = 16; static readonly BIGGER_FONT_SIZE: number = 20; static readonly MAX_FONT_SIZE: number = 32; // margin s...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { // font-size AST#property_declaration#Left static readonly GOODS_LIST_PADDING : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 8...
export default class CommonConstants{ static readonly GOODS_LIST_PADDING: number = 8; static readonly GOODS_EVALUATE_FONT_SIZE: number = 12; static readonly NORMAL_FONT_SIZE: number = 16; static readonly BIGGER_FONT_SIZE: number = 20; static readonly MAX_FONT_SIZE: number = 32; static readonly REFRES...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/FormKitDemo/entry/src/main/ets/common/CommonConstants.ets#L4-L38
e056a606530d01f904e043acd0fec152c56adeae
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets
arkts
getDLPSupported
查询当前可支持权限设置和校验的文件扩展名类型列表
async getDLPSupported(fileSuffix: string): Promise<void> { try { let res: Array<string> = await dlpPermission.getDLPSupportedFileTypes(); // 获取支持DLP的文件类型 Logger.info(TAG, 'file extension support permission :' + JSON.stringify(res)); Logger.info(TAG, 'file extension is:' + fileSuffix); this.f...
AST#method_declaration#Left async getDLPSupported AST#parameter_list#Left ( AST#parameter#Left fileSuffix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t...
async getDLPSupported(fileSuffix: string): Promise<void> { try { let res: Array<string> = await dlpPermission.getDLPSupportedFileTypes(); Logger.info(TAG, 'file extension support permission :' + JSON.stringify(res)); Logger.info(TAG, 'file extension is:' + fileSuffix); this.fileSuffixInclud...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/filePage.ets#L148-L162
0aa92de12b5a182914bf65118d666044ae6c0e83
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
getParamByKey
获取路由参数 建议带上默认值和泛型 @param key @param defVal @returns
public static getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P { return ZRouter.getInstance().getParamByKey<P>(key, defVal) }
AST#method_declaration#Left public static getParamByKey AST#type_parameters#Left < AST#type_parameter#Left P = AST#type_annotation#Left AST#primary_type#Left ObjectOrNull AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left ke...
public static getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P { return ZRouter.getInstance().getParamByKey<P>(key, defVal) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L358-L360
e58dfb21c334458cc3c60af1c61bc49f09ad1492
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/wordcard/WordCardsView.ets
arkts
autoPlaySound
自动发音
async autoPlaySound(){ ///会员检查 if(!MemberManager.shared.checkAutoPronUsable(false)){ return; } // 单词 自动发音 if (SettingManager.shared.autoPlaySound) { await AudioPlayer.shared.play(this.word.wordEnSoundText) } //例句 if (SettingManager.shared.autoPlaySoundEx) { //排队播放 ...
AST#method_declaration#Left async autoPlaySound AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { ///会员检查 AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left...
async autoPlaySound(){ if(!MemberManager.shared.checkAutoPronUsable(false)){ return; } if (SettingManager.shared.autoPlaySound) { await AudioPlayer.shared.play(this.word.wordEnSoundText) } if (SettingManager.shared.autoPlaySoundEx) { await AudioPlayer.share...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/wordcard/WordCardsView.ets#L629-L647
91ce5709939328dc4bc00ca7bdd6191e8cc6dce5
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/field_sensitive/container/array_003_T.ets
arkts
Introduction 数组索引
export function array_003_T(taint_src : string) { let arr = [[taint_src], ["b"], "c"] taint.Sink(arr[0][0]); }
AST#export_declaration#Left export AST#function_declaration#Left function array_003_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#Left { ...
export function array_003_T(taint_src : string) { let arr = [[taint_src], ["b"], "c"] taint.Sink(arr[0][0]); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/field_sensitive/container/array_003_T.ets#L6-L9
a88726bdc5ba2215d76b93d22fd109e920ba4087
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Error receive event when the web page receives a web resource loading error. @typedef OnErrorReceiveEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnErrorReceiveEvent { /** * Web resource request of event. * * @type { WebResourceRequest } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ request: WebResourceRequest; /** * Web resource error of event. * ...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnErrorReceiveEvent AST#object_type#Left { /** * Web resource request of event. * * @type { WebResourceRequest } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice *...
export declare interface OnErrorReceiveEvent { request: WebResourceRequest; error: WebResourceError; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L188-L207
d3b3e0a82aa8cd101ffaeef36bbcccabf5cdbd31
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/detailsability/EntryDetailsAbility.ets
arkts
Lift cycle management of Ability.
export default class EntryDetailsAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { Logger.info(CommonConstants.TAG_DETAILS, 'want =' + JSON.stringify(want)); Logger.info(CommonConstants.TAG_DETAILS, 'launchParam =' + JSON.stringify(launchParam)); let params = wan...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryDetailsAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want :...
export default class EntryDetailsAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { Logger.info(CommonConstants.TAG_DETAILS, 'want =' + JSON.stringify(want)); Logger.info(CommonConstants.TAG_DETAILS, 'launchParam =' + JSON.stringify(launchParam)); let params = wan...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/detailsability/EntryDetailsAbility.ets#L27-L49
abc5667d6c446c32a69e434f31575bdb81b47805
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onTouchMove
Touch move. @param x @param y
onTouchMove(x: number, y: number): void { Logger.debug(TAG, `onTouchMove: [state: ${this.state}] [x: ${x}, y: ${y}]`); let offsetX = x - this.touchPoint.x; let offsetY = y - this.touchPoint.y; if (this.state === CropTouchState.CROP_MOVE) { this.cropShow.moveCropRect(offsetX, offsetY); } else i...
AST#method_declaration#Left onTouchMove 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_type#Right AST#ty...
onTouchMove(x: number, y: number): void { Logger.debug(TAG, `onTouchMove: [state: ${this.state}] [x: ${x}, y: ${y}]`); let offsetX = x - this.touchPoint.x; let offsetY = y - this.touchPoint.y; if (this.state === CropTouchState.CROP_MOVE) { this.cropShow.moveCropRect(offsetX, offsetY); } else i...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L237-L250
f048c23277f3b051a0200560e9c3419e10a52688
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CategoryPage.ets
arkts
onRightListScroll
右侧列表滚动同步左侧选中 @param {number} startIndex - 当前可见起始索引 @returns {void} 无返回值
private onRightListScroll(startIndex: number): void { this.vm.onRightListScroll(startIndex); }
AST#method_declaration#Left private onRightListScroll AST#parameter_list#Left ( AST#parameter#Left startIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#...
private onRightListScroll(startIndex: number): void { this.vm.onRightListScroll(startIndex); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L210-L212
4a955d76e28f49e4aa9e1023f60b66a36c23dfa4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
generatePreviewInfo
根据文件uri构建PreviewInfo @param uri 文件的uri @returns
static generatePreviewInfo(uri: string): filePreview.PreviewInfo { const fileName = FileUtils.getFileName(uri); const fileExtention = FileUtils.getFileExtention(fileName); const mimeType = Tools.getMimeType(fileExtention); let previewInfo: filePreview.PreviewInfo = { title: fileName, uri: ur...
AST#method_declaration#Left static generatePreviewInfo AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t...
static generatePreviewInfo(uri: string): filePreview.PreviewInfo { const fileName = FileUtils.getFileName(uri); const fileExtention = FileUtils.getFileExtention(fileName); const mimeType = Tools.getMimeType(fileExtention); let previewInfo: filePreview.PreviewInfo = { title: fileName, uri: ur...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L310-L320
089fd40139c737d06b825e97dd8e58fc24d15b3c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
setZoomRatioFn
Zoom
setZoomRatioFn(zoomRatio: number): void { Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`); // Get the supported zoom range try { let zoomRatioRange = this.getZoomRatioRange(); Logger.info(TAG, `getZoomRatioRange success: ${JSON.stringify(zoomRatioRange)}`); } catch (error) { let ...
AST#method_declaration#Left setZoomRatioFn AST#parameter_list#Left ( AST#parameter#Left zoomRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type...
setZoomRatioFn(zoomRatio: number): void { Logger.info(TAG, `setZoomRatioFn value ${zoomRatio}`); try { let zoomRatioRange = this.getZoomRatioRange(); Logger.info(TAG, `getZoomRatioRange success: ${JSON.stringify(zoomRatioRange)}`); } catch (error) { let err = error as BusinessError; ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets#L228-L246
1246eaea0f52ecd4a5b11461b5243ce417cdffd1
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
showFatal
Outputs fatal-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showFatal(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.FATAL)) { hilog.fatal(DOMAIN, TAG, tag + SYMBOL + format, args); } }
AST#method_declaration#Left static showFatal AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static showFatal(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.FATAL)) { hilog.fatal(DOMAIN, TAG, tag + SYMBOL + format, args); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/JSCrash/entry/src/main/ets/pages/utils.ets#L78-L82
de997f5aa56da58d610a15f562545f19ae9a9696
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
定义一个类 AccountTable,用于操作记账数据的数据库表
export default class AccountTable { // 创建一个 Rdb 对象,用于处理数据库表的操作 private accountTable = new Rdb( CommonConstants.ACCOUNT_TABLE.tableName, CommonConstants.ACCOUNT_TABLE.sqlCreate, CommonConstants.ACCOUNT_TABLE.columns ); // 类构造函数,用于初始化数据库表 constructor(callback: Function = () => { }) { // 获取数据库...
AST#export_declaration#Left export default AST#class_declaration#Left class AccountTable AST#class_body#Left { // 创建一个 Rdb 对象,用于处理数据库表的操作 AST#property_declaration#Left private accountTable = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Rdb AST#expressi...
export default class AccountTable { private accountTable = new Rdb( CommonConstants.ACCOUNT_TABLE.tableName, CommonConstants.ACCOUNT_TABLE.sqlCreate, CommonConstants.ACCOUNT_TABLE.columns ); constructor(callback: Function = () => { }) { this.accountTable.getRdbStore(callback); } ...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/tables/AccountTable.ets#L10-L104
d1a6bb0ee8e43411e5d4d34efc42d3b4a65854aa
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/entry/src/main/ets/pages/ComputeTaskAsync.ets
arkts
computeTaskAsync
Asynchronous processing of computing tasks
private computeTaskAsync(): void { setTimeout(() => { // SetTimeout is used here to achieve asynchronous delayed operation. this.computeTask(); }, DELAYED_TIME); }
AST#method_declaration#Left private computeTaskAsync 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 setTimeout ( AST#expression#Left AST#ar...
private computeTaskAsync(): void { setTimeout(() => { this.computeTask(); }, DELAYED_TIME); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/entry/src/main/ets/pages/ComputeTaskAsync.ets#L51-L55
8c03999a7dbf47f02ba785f9176fec04a8494ecc
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets
arkts
drawValue
Draws the value of the given entry by using the provided IValueFormatter. @param c canvas @param formatter formatter for custom value-formatting @param value the value to be drawn @param entry the entry the value belongs to @param dataSetIndex the index of the DataSet the drawn Entry belong...
public drawValue( formatter: IValueFormatter, value: number, entry: EntryOhos, dataSetIndex: number, x: number, y: number, color: number ): Paint[] { this.mValuePaint.setColor(color); let textPaint = new TextPaint(); textPaint.set(this.mValuePaint); textPaint.setText(format...
AST#method_declaration#Left public drawValue AST#parameter_list#Left ( AST#parameter#Left formatter : AST#type_annotation#Left AST#primary_type#Left IValueFormatter AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST...
public drawValue( formatter: IValueFormatter, value: number, entry: EntryOhos, dataSetIndex: number, x: number, y: number, color: number ): Paint[] { this.mValuePaint.setColor(color); let textPaint = new TextPaint(); textPaint.set(this.mValuePaint); textPaint.setText(format...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/DataRenderer.ets#L162-L178
f15897a9cbc2fe8f3c8e13bf1b4e0356ad3c6c77
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets
arkts
足迹数据模型
export interface Footprint { id: number; goodsId: number; goodsMainPic: string; viewTime: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Footprint AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left goodsId : AST#type_annotation#Left AS...
export interface Footprint { id: number; goodsId: number; goodsMainPic: string; viewTime: string; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/models/CommonModels.ets#L111-L116
9b3e36ac2ca8c9e801579f6481fc0bd104d0775c
github