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
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/Viewmodel/HomeViewModel.ets
arkts
getCustomDateList
获取账单的日期信息
public getCustomDateList(): number[] { // 先清空 customDateList 数组,以便重新填充 this.customDateList = []; // 遍历 customAccountingList this.customAccountingList.forEach((accountingInfo: AccountingInfo) => { // 提取账单的日期 const date = new Date(accountingInfo.date); // 将日期的时间戳添加到 customDateList ...
AST#method_declaration#Left public getCustomDateList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 先清空 customDateList 数组,以便重新填充...
public getCustomDateList(): number[] { this.customDateList = []; this.customAccountingList.forEach((accountingInfo: AccountingInfo) => { const date = new Date(accountingInfo.date); this.customDateList.push(date.getTime()); }); this.customDateList = Array.from(n...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L483-L499
3c3c9ace316c9f9acd9b034d269972642ff98b8a
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/SysUtil.ets
arkts
isLargeScreen
是否是大屏,大于手机屏幕宽度500vp
static isLargeScreen(): boolean { return SysUtil.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 SysUtil.getDisplayWidth() > 500; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L116-L118
d0cb252dedd73afa83182bd2387d500b8041fd28
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
init
common.UIAbilityContext,上下文 初始化方法,缓存全局变量,在UIAbility的onCreate方法中初始化该方法。 @param windowStage 窗口管理器
static init(context: common.UIAbilityContext) { AppUtil.context = context; }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#bui...
static init(context: common.UIAbilityContext) { AppUtil.context = context; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L50-L52
1181ac7b1d2bca29d633e00b42ae46f8eafaafbc
gitee
openharmony-tpc/lottieArkTS
82cac19eaeb236c38fc72466a268c1d0d8a481ce
sharedLibrary/src/main/ets/utils/Calc.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export function add(a:number, b:number) { return a + b; }
AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef...
export function add(a:number, b:number) { return a + b; }
https://github.com/openharmony-tpc/lottieArkTS/blob/82cac19eaeb236c38fc72466a268c1d0d8a481ce/sharedLibrary/src/main/ets/utils/Calc.ets#L15-L17
3db5618976282bc4db8071810d5cfb96f6c18f44
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/GlobalThemeState.ets
arkts
getThemeVersion
获取当前主题版本(用于触发状态更新)
getThemeVersion(): number { return this.themeVersion; }
AST#method_declaration#Left getThemeVersion AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressi...
getThemeVersion(): number { return this.themeVersion; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/GlobalThemeState.ets#L40-L42
d7cb500742f569bb3ca087c7cae61bca7a8862e9
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets
arkts
start
开始函数
start(filePath:string, cb:(result:speechRecognizer.SpeechRecognitionResult)=>void){ this.createByCallback() setTimeout(()=>{ this.setListener(cb) this.startListening() this.writeAudio(filePath) },1000) }
AST#method_declaration#Left start AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left cb : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#par...
start(filePath:string, cb:(result:speechRecognizer.SpeechRecognitionResult)=>void){ this.createByCallback() setTimeout(()=>{ this.setListener(cb) this.startListening() this.writeAudio(filePath) },1000) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/pages/chat/VoiceManage/SpeechManager.ets#L121-L128
4efd49265f11e5c0749e593c6a2fb7ed6488dfa7
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
entry/src/main/ets/entryability/EntryAbility.ets
arkts
入口Ability 负责初始化应用、设置路由、处理生命周期事件 @author Joker.X
export default class EntryAbility extends UIAbility { /** * 应用创建时调用 * 初始化应用上下文、设置颜色模式、注册路由 * @param {Want} want - 启动意图 * @param {AbilityConstant.LaunchParam} launchParam - 启动参数 * @returns {void} 无返回值 */ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.con...
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 { /** * 应用创建时调用 * 初始化应用上下文、设置颜色模式、注册路由 * @param {Want} want - 启动意图 * @param {AbilityC...
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); this.registerRouter(); ContextUtil.init(this.context) }...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/entryability/EntryAbility.ets#L19-L100
8f2e0221410b6dbc8f0fd44d05888dddc1cf3f56
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/graphic/DisplaySync/entry/src/main/ets/DispalySync/CustomDrawDisplaySync.ets
arkts
CreateDisplaySyncFast
[End display_sync_frame_rate_setting_and_subscription_function_registration]
CreateDisplaySyncFast() { let range: ExpectedFrameRateRange = { expected: 60, min: 0, max: 120 }; let draw60 = (intervalInfo: displaySync.IntervalInfo) => { if (this.isBigger_60) { this.drawSecondSize += 1; if (this.drawSecondSize > 150) { this.isBigger_60 ...
AST#method_declaration#Left CreateDisplaySyncFast AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left range : AST#type_annotation#Left AST#primary_type#Left ExpectedFrameRateRange AST#primary_type#Right AST#typ...
CreateDisplaySyncFast() { let range: ExpectedFrameRateRange = { expected: 60, min: 0, max: 120 }; let draw60 = (intervalInfo: displaySync.IntervalInfo) => { if (this.isBigger_60) { this.drawSecondSize += 1; if (this.drawSecondSize > 150) { this.isBigger_60 ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/graphic/DisplaySync/entry/src/main/ets/DispalySync/CustomDrawDisplaySync.ets#L77-L101
098dfc10729d1bc466e731d1da48713992777217
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/view/DateSelectComponent.ets
arkts
DateSelectComponent
定义日期选择组件
@Component export default struct DateSelectComponent { @Link endDate: number; @Link beginDate: number; @State selectedIndex: number = 0; private dateSelectDialog: CustomDialogController = new CustomDialogController({ builder: DateSelectDialog({ beginDate: this.beginDate, endDate: this.endDate, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DateSelectComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right endDate : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ...
@Component export default struct DateSelectComponent { @Link endDate: number; @Link beginDate: number; @State selectedIndex: number = 0; private dateSelectDialog: CustomDialogController = new CustomDialogController({ builder: DateSelectDialog({ beginDate: this.beginDate, endDate: this.endDate, ...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/view/DateSelectComponent.ets#L101-L156
55ceaad8c70bf5572f9183049c88d33aa5c8f974
github
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/data/MomentData.ets
arkts
朋友圈页面动态数据条目结构 动态的类型 主要有:文字/链接/图片/视频
export enum momentType { //文字 Text , //链接 Link , //图片 Pic , //视频 Video }
AST#export_declaration#Left export AST#enum_declaration#Left enum momentType AST#enum_body#Left { //文字 AST#enum_member#Left Text AST#enum_member#Right , //链接 AST#enum_member#Left Link AST#enum_member#Right , //图片 AST#enum_member#Left Pic AST#enum_member#Right , //视频 AST#enum_member#Left Video AST#enum_member#Right } AS...
export enum momentType { Text , Link , Pic , Video }
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/data/MomentData.ets#L9-L18
2f5705b3b8364674252992d65d7a5f230fed69f3
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
network/WebSocket/entry/src/main/ets/common/SendMessage.ets
arkts
SendMessage
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export default struct SendMessage { @Link message: string private sendMessage: () => void = () => { } build() { Row() { TextArea({ placeholder: this.message, text: this.message }) .height(50) .fontSize(25) .layoutWeight(3) .backgroundColor(Color.White) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct SendMessage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type...
@Component export default struct SendMessage { @Link message: string private sendMessage: () => void = () => { } build() { Row() { TextArea({ placeholder: this.message, text: this.message }) .height(50) .fontSize(25) .layoutWeight(3) .backgroundColor(Color.White) ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/network/WebSocket/entry/src/main/ets/common/SendMessage.ets#L16-L53
433882245ac2cc65808b8c885d0baed882e52202
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/casesfeature/customtabbar/src/main/ets/util/CustomTabBar.ets
arkts
CustomTabBar
功能描述: 1. 将Image组件外层包裹一层容器组件,通过设置borderRadius以及margin的top值实现圆弧外轮廓效果 2. 通过当前被选中的tabBar下标值和tabBar自己的下标值进行判断来达到点击之后改变图标显示的效果 实现原理: 场景1:TabBar中间页面如何实现有一圈圆弧外轮廓 可以将Image外层包括一层容器组件,通过设置borderRadius以及margin的top值实现圆弧外轮廓效果。 这里borderRadius的值设置为容器组件宽度的一半,margin的top值根据开发者的ux效果设置合适的值即可。 场景2:TabBar页签点击之后会改变图标显示,并有一小段动画效果 改变图标显示可以声明一个...
@Component export struct CustomTabBar { // ----------------对外暴露变量---------------- // 配置起始的页签索引(必传) @Link selectedIndex: number; // tabBar数据 tabsInfo: TabBarInfo[] = []; // ------------------私有属性----------------- // 初始化tabBar图片的偏移量 @State iconOffset: number = 0; @StorageLink('avoidAreaBottomToModule') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomTabBar AST#component_body#Left { // ----------------对外暴露变量---------------- // 配置起始的页签索引(必传) AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right selectedIndex : AST#type_annotation#Left AS...
@Component export struct CustomTabBar { @Link selectedIndex: number; tabsInfo: TabBarInfo[] = []; @State iconOffset: number = 0; @StorageLink('avoidAreaBottomToModule') avoidAreaBottomToModule: number = 0; build() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceAround...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/casesfeature/customtabbar/src/main/ets/util/CustomTabBar.ets#L41-L159
106968973d0e2e3d5f1f96488c15937b537af8ca
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/lite_chart/src/main/ets/components/base/Utils.ets
arkts
角度转弧度 @param degrees 角度 @returns 弧度
export function degreesToRadians(degrees: number) { let radians = degrees / 180 * Math.PI return radians; }
AST#export_declaration#Left export AST#function_declaration#Left function degreesToRadians AST#parameter_list#Left ( AST#parameter#Left degrees : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left...
export function degreesToRadians(degrees: number) { let radians = degrees / 180 * Math.PI return radians; }
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/lite_chart/src/main/ets/components/base/Utils.ets#L17-L20
c00d4de9a595d77549f6be6aa0fa8c3ecbc8285b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets
arkts
CustomCalendar
自定义日历组件CustomCalendar(年视图,月视图,周视图) 功能描述: 1.提供可左右滑动切换年、月、周的年视图,月视图,周视图。 2.月视图和周视图支持点击日期监听onDateClick,年视图支持点击月份监听onMonthClick,提供左右滑动切换年月监听onChangeYearMonth。 3.月视图支持点击非当前月日期切换月份。 4.月视图和周视图支持自定义设置公历、农历、星期、年月信息标题文字缩放比例,今天选中日期的背景色,本月公历日期颜色,本月农历字体颜色。月视图支持 设置非本月公历日期颜色。 实现思路 1.根据自定义日历类型CalendarViewType,分别显示对应年(YearView)、月(Mon...
@Component export struct CustomCalendar { // 自定义日历类型 @Prop calendarViewType: CalendarViewType = CalendarViewType.MONTH; // 自定义日历样式 calendarStyle: CalendarStyle = {}; // 年、月、周视图切换场景的相关设置 calendarSwitch: CalendarSwitch = { isYearMonthHidden: false }; // 年视图月份点击回调。返回年视图点击的年月信息。仅用于年视图。 onMonthClick: (year: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomCalendar AST#component_body#Left { // 自定义日历类型 AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right calendarViewType : AST#type_annotation#Left AST#primary_type#Left CalendarViewType AST#pr...
@Component export struct CustomCalendar { @Prop calendarViewType: CalendarViewType = CalendarViewType.MONTH; calendarStyle: CalendarStyle = {}; calendarSwitch: CalendarSwitch = { isYearMonthHidden: false }; onMonthClick: (year: number, month: number) => void = () => { }; onDateClick: (year: n...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/CustomCalendar.ets#L81-L221
048c34ea68a701d21b2aa9df288e3e092c2a9acf
gitee
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/downsampling/DownsampleUtils.ets
arkts
找出给定整数 i 中最高位的1(即最左边的1)所代表的值
export function highestOneBit(i: number): number { i |= (i >> 1); i |= (i >> 2); i |= (i >> 4); i |= (i >> 8); i |= (i >> 16); return i - (i >>> 1); }
AST#export_declaration#Left export AST#function_declaration#Left function highestOneBit AST#parameter_list#Left ( AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#pr...
export function highestOneBit(i: number): number { i |= (i >> 1); i |= (i >> 2); i |= (i >> 4); i |= (i >> 8); i |= (i >> 16); return i - (i >>> 1); }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/downsampling/DownsampleUtils.ets#L32-L39
561fbc5d411d3e94ee6377d8bac550ffe2ebdc4e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Preferences/entry/src/main/ets/viewmodel/ButtonItemData.ets
arkts
Button item data. @param resource Button item resource. @param clickMethod Button item clickMethod.
export default class ButtonItemData { /** * Button item resource. */ resource: Resource; /** * Button item clickMethod. */ clickMethod: () => void; /** * The constructor of ButtonItemData. * * @param resource Button item resource. * @param clickMethod Button item clickMethod. */ ...
AST#export_declaration#Left export default AST#class_declaration#Left class ButtonItemData AST#class_body#Left { /** * Button item resource. */ AST#property_declaration#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declarati...
export default class ButtonItemData { resource: Resource; clickMethod: () => void; constructor(resource: Resource, clickMethod: () => void) { this.resource = resource; this.clickMethod = clickMethod; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Preferences/entry/src/main/ets/viewmodel/ButtonItemData.ets#L22-L44
fe1945b7a8070f61b79a8be11e5cf533eccf2f19
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets
arkts
listBuilder
评论区内容
@Builder listBuilder() { List({ scroller: this.listScroller }) { LazyForEach(this.commentList, (item: NewsCommentModel) => { ListItem() { CommentPage({ commonData: item, replyId: $replyId, replyUser: $replyUser, curUser: this.curUser, ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right listBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( AST#component_parameters#Left { AST#component_parameter...
@Builder listBuilder() { List({ scroller: this.listScroller }) { LazyForEach(this.commentList, (item: NewsCommentModel) => { ListItem() { CommentPage({ commonData: item, replyId: $replyId, replyUser: $replyUser, curUser: this.curUser, ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L269-L292
5e954083455480d1291309cc010a600cdaa0aef7
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Alarm/PermissionManager.ets
arkts
requestPermissions
请求权限授权(首次申请) @param context UIAbility上下文(类似SwiftUI的ViewContext) @param permissions 权限列表 @param rationale 权限说明文案(可选) @returns Promise对象,解析为是否全部授权
static async requestPermissions( context: common.UIAbilityContext, permissions: Permissions[], rationale?: string | Resource ): Promise<boolean> { ///检查是是否已经有授权? const allGranted = await Promise.all( permissions.map(permission => PermissionManager.checkPermission(permission)) ); if...
AST#method_declaration#Left static async requestPermissions AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramete...
static async requestPermissions( context: common.UIAbilityContext, permissions: Permissions[], rationale?: string | Resource ): Promise<boolean> { const allGranted = await Promise.all( permissions.map(permission => PermissionManager.checkPermission(permission)) ); if (allGranted.e...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/PermissionManager.ets#L94-L129
605325565f0e4b926161a9e1a466db6a7a90793e
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
get
MARK: - Ref Get Functions / 获取(未删除)状态的wordIds
get wordIds(): number[] { return this.pieces.flatMap((p) => p.wordIds ?? []); }
AST#method_declaration#Left get AST#ERROR#Left wordIds AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left ...
get wordIds(): number[] { return this.pieces.flatMap((p) => p.wordIds ?? []); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L221-L223
14ad68bca92eba559004d13ba46352f32ac710c5
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_projects/arkoala/har/app/arkoala/BuildProfile.ets
arkts
BuildProfile Class is used only for compatibility purposes.
export default class BuildProfile { static readonly HAR_VERSION = HAR_VERSION; static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; static readonly DEBUG = DEBUG; static readonly TARGET_NAME = TARGET_NAME; }
AST#export_declaration#Left export default AST#class_declaration#Left class BuildProfile AST#class_body#Left { AST#property_declaration#Left static readonly HAR_VERSION = AST#expression#Left HAR_VERSION AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUILD_MODE_NAME =...
export default class BuildProfile { static readonly HAR_VERSION = HAR_VERSION; static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; static readonly DEBUG = DEBUG; static readonly TARGET_NAME = TARGET_NAME; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_projects/arkoala/har/app/arkoala/BuildProfile.ets#L12-L17
5a8dd0fa5d4677c174227cc11350f8445508fd11
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
checkInitialization
==================== 私有方法 ==================== 检查数据库是否已初始化
private checkInitialization(): void { if (!this.isInitialized) { throw new Error('Database service not initialized. Call initializeDatabase() first.'); } }
AST#method_declaration#Left private checkInitialization AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expr...
private checkInitialization(): void { if (!this.isInitialized) { throw new Error('Database service not initialized. Call initializeDatabase() first.'); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L327-L331
e14656a9be210e422eb0db35161273c5846bb735
github
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/pages/TenantManagerPage.ets
arkts
onDeleteTenantUser
@author: wuwenqiang @description: 关闭弹窗 @date: 2025-09-20 13:21
onDeleteTenantUser(){ deleteTenantUserService(this.tenantUserList[this.deleteIndex].tenantId,this.tenantUserList[this.deleteIndex].userId!).then((res)=>{ promptAction.showToast({ message: `删除租户${res.data ? '成功' : '失败'}`, duration: 2000, bottom: px2vp(display.getDefaultDisplaySync().hei...
AST#method_declaration#Left onDeleteTenantUser AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left deleteTenantUserService ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscri...
onDeleteTenantUser(){ deleteTenantUserService(this.tenantUserList[this.deleteIndex].tenantId,this.tenantUserList[this.deleteIndex].userId!).then((res)=>{ promptAction.showToast({ message: `删除租户${res.data ? '成功' : '失败'}`, duration: 2000, bottom: px2vp(display.getDefaultDisplaySync().hei...
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/pages/TenantManagerPage.ets#L88-L100
f7eaad62cb975d4177e922d354e2077f3fe18f50
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getDeletedWords
获取已删除的单词
getDeletedWords(): WordUser[] { return this.allWords.filter(word => word.deleted); }
AST#method_declaration#Left getDeletedWords AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left...
getDeletedWords(): WordUser[] { return this.allWords.filter(word => word.deleted); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L356-L358
90f584e0a85f51ca42cb37725451f0ee80e4f172
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/iab/SubscribeManager.ets
arkts
calculateCurrentSubscriptionActive
内部计算订阅是否有效
private calculateCurrentSubscriptionActive(): boolean { if (!this.expiresDateMs) return false; const nowMs = new Date().getTime(); return this.expiresDateMs > nowMs; }
AST#method_declaration#Left private calculateCurrentSubscriptionActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Le...
private calculateCurrentSubscriptionActive(): boolean { if (!this.expiresDateMs) return false; const nowMs = new Date().getTime(); return this.expiresDateMs > nowMs; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L48-L52
ef32d09d166d133c9bfef3715925dbf1a2d364c7
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/QuizManager.ets
arkts
使用常量枚举 (Const Enum) - 推荐用于性能
export enum QuestionSpeed { Slow = 10, // 单位:秒 Normal = 8, Fast = 5 }
AST#export_declaration#Left export AST#enum_declaration#Left enum QuestionSpeed AST#enum_body#Left { AST#enum_member#Left Slow = AST#expression#Left 10 AST#expression#Right AST#enum_member#Right , // 单位:秒 AST#enum_member#Left Normal = AST#expression#Left 8 AST#expression#Right AST#enum_member#Right , AST#enum_member#Le...
export enum QuestionSpeed { Slow = 10, Normal = 8, Fast = 5 }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/QuizManager.ets#L24-L28
afc0fd9445e090cf2808f330e92f5c286221218c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_asynchronous.ets
arkts
decryptMessagePromise
解密消息
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('AES128|CCM'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, ccmParams); let decryptUpdate = await decoder.doFinal(cipherText); return dec...
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left symKey : 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#parameter#Right , AST#par...
async function decryptMessagePromise(symKey: cryptoFramework.SymKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('AES128|CCM'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, symKey, ccmParams); let decryptUpdate = await decoder.doFinal(cipherText); return dec...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_ccm_encryption_decryption/aes_ccm_encryption_decryption_asynchronous.ets#L52-L57
1d5f4f0534a3b986049c5718b69227dba6b797fe
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets
arkts
TabNode
自定义组件复用池Swiper页面
@Component export struct TabNode { minSize: number = 80; maxSize: number = 180; fontSize: number = 24; @State index: number = 0; scroller: Scroller = new Scroller(); dataSource: WaterFlowDataSource = new WaterFlowDataSource(); // FlowItem组件高度列表 private itemHeightArray: number[] = []; // FlowItem组件宽度列表...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabNode AST#component_body#Left { AST#property_declaration#Left minSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 80 AST#expression#...
@Component export struct TabNode { minSize: number = 80; maxSize: number = 180; fontSize: number = 24; @State index: number = 0; scroller: Scroller = new Scroller(); dataSource: WaterFlowDataSource = new WaterFlowDataSource(); private itemHeightArray: number[] = []; private itemWidthArray: number[...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuild/customreusablepool/src/main/ets/view/TabNode.ets#L30-L55
6e44896c9619ca2f9842963cb80e7b12795afee7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
arkts
comprehensiveFeatures
[End obtain_enrolled_capabilities]
comprehensiveFeatures() { let reuseUnlockResult: userAuth.ReuseUnlockResult = { reuseMode: userAuth.ReuseMode.AUTH_TYPE_RELEVANT, reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION, }; try { const rand = cryptoFramework.createRandom(); const len: number = 16; const randData: ...
AST#method_declaration#Left comprehensiveFeatures AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left reuseUnlockResult : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . ReuseU...
comprehensiveFeatures() { let reuseUnlockResult: userAuth.ReuseUnlockResult = { reuseMode: userAuth.ReuseMode.AUTH_TYPE_RELEVANT, reuseDuration: userAuth.MAX_ALLOWABLE_REUSE_DURATION, }; try { const rand = cryptoFramework.createRandom(); const len: number = 16; const randData: ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L496-L525
e06a61a3c05d09587d733ce78a336a9dd1c1ef7b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/storage/PreferencesService.ets
arkts
getKeys
获取所有键 @returns 键数组
async getKeys(): Promise<string[]> { try { this.checkInitialized(); // Note: HarmonyOS preferences API may not have getKeys method // This is a placeholder implementation // You may need to track keys separately or use alternative approach return []; } catch (error) { const b...
AST#method_declaration#Left async getKeys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Righ...
async getKeys(): Promise<string[]> { try { this.checkInitialized(); return []; } catch (error) { const businessError = error as BusinessError; hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to get keys: ${businessError.message}`); return [];...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L282-L294
e0b1f6d00a8ce371054f24fe517afa56b88a87d0
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/components/widget/ColorPickerComponent.ets
arkts
ColorPickerComponent
颜色选择组件,用于文本框或者画笔功能选择画笔颜色
@ComponentV2 export struct ColorPickerComponent { /** * 选中的画笔颜色 */ @Local selectedColor: string = ''; @Local hexHues: string[] = HEX_HUES_DATA; @Param @Require onPicked: (color: string, rgbColor: RgbColor) => void; aboutToAppear(): void { // 设置默认选中色 this.selectedColor = HEX_HUES_DATA[4]; th...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ColorPickerComponent AST#component_body#Left { /** * 选中的画笔颜色 */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right selectedColor : AST#type_annotation#Left AST#primary_type#Left strin...
@ComponentV2 export struct ColorPickerComponent { @Local selectedColor: string = ''; @Local hexHues: string[] = HEX_HUES_DATA; @Param @Require onPicked: (color: string, rgbColor: RgbColor) => void; aboutToAppear(): void { this.selectedColor = HEX_HUES_DATA[4]; this.onPicked?.(this.selectedColor...
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/components/widget/ColorPickerComponent.ets#L61-L111
d324dfb29faf8eefa94314353b1566f928ff2f9a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
sumDecimal
求和Decimal @param x @param y @returns
static sumDecimal(...n: Value[]): Decimal { return Decimal.sum(...n); }
AST#method_declaration#Left static sumDecimal AST#parameter_list#Left ( AST#parameter#Left ... n : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Value [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ...
static sumDecimal(...n: Value[]): Decimal { return Decimal.sum(...n); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L239-L241
edc4297f3d5cf43f12f3693c4eb9560b9e7f95c4
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/CartService.ets
arkts
clearCart
清空购物车
async clearCart(): Promise<void> { this.cartItems = []; await this.saveCart(); }
AST#method_declaration#Left async clearCart AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argume...
async clearCart(): Promise<void> { this.cartItems = []; await this.saveCart(); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/CartService.ets#L126-L129
1eb40bdf1e95c8e7d7452974b267a30951dd2611
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVPlayer/entry/src/main/ets/model/BasicDataSource.ets
arkts
Basic implementation of data listening with IDataSource.
export abstract class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; // Get the length of the array. public abstract totalCount(): number; // Retrieve data at the specified index. public getData(index: number): void { } // Add a listener to the data source for th...
AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChange...
export abstract class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; public abstract totalCount(): number; public getData(index: number): void { } registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVPlayer/entry/src/main/ets/model/BasicDataSource.ets#L19-L72
1637de5fbbda9779dc50995877f22036a7a61da0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
生成迭代接口
export interface GenerationIteration { id: string; prompt: string; response: string; rating?: number; feedback?: string; regenerationReason?: string; createdAt: string; tokensUsed: number; responseTime: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GenerationIteration 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 prompt : AST#type_annotatio...
export interface GenerationIteration { id: string; prompt: string; response: string; rating?: number; feedback?: string; regenerationReason?: string; createdAt: string; tokensUsed: number; responseTime: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L697-L707
efa22e2a966135ed4c5fe4c6c7d891bbd8665dbd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets
arkts
changeColor
根据不同进度设置不同颜色
changeColor() { if (this.progressNum === Constants.FULL_PROGRESS) { // 进度为100时,封闭曲线不生效,此时将内心圆背景色设为COLOR_HEALTHY this.bgColor = Constants.COLOR_HEALTHY; } else { // 其他进度则将内心圆背景色设为透明色,防止影响进度填充色 this.bgColor = Constants.COLOR_TRANSPARENT; } if (this.progressNum >= Constants.HEALTHY...
AST#method_declaration#Left changeColor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Lef...
changeColor() { if (this.progressNum === Constants.FULL_PROGRESS) { this.bgColor = Constants.COLOR_HEALTHY; } else { this.bgColor = Constants.COLOR_TRANSPARENT; } if (this.progressNum >= Constants.HEALTHY_PROGRESS) { this.colorBackgroundFill = Constants.COLOR_HEAL...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/paintcomponent/src/main/ets/view/PaintComponent.ets#L132-L151
f733d5c81aadacadb803d918b145f588fcec6a0f
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleBackupManager.ets
arkts
createBackup
创建备份
async createBackup(name: string): Promise<SimpleBackupResult> { if (this.currentStatus !== BackupStatus.IDLE) { return { success: false, message: 'Backup operation already in progress', timestamp: Date.now() }; } this.currentStatus = BackupStatus.BACKING_UP; try { ...
AST#method_declaration#Left async createBackup AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
async createBackup(name: string): Promise<SimpleBackupResult> { if (this.currentStatus !== BackupStatus.IDLE) { return { success: false, message: 'Backup operation already in progress', timestamp: Date.now() }; } this.currentStatus = BackupStatus.BACKING_UP; try { ...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleBackupManager.ets#L39-L86
f408d7497ec20e225c4a0c96c8d3a041fba1d073
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DateUtils.ets
arkts
getBeforeDay
获取前一天日期
static getBeforeDay(date: number | string | Date): Date { return DateUtils.getAmountDay(date, -1); }
AST#method_declaration#Left static getBeforeDay AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri...
static getBeforeDay(date: number | string | Date): Date { return DateUtils.getAmountDay(date, -1); }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L277-L279
0508f21363ae3d8912d94eb9d9e92d7e9d84c78c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets
arkts
V2版本升级数据处理业务层
export class V2DataService extends BaseDataService { /** * V2新老版本字段转换逻辑 * @param resultSet 查询结果集 * @param targetVersion 目标版本 * @returns 目标版本格式数据 */ transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { if (targetVersion === Constants.V3) { // 将teacherName字段改...
AST#export_declaration#Left export AST#class_declaration#Left class V2DataService extends AST#type_annotation#Left AST#primary_type#Left BaseDataService AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * V2新老版本字段转换逻辑 * @param resultSet 查询结果集 * @param targetVersion 目标版本 * @returns 目...
export class V2DataService extends BaseDataService { transform(resultSet: relationalStore.ResultSet, targetVersion: number): ValuesBucket { if (targetVersion === Constants.V3) { return this.transformV2ToV3(resultSet); } else { throw new Error('The database version to which you need to up...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/service/DataService.ets#L130-L154
adb6a9b5093dc4848e1ca95074787e5ce9d82979
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets
arkts
clearJSSdkHistoryBundle
保留3个版本
async clearJSSdkHistoryBundle(bundleLoadInfo: DMPBundleLoadInfo) { let jsSdkRootPath = this.getJSSdkDir(); await DMPVersionUtil.clearHistory(bundleLoadInfo.cacheJSSdkBundleConfig?.versionCode.toString() ?? '', jsSdkRootPath); }
AST#method_declaration#Left async clearJSSdkHistoryBundle AST#parameter_list#Left ( AST#parameter#Left bundleLoadInfo : AST#type_annotation#Left AST#primary_type#Left DMPBundleLoadInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statemen...
async clearJSSdkHistoryBundle(bundleLoadInfo: DMPBundleLoadInfo) { let jsSdkRootPath = this.getJSSdkDir(); await DMPVersionUtil.clearHistory(bundleLoadInfo.cacheJSSdkBundleConfig?.versionCode.toString() ?? '', jsSdkRootPath); }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets#L157-L160
079b11d48567f2c664d0e51c31d54cc2bc1d72b6
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/result/src/main/ets/RequestHelper.ets
arkts
@file 网络请求结果处理 @description 提供网络请求结果处理的助手类,自动处理异常以及简化相关代码。 @param T 网络请求返回数据项类型 @author Joker.X
export class RequestHelper<T> { /** * 原始请求 Promise,类型为 NetworkResponse<T> */ private source: Promise<NetworkResponse<T>>; /** * 是否为本次请求显示 loading,默认 false */ private useLoading: boolean = false; /** * 是否为本次请求自动 toast 错误,默认 true */ private useToast: boolean = true; /** * 请求开始前的回调(如埋点、重...
AST#export_declaration#Left export AST#class_declaration#Left class RequestHelper AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { /** * 原始请求 Promise,类型为 NetworkResponse<T> */ AST#property_declaration#Left private source : AST#type_ann...
export class RequestHelper<T> { private source: Promise<NetworkResponse<T>>; private useLoading: boolean = false; private useToast: boolean = true; private beforeStart?: () => void; private constructor(promise: Promise<NetworkResponse<T>>) { this.source = promise; } static reposito...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L10-L142
c603ca0fb3fc469022db56f3f332405a610519a8
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
复制文件到沙箱缓存目录
export function copy2SandboxCacheDir(context: Context, srcUri: string, fileName: string): string { //计划复制到的目标路径 let realUri = context.cacheDir + "/" + fileName let file = fs.openSync(srcUri); fs.copyFileSync(file.fd, realUri) fs.closeSync(file) return realUri }
AST#export_declaration#Left export AST#function_declaration#Left function copy2SandboxCacheDir AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left srcUri : AST#type_annotat...
export function copy2SandboxCacheDir(context: Context, srcUri: string, fileName: string): string { let realUri = context.cacheDir + "/" + fileName let file = fs.openSync(srcUri); fs.copyFileSync(file.fd, realUri) fs.closeSync(file) return realUri }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L51-L58
72ab4cc0400adce08214be2b059d26458c425a71
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPStack.ets
arkts
pop
从栈顶移除元素并返回
pop(): T | undefined { return this._items.pop(); }
AST#method_declaration#Left pop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left T AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statem...
pop(): T | undefined { return this._items.pop(); }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPStack.ets#L14-L16
7702ea1197b7f0ac027d5c8d61144b05a531ddc2
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/model/ImageKnifeData.ets
arkts
加载的错误信息
export interface ErrorInfo { phase: string, //图片加载阶段信息,如:网络加载阶段,缓存获取阶段及其解码阶段等 code: number, }
AST#export_declaration#Left export AST#interface_declaration#Left interface ErrorInfo AST#object_type#Left { AST#type_member#Left phase : 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 ...
export interface ErrorInfo { phase: string, code: number, }
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/model/ImageKnifeData.ets#L49-L52
204fb9555a578d0cef6503b86241d5fdb0f1d9ab
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navigationparametertransfer/src/main/ets/components/UserBookingInfo.ets
arkts
定义一个用户类
export class UserBookingInfo { userName: string = '张山'; // 姓名 userID: string = '332045199008120045'; // 证件号 date: string = '1月1日' // 日期 seatNo: number = 0; // 座位号 price: number = 200; // 价格 constructor(name: string, id: string, date: string) { this.userName = name; this.userID = id; this.date = ...
AST#export_declaration#Left export AST#class_declaration#Left class UserBookingInfo AST#class_body#Left { AST#property_declaration#Left userName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '张山' AST#expression#Right ; AST#property_declara...
export class UserBookingInfo { userName: string = '张山'; userID: string = '332045199008120045'; date: string = '1月1日' seatNo: number = 0; price: number = 200; constructor(name: string, id: string, date: string) { this.userName = name; this.userID = id; this.date = date; } generateRan...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationparametertransfer/src/main/ets/components/UserBookingInfo.ets#L17-L34
58c7b8b35e5daa60eca1f07bf9cbdcae1127f6c4
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/TrendsDataSource.ets
arkts
indexOf
查找列表中对象的index
public indexOf(data: Trends): number { Logger.info(TAG, `indexOf data , id = ${data.user.userId} , name = ${data.user.userName}`); return this.trendsList.indexOf(data); }
AST#method_declaration#Left public indexOf AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Trends AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri...
public indexOf(data: Trends): number { Logger.info(TAG, `indexOf data , id = ${data.user.userId} , name = ${data.user.userName}`); return this.trendsList.indexOf(data); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/TrendsDataSource.ets#L53-L56
6401aeb182c65cebabdf65ee5a59a6904c395558
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
arkts
clearReviewList
====== 清空复习列表 ======
async clearReviewList(): Promise<void> { if (!this.db) return; const sql = `UPDATE ${Tables.Learn.NAME} SET ${Tables.Learn.Col.LAST_RESULT} = ?`; await this.db.updateDb(sql, [SearchConstants.TEST_RESULT_NONE]); }
AST#method_declaration#Left async clearReviewList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_...
async clearReviewList(): Promise<void> { if (!this.db) return; const sql = `UPDATE ${Tables.Learn.NAME} SET ${Tables.Learn.Col.LAST_RESULT} = ?`; await this.db.updateDb(sql, [SearchConstants.TEST_RESULT_NONE]); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L517-L522
9dab80ed319cab1837c350b19938787f300b5d37
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/rating/ratingStarStyle.ets
arkts
RatingStarStyleBuilder
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function RatingStarStyleBuilder(name: string, param: Object) { RatingStarStyleExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function RatingStarStyleBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Lef...
@Builder export function RatingStarStyleBuilder(name: string, param: Object) { RatingStarStyleExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/rating/ratingStarStyle.ets#L16-L19
f456dd52373b15da8b4e2544a7901f300eca8ab0
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSA.ets
arkts
encode2048PKCS1Segment
2048位加密-分段 @param encodeStr 待加密的字符串 @param pubKey 2048位RSA公钥
static async encode2048PKCS1Segment(str: string, pubKey: string): Promise<string> { return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048); }
AST#method_declaration#Left static async encode2048PKCS1Segment AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left strin...
static async encode2048PKCS1Segment(str: string, pubKey: string): Promise<string> { return CryptoUtil.encodeAsymSegment(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L78-L80
5666509b36d705e789042bd896c088185c6453b2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/XComponentVideo.ets
arkts
setOffCallback
注销回调函数接口
setOffCallback(): void { if (this && this.avPlayer) { this.avPlayer?.off('volumeChange'); this.avPlayer?.off('endOfStream'); this.avPlayer?.off('seekDone'); this.avPlayer?.off('durationUpdate'); this.avPlayer?.off('speedDone'); this.avPlayer?.off('bitrateDone'); this.avPlay...
AST#method_declaration#Left setOffCallback 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_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_ex...
setOffCallback(): void { if (this && this.avPlayer) { this.avPlayer?.off('volumeChange'); this.avPlayer?.off('endOfStream'); this.avPlayer?.off('seekDone'); this.avPlayer?.off('durationUpdate'); this.avPlayer?.off('speedDone'); this.avPlayer?.off('bitrateDone'); this.avPlay...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videoplaycomponents/XComponentVideo.ets#L106-L122
f540565f6769dc5887c17ff2dbf60f8e4ab82383
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
initializeService
初始化服务
private async initializeService(): Promise<void> { try { this.startNewSession(); await this.loadStoredEvents(); this.startPeriodicSave(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'AnalyticsService initialized'); } catch (error) { hilog.error(LogConstants.DOM...
AST#method_declaration#Left private async initializeService AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right >...
private async initializeService(): Promise<void> { try { this.startNewSession(); await this.loadStoredEvents(); this.startPeriodicSave(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'AnalyticsService initialized'); } catch (error) { hilog.error(LogConstants.DOM...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L298-L308
b0a46462ab0f519dd388dded6a1237846b397474
github
queyun123/weatherApp-ArkTS.git
6beee6640db32ae70c342866b24fc643a9c512bf
entry/src/main/ets/pages/Index.ets
arkts
searchCity
搜索城市(如果需要的话)
async searchCity(cityName: string) { try { const cities = await HttpUtil.searchCitiesByName(cityName); if (cities && cities.length > 0) { // 这里可以处理搜索结果,比如跳转到选择页面 console.log('搜索到城市:', cities); return cities; } } catch (error) { console.error('搜索城市失败:', JSON.string...
AST#method_declaration#Left async searchCity AST#parameter_list#Left ( AST#parameter#Left cityName : 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#try_statement#Left ...
async searchCity(cityName: string) { try { const cities = await HttpUtil.searchCitiesByName(cityName); if (cities && cities.length > 0) { console.log('搜索到城市:', cities); return cities; } } catch (error) { console.error('搜索城市失败:', JSON.stringify(error)); } ...
https://github.com/queyun123/weatherApp-ArkTS.git/blob/6beee6640db32ae70c342866b24fc643a9c512bf/entry/src/main/ets/pages/Index.ets#L131-L143
f94407049b01755a46c1c8ec4de96d99233d87ee
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
setLabelRotationAngle
sets the angle for drawing the X axis labels (in degrees) @param angle the angle in degrees
public setLabelRotationAngle(angle: number): void { this.mLabelRotationAngle = angle; }
AST#method_declaration#Left public setLabelRotationAngle AST#parameter_list#Left ( AST#parameter#Left angle : 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#pr...
public setLabelRotationAngle(angle: number): void { this.mLabelRotationAngle = angle; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L128-L130
40ab7edc52322d92fa374d22f15e92f1839e5e67
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/constants/BreakpointConstants.ets
arkts
Constants for breakpoint.
export class BreakpointConstants { /** * Breakpoints that represent small device types. */ public static readonly BREAKPOINT_SM: string = 'sm'; /** * Breakpoints that represent middle device types. */ public static readonly BREAKPOINT_MD: string = 'md'; /** * Breakpoints that represent large de...
AST#export_declaration#Left export AST#class_declaration#Left class BreakpointConstants AST#class_body#Left { /** * Breakpoints that represent small device types. */ AST#property_declaration#Left public static readonly BREAKPOINT_SM : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AS...
export class BreakpointConstants { public static readonly BREAKPOINT_SM: string = 'sm'; public static readonly BREAKPOINT_MD: string = 'md'; public static readonly BREAKPOINT_LG: string = 'lg'; public static readonly GRID_ROW_COLUMNS: number[] = [1, 2, 12]; public static readonly GRID_COLUMN_SP...
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/constants/BreakpointConstants.ets#L19-L40
0392eee767902af0eb546052147b85b4ae8a247a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
insertAccount
Insert account data. @param {Account} account Account entity. @param {DataRdb.RdbStore} rdbStore RDB database.
insertAccount(account: Account, rdbStore: DataRdb.RdbStore) { rdbStore.insert(CommonConstants.TABLE_ACCOUNT, account.toValuesBucket()).then((rowId) => { Logger.info(TAG, 'insertAccount successful ' + rowId); }).catch((error: BusinessError) => { Logger.error(TAG, 'insertAccount error ' + JSON.stringi...
AST#method_declaration#Left insertAccount AST#parameter_list#Left ( AST#parameter#Left account : AST#type_annotation#Left AST#primary_type#Left Account AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L...
insertAccount(account: Account, rdbStore: DataRdb.RdbStore) { rdbStore.insert(CommonConstants.TABLE_ACCOUNT, account.toValuesBucket()).then((rowId) => { Logger.info(TAG, 'insertAccount successful ' + rowId); }).catch((error: BusinessError) => { Logger.error(TAG, 'insertAccount error ' + JSON.stringi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets#L66-L72
35e3d942921f0cfaa028cf1dae241be36a8174fb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets
arkts
removeCriticalAssetSecond
[End remove_critical_asset]
async function removeCriticalAssetSecond(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); // 此处指定别名删除单条数据,也可不指定别名删除多条数据 try { await asset.remove(query).then(() => { con...
AST#function_declaration#Left async function removeCriticalAssetSecond AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annot...
async function removeCriticalAssetSecond(): Promise<string> { let result: string = ''; let attr: asset.AssetMap = new Map(); let query: asset.AssetMap = new Map(); query.set(asset.Tag.ALIAS, stringToArray('demo_alias2')); try { await asset.remove(query).then(() => { console.info(`Asset removed succ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/AssetStoreKit/AssetStoreArkTS/entry/src/main/ets/pages/Index.ets#L205-L224
3af56f6d41a50bdddff1388e198118f6323d69a0
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceNavigation.d.ets
arkts
the enum for the opacity of the background color. @enum { number }. @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export declare enum GradientAlpha { /** * when the GradientAlpha set OPACITY_20,the opacity of background colors is 0.2. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */ OPACITY_20 = 1, /** * when the GradientAlpha set OPACITY_60,the opacity of background colors i...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum GradientAlpha AST#enum_body#Left { /** * when the GradientAlpha set OPACITY_20,the opacity of background colors is 0.2. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 18 */...
export declare enum GradientAlpha { OPACITY_20 = 1, OPACITY_60 = 2, OPACITY_80 = 3, OPACITY_100 = 4, }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L67-L100
c09efa2da3a4c297950060b6de8e8f20d819ec52
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets
arkts
showToastMessage
1 -获取Preferences实例的方法 TODO 2-写入数据 TODO 3-读取数据 TODO 4-删除数据 TODO 5-删除Preferences实例及其持久化文件 TODO 信息提示
showToastMessage(message: Resource) { promptAction.showToast({ message: message, duration: CommonConstants.DURATION }); }
AST#method_declaration#Left showToastMessage AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#e...
showToastMessage(message: Resource) { promptAction.showToast({ message: message, duration: CommonConstants.DURATION }); }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkData/PreferencesDemo/entry/src/main/ets/model/PreferenceModel.ets#L26-L31
d0a509ffd89686881cbe1aa9d1edc48aeb4c4099
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/textInput/LoginRegisterPage.ets
arkts
LoginRegisterPage
[Start the_example_of_text_input]
@Entry @Component export struct LoginRegisterPage { build() { // [StartExclude the_example_of_text_input] NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.LoginRegisterPage_title') }) { // [EndExclude the_example_of_text_input] Column({ space: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct LoginRegisterPage AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { // [StartExclude the_example_of_text_input] AST#arkts_ui_element#Left AS...
@Entry @Component export struct LoginRegisterPage { build() { NavDestination() { Column({ space: 12 }) { ComponentCard({ title: $r('app.string.LoginRegisterPage_title') }) { Column({ space: 12 }) { TextInput({ placeholder: 'input your username' }) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/TextComponent/entry/src/main/ets/pages/textInput/LoginRegisterPage.ets#L20-L54
50e43c370c4079bf7e2cd5be03d94e2a9b84bb61
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/AddressDetailPage.ets
arkts
buildDefaultAddressSwitch
构建默认地址开关 @returns {void} 无返回值
@Builder private buildDefaultAddressSwitch(): void { IBestSwitch({ value: this.vm.isDefaultAddress, onChange: (value: boolean | IBestStringNumber): void => { this.vm.handleDefaultSwitchChange(value); } }); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildDefaultAddressSwitch 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_compon...
@Builder private buildDefaultAddressSwitch(): void { IBestSwitch({ value: this.vm.isDefaultAddress, onChange: (value: boolean | IBestStringNumber): void => { this.vm.handleDefaultSwitchChange(value); } }); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressDetailPage.ets#L202-L210
eae35e47eeb4b69c24894653cea864a60d56417a
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/utils/WantUtil.ets
arkts
toSetting
系统和更新-重置-还原网络设置-还原网络设置确认五级页面 跳转系统设置页面(配合WantUtil里的URI常量一起使用,可跳转更多的设置页面) @param uri: 传入WantUtil的URI常量,不传默认为设置页面 @returns
static async toSetting(uri?: string): Promise<void> { const context = AppUtil.getContext(); const want: Want = { bundleName: 'com.huawei.hmos.settings', //设置应用bundleName abilityName: 'com.huawei.hmos.settings.MainAbility', //设置应用abilityName uri: uri, //目标页面 parameters: { bundleNa...
AST#method_declaration#Left static async toSetting AST#parameter_list#Left ( AST#parameter#Left uri ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#...
static async toSetting(uri?: string): Promise<void> { const context = AppUtil.getContext(); const want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: uri, parameters: { bundleName: context.abilityInfo.bundleName, ...
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/utils/WantUtil.ets#L95-L106
68045c6968b5ed121f516fe3162c3c5a86fc8d4b
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
calcExtensionLine
y轴计算延长线
private calcExtensionLine(render: YAxisRenderer | null) { let extensionLength = 0; if (render) { if (this.mXAxis) { extensionLength = this.mXAxis.getYOffset() + this.mXAxis.mLabelRotatedHeight / 2 + Utils.getLabelTextSize(render.getPaintAxisLine(), '0', this.textSizeCache).height...
AST#method_declaration#Left private calcExtensionLine AST#parameter_list#Left ( AST#parameter#Left render : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left YAxisRenderer AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#param...
private calcExtensionLine(render: YAxisRenderer | null) { let extensionLength = 0; if (render) { if (this.mXAxis) { extensionLength = this.mXAxis.getYOffset() + this.mXAxis.mLabelRotatedHeight / 2 + Utils.getLabelTextSize(render.getPaintAxisLine(), '0', this.textSizeCache).height...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/BarLineChartBaseModel.ets#L417-L427
efe314581a81f885e83fb33489cb12be55789373
gitee
Jolin-Kan/HarmonyOS-App.git
5b2c84ed90d89d721bc107f2100a64d0203a6e72
entry/src/main/ets/pages/MyPage.ets
arkts
MyPage
@Entry
@Component export struct MyPage { title: string = '我的' build() { Flex({direction:FlexDirection.Column,justifyContent:FlexAlign.SpaceBetween}) { // 中间内容 Scroll() { Column() { Text("个人信息") .fontSize(24) .width("100%") .alignSelf(ItemAlign.Star...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyPage AST#component_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '我的' AST#expression#R...
@Component export struct MyPage { title: string = '我的' build() { Flex({direction:FlexDirection.Column,justifyContent:FlexAlign.SpaceBetween}) { Scroll() { Column() { Text("个人信息") .fontSize(24) .width("100%") .alignSelf(ItemAlign.Start) ...
https://github.com/Jolin-Kan/HarmonyOS-App.git/blob/5b2c84ed90d89d721bc107f2100a64d0203a6e72/entry/src/main/ets/pages/MyPage.ets#L3-L38
d7b11e3a1a349c520d91dede903cbbdcfedceb7a
github
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
addMosaicRecord
添加马赛克记录 @param mosaic 马赛克记录
addMosaicRecord(mosaic: MosaicData): void { this.addRecord({ data: mosaic, type: ImageEditFunctionType.MOSAIC }); }
AST#method_declaration#Left addMosaicRecord AST#parameter_list#Left ( AST#parameter#Left mosaic : AST#type_annotation#Left AST#primary_type#Left MosaicData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
addMosaicRecord(mosaic: MosaicData): void { this.addRecord({ data: mosaic, type: ImageEditFunctionType.MOSAIC }); }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L79-L84
c356b483db8a84d18fcbe384f25bcacfd2bae945
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets
arkts
Index页面样式
export const IndexStyle = { IMAGE_TITLE_WIDTH: 330, IMAGE_TITLE_HEIGHT: 112, IMAGE_TITLE_MARGIN_TOP: 50, IMAGE_ANIMATION_WIDTH: 240, IMAGE_ANIMATION_HEIGHT: 240, IMAGE_EXPLAIN_MARGIN_TOP: 20, COLUMN_EMPTY_LAYOUT_WEIGHT: 1, BLANK_EMPTY_MARGIN_BOTTOM: 20, BUTTON_LOTTERY_OPACITY: .5, BUTTON_LOTTERY_WID...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left IndexStyle = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left IMAGE_TITLE_WIDTH AST#property_name#Right : AST#expression#Left 330 AST#expression#Right AST#property_assignm...
export const IndexStyle = { IMAGE_TITLE_WIDTH: 330, IMAGE_TITLE_HEIGHT: 112, IMAGE_TITLE_MARGIN_TOP: 50, IMAGE_ANIMATION_WIDTH: 240, IMAGE_ANIMATION_HEIGHT: 240, IMAGE_EXPLAIN_MARGIN_TOP: 20, COLUMN_EMPTY_LAYOUT_WEIGHT: 1, BLANK_EMPTY_MARGIN_BOTTOM: 20, BUTTON_LOTTERY_OPACITY: .5, BUTTON_LOTTERY_WID...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkUIExperience/entry/src/main/ets/common/constants/Constants.ets#L84-L105
e99550bc617c6498a5ac24bafb05d4eaefd9de20
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listitemoverflow/src/main/ets/pages/AboutMe.ets
arkts
signItem
个性签名组件。 @param text 个性签名 @param prompt 点击后的提示语
@Builder signItem(text: ResourceStr, prompt: ResourceStr) { Text(text) .width("100%") .fontSize($r("sys.float.ohos_id_text_size_body2")) .fontColor(Color.Grey) .margin($r("app.integer.listitem_overflow_default_margin")) .width('100%') .clickEffect({ level: ClickEffectLevel.HEAVY ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right signItem AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left prompt : AST#type_annotation#Left...
@Builder signItem(text: ResourceStr, prompt: ResourceStr) { Text(text) .width("100%") .fontSize($r("sys.float.ohos_id_text_size_body2")) .fontColor(Color.Grey) .margin($r("app.integer.listitem_overflow_default_margin")) .width('100%') .clickEffect({ level: ClickEffectLevel.HEAVY ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listitemoverflow/src/main/ets/pages/AboutMe.ets#L234-L245
5f54bfea46deb32188bb1f94efa56d63038ac1dc
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/IMClientManager.ets
arkts
unregisterSocketEvent
取消注册MobileIMSDK框架开放各种事件监听。
private unregisterSocketEvent() { let emiter: common.EventHub = this.getEmitter(); // 清空设置的各种回调 emiter.off(SocketEvent.SOCKET_EVENT_ON_LOGIN_RESPONSE); emiter.off(SocketEvent.SOCKET_EVENT_ON_LINK_CLOSE); emiter.off(SocketEvent.SOCKET_EVENT_ON_RECIEVE_MESSAGE); emiter.off(SocketEvent.SOCKET_EVENT...
AST#method_declaration#Left private unregisterSocketEvent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left emiter : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . EventHub AS...
private unregisterSocketEvent() { let emiter: common.EventHub = this.getEmitter(); emiter.off(SocketEvent.SOCKET_EVENT_ON_LOGIN_RESPONSE); emiter.off(SocketEvent.SOCKET_EVENT_ON_LINK_CLOSE); emiter.off(SocketEvent.SOCKET_EVENT_ON_RECIEVE_MESSAGE); emiter.off(SocketEvent.SOCKET_EVENT_ON_ERROR_RE...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/IMClientManager.ets#L260-L273
665d23adaa46061bbd49284f9a9f33a5e08f30e8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinP.ets
arkts
SpinP
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinP { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0;...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinP AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinP { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.2 @Local opacity1: number = 0; @Local opacity2: number = 0; @Local opacity3: number = 0; @Local opacity4: number = 0; @Local opacity5: number = 0;...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinP.ets#L21-L281
480a5268811965a9d0371b2e65c9ecacc7ee0860
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
exist
是否存在自定义弹窗
exist(dialogId: string): boolean { const arg = this.getArgById(dialogId); return arg != undefined; }
AST#method_declaration#Left exist AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right ...
exist(dialogId: string): boolean { const arg = this.getArgById(dialogId); return arg != undefined; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L252-L255
4e43ff27c5e34ae782d0f1d1944ee4da90bc7e6e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NumberUtil.ets
arkts
isOdd
检查数字是否为奇数 @param {number} num - 要检查的数字 @returns {boolean} 如果是奇数返回 true,否则返回 false
static isOdd(num: number): boolean { return num % 2 !== 0; }
AST#method_declaration#Left static isOdd AST#parameter_list#Left ( AST#parameter#Left num : 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 boolean AST#primary_type#Righ...
static isOdd(num: number): boolean { return num % 2 !== 0; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L90-L92
35ef339303763e0b207d07909bcc0d416dcd8dec
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/FileUtils.ets
arkts
getFileDirSize
获取指定文件夹下所有文件的大小或指定文件大小。 @param path 文件夹路径 或 文件路径
static getFileDirSize(path: string): number { if (FileUtils.accessSync(path)) { //path存在 if (FileUtils.isDirectory(path)) { //文件夹 let count: number = 0; FileUtils.listFileSync(path, { recursion: true }).forEach((filePath) => { count = count + FileUtils.lstatSync(path + filePath).size...
AST#method_declaration#Left static getFileDirSize AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
static getFileDirSize(path: string): number { if (FileUtils.accessSync(path)) { if (FileUtils.isDirectory(path)) { let count: number = 0; FileUtils.listFileSync(path, { recursion: true }).forEach((filePath) => { count = count + FileUtils.lstatSync(path + filePath).size }) ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/FileUtils.ets#L242-L255
48c41f93d56928f19c71a807e42c74e0a4faa041
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/timeto/TimeToManager.ets
arkts
saveTime
保存当前时间及执行结果
public static saveTime(type: TimeToType, result: boolean): void { TimeToManager.saveTimeByName(type, result); }
AST#method_declaration#Left public static saveTime AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TimeToType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left AST#primary_type#Left boolean AST#p...
public static saveTime(type: TimeToType, result: boolean): void { TimeToManager.saveTimeByName(type, result); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToManager.ets#L54-L56
6c927328e717bb5fb8068e422d1503c941d0253a
github
openharmony/xts_tools
784a2e99d894e6bc2aba8c38f6bb68032442b1c8
sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets
arkts
播放音频的文件名称
constructor(audioId: number, audioName: string, audioIcon: Resource, audioAuthorName: string, audioTime: string, audioNum: string, audio: string) { this.audioId = audioId; this.audioName = audioName; this.audioIcon = audioIcon; this.audioAuthorName = audioAuthorName; this.audioTime = audioTime; ...
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left audioId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left audioName : AST#type_annotation#Left AST#primary_type#Left string AST#primar...
constructor(audioId: number, audioName: string, audioIcon: Resource, audioAuthorName: string, audioTime: string, audioNum: string, audio: string) { this.audioId = audioId; this.audioName = audioName; this.audioIcon = audioIcon; this.audioAuthorName = audioAuthorName; this.audioTime = audioTime; ...
https://github.com/openharmony/xts_tools/blob/784a2e99d894e6bc2aba8c38f6bb68032442b1c8/sample/AppSampleD/entry/src/main/ets/appsampled/data/SearchResult.ets#L28-L36
8612fe8978daff839cd50d45343045402651c3ba
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/ComponentBase.ets
arkts
getTypeface
public setOriginYOffset(yOffset:number):void { this.mYOffset = yOffset; } returns the Typeface used for the labels, returns null if none is set @return
public getTypeface(): FontFamily /*Typeface*/ { return this.mTypeface; }
AST#method_declaration#Left public getTypeface AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FontFamily AST#primary_type#Right AST#type_annotation#Right /*Typeface*/ AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left...
public getTypeface(): FontFamily { return this.mTypeface; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L103-L106
e94a4323a2bf8e4a75fbaf45bb87f473670c310f
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_key_shortcuts.ets
arkts
set_shortcut
Sets the shortcut of a specific action. @param label A string, the label of the action. e.g. 'show_tabs'. @param key_com A string[], an array containing keys in the shortcut. e.g. ['a', 'ctrl', 'shift']
set_shortcut(label: string, key_com: string[]) { let index = this.key_shortcut_labels.indexOf(label); if (index > -1) { this.key_shortcut_combinations[index].clear_combination(); this.last_edit = Date.now(); // Trigger refresh and rebinding of key shortcuts in Index.ets setTimeout(() => { ...
AST#method_declaration#Left set_shortcut AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key_com : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left strin...
set_shortcut(label: string, key_com: string[]) { let index = this.key_shortcut_labels.indexOf(label); if (index > -1) { this.key_shortcut_combinations[index].clear_combination(); this.last_edit = Date.now(); setTimeout(() => { this.key_shortcut_combinations[index].load_string_array(ke...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_key_shortcuts.ets#L86-L97
44bdd8e366e44e2773b1c65d500bcadf09b2f892
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Copy a text file to sandbox directory, overwrites whatever that was at that place. THIS IS A SYNC FUNCTION @param from from a uri (file://). @param to a sandbox directory, the new parent folder of this file (in sandbox). @returns a sandbox uri.
export function copy_from_uri_to_sandbox(from: string, to: string, max_name_length?: number): string { let filesDir: string = meowContext().filesDir; let max_name_l: number = max_name_length || 64; // Get from path const from_path = new fileUri.FileUri(from).path; // Get file name const split_result = from....
AST#export_declaration#Left export AST#function_declaration#Left function copy_from_uri_to_sandbox AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#...
export function copy_from_uri_to_sandbox(from: string, to: string, max_name_length?: number): string { let filesDir: string = meowContext().filesDir; let max_name_l: number = max_name_length || 64; const from_path = new fileUri.FileUri(from).path; const split_result = from.split('/'); let file_name = de...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L560-L576
46ff2b8e7dd61c258251d2222c1567b23af54b98
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/VHPushCardBuilder.ets
arkts
VHPushCardView
常用设置底部弹窗视图
@Component export struct VHPushCardView { @Require @State card: VHCardInfo; @Require webinar_info: VHWebinarData; @State imgWidth: number = 200; @State imagHeight: number = 200; @State timeClose: string = '' @State timeCount: number = 0; @State url: string = "" private timeId: number = 0; private cont...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VHPushCardView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ State AST#decorator#Right card : AST#type_annotation#Left AST#primary_type#L...
@Component export struct VHPushCardView { @Require @State card: VHCardInfo; @Require webinar_info: VHWebinarData; @State imgWidth: number = 200; @State imagHeight: number = 200; @State timeClose: string = '' @State timeCount: number = 0; @State url: string = "" private timeId: number = 0; private cont...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/VHPushCardBuilder.ets#L29-L229
1dadfef6c403e34fcb6a641ae3fd8f7f89f3bebd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DisplayUtil.ets
arkts
getAllDisplays
获取当前所有的display对象,使用Promise异步回调。 @returns
static async getAllDisplays(): Promise<Array<display.Display>> { return display.getAllDisplays(); }
AST#method_declaration#Left static async getAllDisplays AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#t...
static async getAllDisplays(): Promise<Array<display.Display>> { return display.getAllDisplays(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L54-L56
b0015e1a395f9bc2fdacb2ab7848bae5ba546394
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/Loading.ets
arkts
Loading
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2026/01/13
@Preview @ComponentV2 export struct Loading { @Require @Param spinSize: number; @Param spinColor: ResourceColor = Color.White; @Param spinTip: ResourceStr = "loading"; @Param fontSize: number | ResourceStr = 18; @Local whSize: number = 190; @Local center: number = 88; @Local radius: number = 90; @Local ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct Loading AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSi...
@Preview @ComponentV2 export struct Loading { @Require @Param spinSize: number; @Param spinColor: ResourceColor = Color.White; @Param spinTip: ResourceStr = "loading"; @Param fontSize: number | ResourceStr = 18; @Local whSize: number = 190; @Local center: number = 88; @Local radius: number = 90; @Local ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/Loading.ets#L22-L128
ae08aaeb3200276c96985e1896bd418753cb569c
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets
arkts
构造函数 @param {common.Context} [context] UIAbility 上下文
constructor(context?: common.Context) { const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx(); this.prefs = new PreferencesUtil(resolvedContext, TokenStoreDataSourceImpl.PREFS_NAME); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block...
constructor(context?: common.Context) { const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx(); this.prefs = new PreferencesUtil(resolvedContext, TokenStoreDataSourceImpl.PREFS_NAME); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/datastore/src/main/ets/datasource/token/TokenStoreDataSourceImpl.ets#L28-L31
589d1aa21a424356b36e9e0fedf732518354c955
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets
arkts
根据名称获取功能图标 @param name 图标名称 @returns 图标资源
export function getFunctionIconByName(name: string): ResourceStr { switch (name.toLowerCase()) { case 'add': return AppIcons.add; case 'search': return AppIcons.search; case 'progress': return AppIcons.progress; case 'star': return AppIcons.star; case 'notification': return AppIcons.notification; ...
AST#export_declaration#Left export AST#function_declaration#Left function getFunctionIconByName AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#...
export function getFunctionIconByName(name: string): ResourceStr { switch (name.toLowerCase()) { case 'add': return AppIcons.add; case 'search': return AppIcons.search; case 'progress': return AppIcons.progress; case 'star': return AppIcons.star; case 'notification': return AppIcons.notification; ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/IconUtils.ets#L133-L158
ab2b6c05b5335e022f0fd671c44fc839e10394d6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/view/InterceptorPage.ets
arkts
InterceptorPage
子元素的间距 Navigation路由拦截: 如何封装: 1、在路由模块增加路由拦截器interceptor.ets,定义拦截容器、注册方法和公共拦截逻辑。 2、当点击本案例时,触发在路由模块的动态路由.push()中的interceptor的公共拦截方法(此处需动态路由完成加载后执行否则首次路由拦截失败)。 3、子模块中定义业务具体拦截逻辑,做具体的拦截实现:通过routerInfo判断目的地为"我的页面"时判断登录状态是"未登录",此时执行跳转到登录页并返回true给拦截容器list(告知需拦截),已登录返回false,放行。并且注册到拦截器容器list中 4、拦截器获取拦截容器list中所有注册过的子模块的拦截函数,如果子模...
@AppRouter({ name: "navigationinterceptor/InterceptorPage" }) @Component export struct InterceptorPage { @StorageLink('login') hasLogin: boolean = true; // 记录登陆状态,true:已登录过。 scorller: Scroller = new Scroller(); private cateName: ResourceStr = $r('app.string.naviagtion_interceptor_more_service'); // 标题 @Builder...
AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left "navigationinterceptor/InterceptorPage" AST#expression#Right AST#property_assignment#Right } AST#obj...
@AppRouter({ name: "navigationinterceptor/InterceptorPage" }) @Component export struct InterceptorPage { @StorageLink('login') hasLogin: boolean = true; scorller: Scroller = new Scroller(); private cateName: ResourceStr = $r('app.string.naviagtion_interceptor_more_service'); @Builder AppCate() { GridRo...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/navigationinterceptor/src/main/ets/view/InterceptorPage.ets#L35-L293
5514c8f46512db5918c120841702790fb793c5d2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
getAllNetsSync
获取所有处于连接状态的网络列表 @returns
static getAllNetsSync(): Array<connection.NetHandle> { return connection.getAllNetsSync(); }
AST#method_declaration#Left static getAllNetsSync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left connection . NetHandle AST#qualified_type#R...
static getAllNetsSync(): Array<connection.NetHandle> { return connection.getAllNetsSync(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L110-L112
31202eaf5bc937dd7f9f3a0ab3da23cde76a5b5b
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '1.9.0';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '1.9.0' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '1.9.0';
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/BuildProfile.ets#L4-L4
8c1e550798b5fbdc74a14e4fb9b45ddab7ba4a7b
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/auth/AuthService.ets
arkts
verifyGesturePassword
验证手势密码
async verifyGesturePassword(pattern: string): Promise<boolean> { try { const savedPattern = await StorageManager.getString('gesture_password', ''); return savedPattern === pattern; } catch (error) { Logger.error('AuthService', `Failed to verify gesture password: ${String(error)}`); retur...
AST#method_declaration#Left async verifyGesturePassword AST#parameter_list#Left ( AST#parameter#Left pattern : 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#generi...
async verifyGesturePassword(pattern: string): Promise<boolean> { try { const savedPattern = await StorageManager.getString('gesture_password', ''); return savedPattern === pattern; } catch (error) { Logger.error('AuthService', `Failed to verify gesture password: ${String(error)}`); retur...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L390-L398
85f9b5b19e43c54bc5050f0375ea36dbc887a7de
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/lib/FlowLocale.ets
arkts
extendedAvailableLocales
Returns a list of all installed locales and custom locales.
public static extendedAvailableLocales(context: Context): FlorisLocale[] { const systemLocales: FlorisLocale[] = FlorisLocale.installedSystemLocales(); const extensionManager: ExtensionManager = context.extensionManager(); const systemLocalesSet: Set<string> = new Set(systemLocales.map((locale: FlorisLocale...
AST#method_declaration#Left public static extendedAvailableLocales 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#Lef...
public static extendedAvailableLocales(context: Context): FlorisLocale[] { const systemLocales: FlorisLocale[] = FlorisLocale.installedSystemLocales(); const extensionManager: ExtensionManager = context.extensionManager(); const systemLocalesSet: Set<string> = new Set(systemLocales.map((locale: FlorisLocale...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/lib/FlowLocale.ets#L113-L127
d5719999bcd31d5be5faf9a66fbbda4f50c63003
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets
arkts
postCheck
应用约束1:明确参数和返回类型
postCheck(reaction: MessageReaction, user: User): string | null { this.users.set(user.id, user); if (this.options.max && ++this.total >= this.options.max) return 'limit'; if (this.options.maxEmojis && this.collected.size >= this.options.maxEmojis) return 'emojiLimit'; if (this.options.maxUsers && this.u...
AST#method_declaration#Left postCheck AST#parameter_list#Left ( AST#parameter#Left reaction : AST#type_annotation#Left AST#primary_type#Left MessageReaction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left User AST#primary_ty...
postCheck(reaction: MessageReaction, user: User): string | null { this.users.set(user.id, user); if (this.options.max && ++this.total >= this.options.max) return 'limit'; if (this.options.maxEmojis && this.collected.size >= this.options.maxEmojis) return 'emojiLimit'; if (this.options.maxUsers && this.u...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ReactionCollector.ets#L43-L49
935e6cff690999dea785cb3f6ce8094bacf3dfc5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SaveNetWorkPictures.ets
arkts
SaveNetWorkPictures
实现步骤: 点击上部“下载”按钮进入”下载网络图片到手机相册”场景示例;点击下部“下载到指定路径”按钮进入”下载文件到指定用户目录”场景示例, 从而实现手机相册并进行网络图片的下载和保存。 photoAccessHelper参考文档: https://developer.huawei.com/consumer/cn/doc/harmonyos-references/js-apis-photoaccesshelper saveButton参考文档 https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677
@Component export struct SaveNetWorkPictures { @State image: PixelMap | undefined = undefined; @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer /** * 通过http的request方法从网络下载图片资源 */ ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SaveNetWorkPictures AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right image : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left PixelMap AST#primar...
@Component export struct SaveNetWorkPictures { @State image: PixelMap | undefined = undefined; @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; @State imageBuffer: ArrayBuffer | undefined = undefined; async getPicture() { http.createHttp() .request('https://...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/photopickandsave/src/main/ets/components/SaveNetWorkPictures.ets#L37-L173
cbd07fc530473984d2d79010ba93b0579ad84227
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets
arkts
concatTime
时分格式修饰 @param hours @param minutes @param seconds
concatTime(hours, minutes) { return `${this.fill(hours)}:${this.fill(minutes)}` }
AST#method_declaration#Left concatTime AST#parameter_list#Left ( AST#parameter#Left hours AST#parameter#Right , AST#parameter#Left minutes AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#template_literal#Left ` AST#tem...
concatTime(hours, minutes) { return `${this.fill(hours)}:${this.fill(minutes)}` }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L61-L63
b6af1f2016d2793332d24e745a9b868efa8648c7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
Ability创建时的回调 @param want 启动参数 @param launchParam 启动参数
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('[EntryAbility] Ability onCreate'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onCreate'); // 应用启动时请求必要权限 this.requestRequiredPermissions(); }
AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abil...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { console.log('[EntryAbility] Ability onCreate'); hilog.info(0x0001, 'AI生日提醒', '%{public}s', 'Ability onCreate'); this.requestRequiredPermissions(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/entryability/EntryAbility.ets#L22-L28
5b88c5951ee1a395d2622f6bf93cd8068e42990f
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppFreeze/entry/src/main/ets/pages/appfreezecase.ets
arkts
xxxFunction1
最佳实践:应用冻屏优化建议 [Start appfreeze_advise3]
function xxxFunction1(fileUris : string[]): void { // ... for (const fileuri of fileUris) { let file = fs.openSync(fileuri, fs.OpenMode.READ_ONLY); // ... } // ... }
AST#function_declaration#Left function xxxFunction1 AST#parameter_list#Left ( AST#parameter#Left fileUris : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annota...
function xxxFunction1(fileUris : string[]): void { for (const fileuri of fileUris) { let file = fs.openSync(fileuri, fs.OpenMode.READ_ONLY); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppFreeze/entry/src/main/ets/pages/appfreezecase.ets#L42-L49
808b766cc88a5ad96dcf99158220b44b579dd57a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ImageUtil.ets
arkts
createImageSource
创建图片源实例 @param src(联合类型: string、number、ArrayBuffer、resourceManager.RawFileDescriptor) path string 图片路径,当前仅支持应用沙箱路径。当前支持格式有:.jpg .png .gif .bmp .webp RAW SVG10+ .ico11+。 fd number 文件描述符fd。 buf ArrayBuffer 图像缓冲区数组。 rawfile resourceManager.RawFileDescriptor 图像资源文件的RawFileDescriptor。 options SourceOptions 图片属性,包括图片像素密度...
static createImageSource(src: string | number | ArrayBuffer | resourceManager.RawFileDescriptor, options?: image.SourceOptions): image.ImageSource { if (typeof src === 'string') { if (options) { return image.createImageSource(src, options); } else { return image.createImageSource(src); ...
AST#method_declaration#Left static createImageSource AST#parameter_list#Left ( AST#parameter#Left src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left ArrayBuffer AST#primary_type#Right | AST#...
static createImageSource(src: string | number | ArrayBuffer | resourceManager.RawFileDescriptor, options?: image.SourceOptions): image.ImageSource { if (typeof src === 'string') { if (options) { return image.createImageSource(src, options); } else { return image.createImageSource(src); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ImageUtil.ets#L127-L153
d86d00803298c4fab6eb8f28d6288a71753a69bd
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/viewmodel/PresskeysViewModel.ets
arkts
getPressKeys
Key array data.
getPressKeys(): Array<Array<PressKeysBean>> { return [ [ new PressKeysBean(0, '32vp', '32vp', 'clean', $r('app.media.ic_clean')), new PressKeysBean(1, '19vp', '43vp', '7'), new PressKeysBean(1, '19vp', '43vp', '4'), new PressKeysBean(1, '19vp', '43vp', '1'), new PressKe...
AST#method_declaration#Left getPressKeys AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Le...
getPressKeys(): Array<Array<PressKeysBean>> { return [ [ new PressKeysBean(0, '32vp', '32vp', 'clean', $r('app.media.ic_clean')), new PressKeysBean(1, '19vp', '43vp', '7'), new PressKeysBean(1, '19vp', '43vp', '4'), new PressKeysBean(1, '19vp', '43vp', '1'), new PressKe...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FullScreenStart/FullScreenStart_Service/entry/src/main/ets/viewmodel/PresskeysViewModel.ets#L22-L52
54fe81aa001f8a7e9f67c1448082f36249c87997
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Native/NativeMultiThreads/entry/src/main/common/constants/CommonConstants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class Constants { // Height and width is 100%. static readonly FULL_PARENT: string = '100%'; // image root path static readonly IMAGE_ROOT_PATH: string = 'images/'; // After the app is started, the component initializes the loaded image. static readonly INIT_IMAGE_PATH: string = 'images/initi...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // Height and width is 100%. AST#property_declaration#Left static readonly FULL_PARENT : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Lef...
export default class Constants { static readonly FULL_PARENT: string = '100%'; static readonly IMAGE_ROOT_PATH: string = 'images/'; static readonly INIT_IMAGE_PATH: string = 'images/initialize.png'; static readonly SYNC_BUTTON_IMAGE: string = 'sync'; static readonly CALLBACK_BUTTON_IMAGE: strin...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Native/NativeMultiThreads/entry/src/main/common/constants/CommonConstants.ets#L16-L35
6c6eb51f6a134e098f5941769a2876a9426007ea
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/receiver/VoiceReadable.ets
arkts
应用约束60:使用ES模块导出
export default VoiceReadable;
AST#export_declaration#Left export default AST#expression#Left VoiceReadable AST#expression#Right ; AST#export_declaration#Right
export default VoiceReadable;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/receiver/VoiceReadable.ets#L23-L23
1b866638a1c16973b4d34d03fadd3fd6dda87ef1
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
Declare enum IconType @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11 Declare enum IconType @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare enum IconType { /** * Badge type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Badge type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */ /** * Badge type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatfo...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum IconType AST#enum_body#Left { /** * Badge type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Badge type. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @si...
export declare enum IconType { BADGE = 1, NORMAL_ICON = 2, SYSTEM_ICON = 3, HEAD_SCULPTURE = 4, APP_ICON = 5, PREVIEW = 6, LONGITUDINAL = 7, VERTICAL = 8 }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L44-L197
c1d3c4714379356e30075595c47e1ef35c095874
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoCreateGif.ets
arkts
copyFile2Sandbox
将rawfile中的文件拷贝到沙箱中 @param filename
copyFile2Sandbox(filename: string) { const targetPath: string = getContext().filesDir + "/" + filename; if (fs.accessSync(targetPath)) { return; } const data: resourceManager.RawFileDescriptor = getContext(this).resourceManager.getRawFdSync(filename); const destFile: fs.File = fs.openSync(t...
AST#method_declaration#Left copyFile2Sandbox AST#parameter_list#Left ( AST#parameter#Left filename : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaratio...
copyFile2Sandbox(filename: string) { const targetPath: string = getContext().filesDir + "/" + filename; if (fs.accessSync(targetPath)) { return; } const data: resourceManager.RawFileDescriptor = getContext(this).resourceManager.getRawFdSync(filename); const destFile: fs.File = fs.openSync(t...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoCreateGif.ets#L213-L241
82ca4c0663f3bf494b433da6eae742753f92ad93
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
shallowCopy
浅拷贝 @param obj @returns
static shallowCopy<T extends Object | Array<Object>>(obj: T): T { return ObjectUtils.shallowCopy<T>(obj); }
AST#method_declaration#Left static shallowCopy AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_...
static shallowCopy<T extends Object | Array<Object>>(obj: T): T { return ObjectUtils.shallowCopy<T>(obj); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L106-L108
458496c0628fd6f894c689ffa5fd0ddb15c1f34a
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
checkPersistentPermission
校验所选择的多个文件或目录URI持久化授权。(需要权限:ohos.permission.FILE_ACCESS_PERSIST) @param uris string 需要授予或使能权限的URI。 @param operationMode number 授予或使能权限的URI访问模式,参考OperationMode,例如: fileShare.OperationMode.READ_MODE :允许读授权。fileShare.OperationMode.READ_MODE | fileShare.OperationMode.WRITE_MODE :允许读写授权。 @returns Promise对象,返回true表示有持久化授权,f...
static async checkPersistentPermission(policies: Array<fileShare.PolicyInfo>): Promise<Array<boolean>> { return fileShare.checkPersistentPermission(policies); }
AST#method_declaration#Left static async checkPersistentPermission AST#parameter_list#Left ( AST#parameter#Left policies : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left fileShare . PolicyInfo AS...
static async checkPersistentPermission(policies: Array<fileShare.PolicyInfo>): Promise<Array<boolean>> { return fileShare.checkPersistentPermission(policies); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L998-L1000
c4c8d5a2155e9041121799f9682e6d6745cd17e0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/constants/AppDefines.ets
arkts
export const dStarFlag = "\u2728";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dStarFlag = AST#expression#Left "\u2728" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const dStarFlag = "\u2728";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppDefines.ets#L62-L62
f750449f24fb27c8bc2663e98634aeea7f7bd099
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
setEnabled
Set this to true if this component should be enabled (should be drawn), false if not. If disabled, nothing of this component will be drawn. Default: true @param enabled
public setEnabled(enabled: boolean): void { this.mEnabled = enabled; }
AST#method_declaration#Left public setEnabled 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#primary_ty...
public setEnabled(enabled: boolean): void { this.mEnabled = enabled; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets#L165-L167
cd2d9796850a3afd4d33d5c4760058311c192236
gitee