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
huaweicloud/huaweicloud-iot-device-sdk-arkts.git
72954bea19e7e7f93567487b036c0664457bdaf3
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
set
设置命令监听器,用于接收平台下发的命令。 此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理 @param commandListener 命令监听器
public set commandListener(value: CommandListener | null) { this._commandListener = value; }
AST#method_declaration#Left public set AST#ERROR#Left command List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CommandListener AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right ...
public set commandListener(value: CommandListener | null) { this._commandListener = value; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts.git/blob/72954bea19e7e7f93567487b036c0664457bdaf3/huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets#L93-L95
6c55f53d7b3e0d4569ce60945c2244e05a45f1d3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/pages/VideoDetail.ets
arkts
VideoDetail
搜索框透明度
@Entry @Component export struct VideoDetail { @State centerIndex: number = 0; // List显示区域内中间子组件索引值 @State workItem: WorkItem = new WorkItem('', '', '', '', ''); // 一条作品信息 @State isPlaying: boolean = true; // 是否播放状态 @State currentTime: number = 0; // 当前播放时间 @State totalDuration: number = 0; // 视频总时长 private ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct VideoDetail AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right centerIndex : AST#type_annotation#Left AST#primary_type...
@Entry @Component export struct VideoDetail { @State centerIndex: number = 0; @State workItem: WorkItem = new WorkItem('', '', '', '', ''); @State isPlaying: boolean = true; @State currentTime: number = 0; @State totalDuration: number = 0; private videoPlayController: VideoPlayController = new VideoPla...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/pages/VideoDetail.ets#L29-L71
ad10b1108b9bd434a24880d1c18c32c0c4eabca0
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LegendRenderer.ets
arkts
getFormPaint
Returns the Paint object used for drawing the Legend forms. @return
public getFormPaint(): Paint { return this.mLegendFormPaint; }
AST#method_declaration#Left public getFormPaint AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Paint AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre...
public getFormPaint(): Paint { return this.mLegendFormPaint; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LegendRenderer.ets#L93-L95
45b6c0e962c7cf7a3e2bcf439e611aeb10e9cf5d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/DailyCountManaer.ets
arkts
getKeyWithToday
获取带当天日期的 key,如:wordPron_2025-11-19
static getKeyWithToday(type: DailyCountType): string { const today: string = DateUtils.toDateString(new Date()) ?? ""; return `${type}_${today}`; }
AST#method_declaration#Left static getKeyWithToday AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left DailyCountType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST...
static getKeyWithToday(type: DailyCountType): string { const today: string = DateUtils.toDateString(new Date()) ?? ""; return `${type}_${today}`; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/DailyCountManaer.ets#L33-L36
c881442c9e11d8a1b03d48f244095a2e76689913
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarCalendar.ets
arkts
getSolarTerm
获取二十四节气 @param solarYear 公历年 @param solarMonth 公历月 @param solarDay 公历日 @returns 节气名称,无节气返回空字符串
static getSolarTerm(solarYear: number, solarMonth: number, solarDay: number): string { // 简化的二十四节气计算(基于平均日期) const solarTerms: Record<string, string> = { '1-5': '小寒', '1-20': '大寒', '2-4': '立春', '2-19': '雨水', '3-5': '惊蛰', '3-20': '春分', '4-5': '清明', '4-20': '谷雨', '5-5': '立夏', '5-21':...
AST#method_declaration#Left static getSolarTerm AST#parameter_list#Left ( AST#parameter#Left solarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left solarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#...
static getSolarTerm(solarYear: number, solarMonth: number, solarDay: number): string { const solarTerms: Record<string, string> = { '1-5': '小寒', '1-20': '大寒', '2-4': '立春', '2-19': '雨水', '3-5': '惊蛰', '3-20': '春分', '4-5': '清明', '4-20': '谷雨', '5-5': '立夏', '5-21': '小满', '6-6': '...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L486-L505
a743238ff537868198e64f732230a6463911e5fb
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/ChatTools.ets
arkts
showToast
显示奶油提示。 @param message 提示内容 @param duration 持续时间(单位:毫秒),默认1500
static showToast(message: string | Resource, duration: number = 1500) { promptAction.showToast({ message: message, duration: duration, showMode: promptAction.ToastShowMode.TOP_MOST, }); }
AST#method_declaration#Left static showToast AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ...
static showToast(message: string | Resource, duration: number = 1500) { promptAction.showToast({ message: message, duration: duration, showMode: promptAction.ToastShowMode.TOP_MOST, }); }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L97-L103
9e38110c48cc96622c662f5403a223a79fcab0c2
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets
arkts
getBuilder
获取路由表中指定的页面组件
public static getBuilder(builderName: string): WrappedBuilder<[object]> { const builder = RouterModule.builderMap.get(builderName); if (!builder) { Logger.info('not found builder ' + builderName); } return builder as WrappedBuilder<[object]>; }
AST#method_declaration#Left public static getBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : 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#gener...
public static getBuilder(builderName: string): WrappedBuilder<[object]> { const builder = RouterModule.builderMap.get(builderName); if (!builder) { Logger.info('not found builder ' + builderName); } return builder as WrappedBuilder<[object]>; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/sourcecode/RouterModule.ets#L53-L59
f7c956f496099230a9b45308e1c20128e9ddcb4c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
@file 地址详情页面 ViewModel @author Joker.X
@ObservedV2 export default class AddressDetailViewModel extends BaseNetWorkViewModel<Address> { /** * 地址仓库 */ private readonly repository: AddressRepository = new AddressRepository(); /** * 路由参数 */ private readonly routeParam: UserAddressDetailParam = getRouteParams<UserAddressDetailParam>(UserR...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class AddressDetailViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primar...
@ObservedV2 export default class AddressDetailViewModel extends BaseNetWorkViewModel<Address> { private readonly repository: AddressRepository = new AddressRepository(); private readonly routeParam: UserAddressDetailParam = getRouteParams<UserAddressDetailParam>(UserRoutes.AddressDetail) ?? {}; priva...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets#L14-L404
66383a976864bba0cb0791406dee32f0a760e848
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
TODO 对象工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class ObjectUtil { /** * 获取对象的Hash值。如果是第一次获取,则计算Hash值并保存到对象的Hash域(返回随机的Hash值);如果不是第一次获取,则从Hash域中获取并返回Hash值(同一对象多次返回值保持不变)。 * @param object * @returns */ static getHash(object: Object): number { return util.getHash(object); } /** * 获取对象的Class名称 * @param obj * @returns */ ...
AST#export_declaration#Left export AST#class_declaration#Left class ObjectUtil AST#class_body#Left { /** * 获取对象的Hash值。如果是第一次获取,则计算Hash值并保存到对象的Hash域(返回随机的Hash值);如果不是第一次获取,则从Hash域中获取并返回Hash值(同一对象多次返回值保持不变)。 * @param object * @returns */ AST#method_declaration#Left static getHash AST#parameter_list#Left ( AST#...
export class ObjectUtil { static getHash(object: Object): number { return util.getHash(object); } static getClassName(obj: Object):string { return obj.constructor.name; } static getMethodsNames(obj: Object): string[] { return ObjectUtils.getMethodsNames(obj); } static isStr...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L27-L223
f9de01bc2d30094a0f7f7dc06941b33e05df08a4
gitee
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/LoginPage.ets
arkts
startLoginTimer
开启登录超时计时器。
startLoginTimer() { // 先确保清除之前的计时器 this.stopLoginTimer(); // 登陆超时计时器 this.loginingTimerId = setTimeout(() => { this.onLoginTimeout(); }, this.RETRY_DELAY); }
AST#method_declaration#Left startLoginTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 先确保清除之前的计时器 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . stopL...
startLoginTimer() { this.stopLoginTimer(); this.loginingTimerId = setTimeout(() => { this.onLoginTimeout(); }, this.RETRY_DELAY); }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/LoginPage.ets#L134-L141
f0eaf887cf9e41021bffd6f2bb17230b7c36946e
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/home/search.ets
arkts
topSearch
*********************************** 顶部搜索栏 ******************************************//
@Builder topSearch(){ Row({ space: 15 }) { Image('image/home/search.png') .width(20) .height(20) .onClick(() => { router.pushUrl({ url: 'pages/home/result' }) }) TextInput({ placeholder: '请输入关键词' }) .type(InputType.Normal) .width('80%') ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right topSearch 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 Row ( AST#component_parameters#Left { AST#component_parameter#Le...
@Builder topSearch(){ Row({ space: 15 }) { Image('image/home/search.png') .width(20) .height(20) .onClick(() => { router.pushUrl({ url: 'pages/home/result' }) }) TextInput({ placeholder: '请输入关键词' }) .type(InputType.Normal) .width('80%') ...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/home/search.ets#L35-L62
4bad2de16a82a21ac2dc21bff15f4e48c0a37a6b
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets
arkts
registerOnWindowSizeChange
[Start size_change] [Start about_appear]
registerOnWindowSizeChange(callback?: (size: window.Size) => void): void { // [StartExclude about_appear] // [StartExclude size_change] if (this.mainWindowClass === undefined) { Logger.error(`MainWindowClass is undefined`); return; } // [StartExclude about_appear] // [EndExclude size...
AST#method_declaration#Left registerOnWindowSizeChange AST#parameter_list#Left ( AST#parameter#Left callback ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . Size AST#qualified_type#Rig...
registerOnWindowSizeChange(callback?: (size: window.Size) => void): void { if (this.mainWindowClass === undefined) { Logger.error(`MainWindowClass is undefined`); return; } this.mainWindowClass.on('windowSizeChange', (size) => { AppStorage.setOrCreate('deviceHeig...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/entry/src/main/ets/utils/WindowUtil.ets#L139-L153
0bbdd2fbc51eaa1a09850c4cbb223606267aa898
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Data/Rdb/entry/src/main/ets/common/utils/ILogger.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export interface ILogger { verbose(tag: string, msg: string): void; debug(tag: string, msg: string): void; info(tag: string, msg: string): void; warn(tag: string, msg: string): void; error(tag: string, msg: string): void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ILogger AST#object_type#Left { AST#type_member#Left verbose AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#para...
export interface ILogger { verbose(tag: string, msg: string): void; debug(tag: string, msg: string): void; info(tag: string, msg: string): void; warn(tag: string, msg: string): void; error(tag: string, msg: string): void; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Data/Rdb/entry/src/main/ets/common/utils/ILogger.ets#L16-L26
e9a3e88a0dd43db1ccd619652d2d7d031b923dcb
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/BusinessSample/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * Tab size in page. */ static readonly TAB_SIZE: number = 4; /** * Tab weight of page. */ static readonly TABS_WEIGHT: number = 1; /** * List size of detail page. */ static readonly DETAIL_LIST_SIZE: number = 2; /** * Title param in routing. */...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Tab size in page. */ AST#property_declaration#Left static readonly TAB_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left...
export class CommonConstants { static readonly TAB_SIZE: number = 4; static readonly TABS_WEIGHT: number = 1; static readonly DETAIL_LIST_SIZE: number = 2; static readonly ROUTER_PARAMS_TITLE: string = 'title'; static readonly DETAIL_ROUTER_URL: string = 'pages/DetailPage'; static rea...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L99
dceb99e54e640d7f1fc5900e5d156d046cc86fee
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/view/ChatData.ets
arkts
Interface of chat.
export interface Chat { sender: string; message: string; };
AST#export_declaration#Left export AST#interface_declaration#Left interface Chat AST#object_type#Left { AST#type_member#Left sender : 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 message : AST#type_annotation#Left AST...
export interface Chat { sender: string; message: string; };
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/ChatData.ets#L19-L22
0bea57265f23bb3805561fa4445ce82bd337d560
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getBundleName
获取应用包的名称。
static getBundleName(): string { return AppUtil.getBundleInfoSync().name; }
AST#method_declaration#Left static getBundleName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp...
static getBundleName(): string { return AppUtil.getBundleInfoSync().name; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L507-L509
33cdfc90291c83e0895ab1e05c5a2d769370fc07
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment9.ets
arkts
DiscoverView
[Start discover_view]
@Component export struct DiscoverView { // [StartExclude Case6] private jumpList = () => { } @State hotFeedList: never[] = []; @State articlesDataSource: never[] = []; @State discoverModel: GeneratedTypeLiteralInterface_1 = { swiperData: [] }; // [EndExclude Case6] // 1.Getting shared state related to j...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct DiscoverView AST#component_body#Left { // [StartExclude Case6] AST#property_declaration#Left private jumpList = AST#expression#Left AST#arrow_function#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#e...
@Component export struct DiscoverView { private jumpList = () => { } @State hotFeedList: never[] = []; @State articlesDataSource: never[] = []; @State discoverModel: GeneratedTypeLiteralInterface_1 = { swiperData: [] }; @Consume('appPathStack') appPathStack: NavPathStack; @Consume('discoverPathSt...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment9.ets#L60-L114
d46f27f32dd3ba1bf6c988cc2a0136eb67f6dee9
gitee
JHB11Hinson/mineMointorAPP.git
b6b853cf534021ac39e66c9b3a35113896a272b2
entry/src/main/ets/pages/DeviceMonitoringPage.ets
arkts
openEditDialog
打开编辑弹窗
openEditDialog(item: DeviceItem) { this.dialogController = new CustomDialogController({ builder: EditThresholdDialog({ device: item, confirm: (newVal: number) => { this.handleSave(item, newVal); } }), alignment: DialogAlignment.Center, autoCancel: true }...
AST#method_declaration#Left openEditDialog AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left DeviceItem 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#expr...
openEditDialog(item: DeviceItem) { this.dialogController = new CustomDialogController({ builder: EditThresholdDialog({ device: item, confirm: (newVal: number) => { this.handleSave(item, newVal); } }), alignment: DialogAlignment.Center, autoCancel: true }...
https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/pages/DeviceMonitoringPage.ets#L102-L114
7e30407e73fbac063e91c3eb99788d8610c7fd9c
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/LoadingPanel.ets
arkts
LoadingPanel
Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
@Component export struct LoadingPanel { @Consume isLoading: boolean; build() { if (this.isLoading) { Column() { Column() { LoadingProgress().width($r('app.float.loading_panel_icon_w')) .height($r('app.float.loading_panel_icon_w')) .margin({ bottom: $r('app.float....
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LoadingPanel AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume AST#decorator#Right isLoading : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_...
@Component export struct LoadingPanel { @Consume isLoading: boolean; build() { if (this.isLoading) { Column() { Column() { LoadingProgress().width($r('app.float.loading_panel_icon_w')) .height($r('app.float.loading_panel_icon_w')) .margin({ bottom: $r('app.float....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/Photos/entry/src/main/ets/components/LoadingPanel.ets#L16-L40
9057d8acb5a4292c5e92e5957d0b872022b67cc9
gitee
seasonZhu/HarmonyStudy.git
b55e58c962e9b39d5211337590bdd45f2c2349b3
entry/src/main/ets/pages/Home.ets
arkts
immersionAction
/ 沉浸式开与关
immersionAction() { if (immersion.onOrOff == true) { immersion.onOrOffFullScreen(false) } else { immersion.onOrOffFullScreen(true) } }
AST#method_declaration#Left immersionAction AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left immersion AST#express...
immersionAction() { if (immersion.onOrOff == true) { immersion.onOrOffFullScreen(false) } else { immersion.onOrOffFullScreen(true) } }
https://github.com/seasonZhu/HarmonyStudy.git/blob/b55e58c962e9b39d5211337590bdd45f2c2349b3/entry/src/main/ets/pages/Home.ets#L218-L224
1afa54ccb45523f9968fd9d05da2b4ed2fd3e24b
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/default/common/components/mainTabs.ets
arkts
MainTabs
数字家庭首页 Tab组件(“主页”,“日程”,“我的”) @param error @param data
@Component export struct MainTabs { @State userName: string = '' @State userPhone: string = '' @State userId: string = '' private controller: TabsController = new TabsController() // 定义三个页签 private tabBars: MainTabBarModel[] = [{ id: 0, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainTabs AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right userName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
@Component export struct MainTabs { @State userName: string = '' @State userPhone: string = '' @State userId: string = '' private controller: TabsController = new TabsController() private tabBars: MainTabBarModel[] = [{ id: 0, ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/mainTabs.ets#L48-L161
aba6d7c4e18d0a8c76c78afbd9885a9abec46610
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/SettingsPage.ets
arkts
checkAndEnableNewEpisodeNotification
检查并启用新单集通知
async checkAndEnableNewEpisodeNotification(): Promise<void> { try { // 先检查主通知权限是否已启用 const isEnabled = await notificationManager.isNotificationEnabled(); if (!isEnabled) { // 主通知未启用,提示用户需要先启用主通知 const dialogButtons: ButtonOptions[] = [ new ButtonOptions('知道了', '#00...
AST#method_declaration#Left async checkAndEnableNewEpisodeNotification 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_annotat...
async checkAndEnableNewEpisodeNotification(): Promise<void> { try { const isEnabled = await notificationManager.isNotificationEnabled(); if (!isEnabled) { const dialogButtons: ButtonOptions[] = [ new ButtonOptions('知道了', '#007AFF') ]; UIUtils.show...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SettingsPage.ets#L302-L333
6e401f1aea0d9bfa327e8891a739fef8822260af
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageUtils.ets
arkts
filterInvalid
过滤无效消息 @param messages 消息数组 @returns 只包含无效消息的数组 使用示例: ```typescript const people = [person1, invalidPerson, person3] const invalidPeople = MessageUtils.filterInvalid(people) // invalidPeople: [invalidPerson] ```
static filterInvalid<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isValid()) }
AST#method_declaration#Left static filterInvalid AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left messages...
static filterInvalid<T extends Message>(messages: T[]): T[] { return messages.filter(m => !m.isValid()) }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageUtils.ets#L143-L145
6ffdb550dbf40d12aeb7d8ef12100c6c7f6d397e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/Animation/entry/src/main/ets/viewmodel/Point.ets
arkts
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export default class Point { public x: number = 0; public y: number = 0; constructor(x: number, y: number) { this.x = x; this.y = y; } }
AST#export_declaration#Left export default AST#class_declaration#Left class Point AST#class_body#Left { AST#property_declaration#Left public x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#...
export default class Point { public x: number = 0; public y: number = 0; constructor(x: number, y: number) { this.x = x; this.y = y; } }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/Animation/entry/src/main/ets/viewmodel/Point.ets#L16-L24
6d43f7d1b5ac903fcec0993c7c51b84c04aee677
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/navigation/ProfileNav.ets
arkts
ProfileNav
@file 个人中心页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function ProfileNav(): void { ProfilePage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ProfileNav 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_com...
@Builder export function ProfileNav(): void { ProfilePage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/navigation/ProfileNav.ets#L8-L11
e1743acebe864dfc311cfeda91cb58e5d67f4871
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/constant/Contants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly NUMBER_5: number = 5; static readonly NUMBER_10: number = 10; static readonly NUMBER_20: number = 20; static readonly NUMBER_25: number = 25; static readonly NUMBER_30: number = 30; static readonly NUMBER_135: number = 135; static readonly NUMBER_200: number = 200;...
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly NUMBER_5 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right ; AST#property_...
export class Constants { static readonly NUMBER_5: number = 5; static readonly NUMBER_10: number = 10; static readonly NUMBER_20: number = 20; static readonly NUMBER_25: number = 25; static readonly NUMBER_30: number = 30; static readonly NUMBER_135: number = 135; static readonly NUMBER_200: number = 200;...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/constant/Contants.ets#L16-L27
eb8ea683fb693be1c4b13712a63e34f5d2a88a88
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
Index.ets
arkts
FFmpegFactory
命令工厂(简单易用)
export { FFmpegFactory, ContainerFormat } from './src/main/ets/ffmpeg/FFmpegFactory';
AST#export_declaration#Left export { FFmpegFactory , ContainerFormat } from './src/main/ets/ffmpeg/FFmpegFactory' ; AST#export_declaration#Right
export { FFmpegFactory, ContainerFormat } from './src/main/ets/ffmpeg/FFmpegFactory';
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/Index.ets#L18-L18
735cc2ced3d83c4dd54db3e377f5bd6616e4bd60
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
arkts
getBaseWordById
========================================================== 根据 idx 查询 BaseWord ==========================================================
async getBaseWordById(idx: number): Promise<BaseWord | null> { if (!this.db) return null; const sql = `SELECT * FROM ${Table.Name.baseWord} WHERE ${Table.Col.idx} = ?`; return await this.db.getData(sql, [idx], rs => this.createBaseWordFromRs(rs)); }
AST#method_declaration#Left async getBaseWordById AST#parameter_list#Left ( AST#parameter#Left idx : 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 AST#generic_type#Lef...
async getBaseWordById(idx: number): Promise<BaseWord | null> { if (!this.db) return null; const sql = `SELECT * FROM ${Table.Name.baseWord} WHERE ${Table.Col.idx} = ?`; return await this.db.getData(sql, [idx], rs => this.createBaseWordFromRs(rs)); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L78-L83
9150d6c45402e1b8733c4adbaed6167381f32fab
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/AudioManagerModel.ets
arkts
isSpeakerActive
设置是否打开扬声器
async isSpeakerActive(): Promise<boolean> { if (!this.mAudioRoutingManager) { return false; } let isSpeakerActive: boolean = await this.mAudioRoutingManager.isCommunicationDeviceActive(audio.CommunicationDeviceType.SPEAKER); Logger.info(TAG,` isSpeakerActive : ${isSpeakerActive}`); return isSp...
AST#method_declaration#Left async isSpeakerActive AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right > AST#ty...
async isSpeakerActive(): Promise<boolean> { if (!this.mAudioRoutingManager) { return false; } let isSpeakerActive: boolean = await this.mAudioRoutingManager.isCommunicationDeviceActive(audio.CommunicationDeviceType.SPEAKER); Logger.info(TAG,` isSpeakerActive : ${isSpeakerActive}`); return isSp...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/AudioManagerModel.ets#L98-L105
ad895c518604ef28dcf852e26682b571e88e77ed
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/AcademyManager.ets
arkts
学习统计
export interface LearningStats { totalMethodsLearned: number; currentStreak: number; totalStudyTime: number; favoriteMethod: string; skillLevel: 'beginner' | 'intermediate' | 'advanced' | 'expert'; }
AST#export_declaration#Left export AST#interface_declaration#Left interface LearningStats AST#object_type#Left { AST#type_member#Left totalMethodsLearned : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left currentStreak : ...
export interface LearningStats { totalMethodsLearned: number; currentStreak: number; totalStudyTime: number; favoriteMethod: string; skillLevel: 'beginner' | 'intermediate' | 'advanced' | 'expert'; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/AcademyManager.ets#L60-L66
be1c014c2b5054f41a52e086444ff11404ff4d8e
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/component/HomeCategorySection.ets
arkts
构建分类卡片 @returns {void} 无返回值
build(): void { if (this.categories && this.categories.length > 0) { Card({ paddingValue: $r("app.float.space_padding_small") }) { Grid() { ForEach(this.categories, (category: Category): void => { GridItem() { this.categoryItem(category); } }, ...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression...
build(): void { if (this.categories && this.categories.length > 0) { Card({ paddingValue: $r("app.float.space_padding_small") }) { Grid() { ForEach(this.categories, (category: Category): void => { GridItem() { this.categoryItem(category); } }, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/component/HomeCategorySection.ets#L28-L44
cdee9459bb4ea897200cc30b0568a7d10efe9960
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildSync.ets
arkts
handle
需根据实际类型替换'any'
handle(packet: Object): void { // 应用约束1:禁止使用any类型,使用Object代替 const client: Object = this.packetManager.client; // 应用约束1 const data: Object = (packet as any).d; // 应用约束30:使用as进行类型转换 (client as any).actions.GuildSync.handle(data); // 应用约束30 }
AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left packet : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#...
handle(packet: Object): void { const client: Object = this.packetManager.client; const data: Object = (packet as any).d; (client as any).actions.GuildSync.handle(data); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildSync.ets#L7-L11
bdcbb03c5243530a9d09e1a9af5195224650a77c
github
1lck/MindFlow.git
f05fab0891716cb852946ac02ed08dd2c0b9155a
front/entry/src/main/ets/services/ApiConfig.ets
arkts
统一配置后端接口地址 已改为宿主机局域网 IP,供真机/模拟器直接访问
export const API_BASE_URL = 'http://192.168.1.103:18080/api/v1';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left API_BASE_URL = AST#expression#Left 'http://192.168.1.103:18080/api/v1' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const API_BASE_URL = 'http://192.168.1.103:18080/api/v1';
https://github.com/1lck/MindFlow.git/blob/f05fab0891716cb852946ac02ed08dd2c0b9155a/front/entry/src/main/ets/services/ApiConfig.ets#L3-L3
bb9004879cdd63c6481264047d8f579e8046ccef
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/styledtext/src/main/ets/components/TextAndSpanComponent.ets
arkts
TextAndSpanComponent
功能描述: 通过自定义Span类型,在Text组件中使用ForEach遍历,根据不同的Span类型生成不同样式和功能的Span组件,实现部分文本高亮和超链接。 实现原理: 1. 使用 `MyCustomSpan[]` 类型的数组 `spans` 作为数据源,每个 `MyCustomSpan` 对象代表一个文本片段,包含类型(普通文本、超链接、视频链接等)和内容。 2. 遍历 `spans` 数组,根据每个 `span` 的类型动态生成相应的UI元素(如普通文本、可点击的超链接或视频链接)。 3. 如果最终的文本内容超过指定字符长度,则截断字符串并在末尾添加“...全文”链接。 4. 对于超链接和视频链接,提供回调函数 `linkC...
@Component export struct TextAndSpanComponent { // -------------------对外暴露变量----------------------- @State spans: MyCustomSpan[] = []; // 自定义span列表数据 maxStringLength: number = 140; // 正文内容最大字符长度,默认值140 defaultFontSize: string | number | Resource = $r('app.string.styled_text_font_size_default'); // 正文内容字体大小 de...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TextAndSpanComponent AST#component_body#Left { // -------------------对外暴露变量----------------------- AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right spans : AST#type_annotation#Left AST#prim...
@Component export struct TextAndSpanComponent { @State spans: MyCustomSpan[] = []; maxStringLength: number = 140; defaultFontSize: string | number | Resource = $r('app.string.styled_text_font_size_default'); defaultFontColor: ResourceColor = Color.Black; linkColor: ResourceColor = $r('app.color.styled_...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/components/TextAndSpanComponent.ets#L40-L173
c69ea728e3ab856ae1a6fa191bc2f01d2eb70013
gitee
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
common/src/main/ets/utils/LocalDataManager.ets
arkts
queryOrderList
Query order list data. @returns Order[]
queryOrderList() { return this.orderData; }
AST#method_declaration#Left queryOrderList AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . orderData AST#member_expression#Right AST#expressi...
queryOrderList() { return this.orderData; }
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/common/src/main/ets/utils/LocalDataManager.ets#L139-L141
9472757756e740b725511263a3fb3f88d220977d
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
getObject
获取对象值(从JSON字符串解析) @param key 键 @param defaultValue 默认值 @returns 对象值
async getObject<T>(key: string, defaultValue?: T): Promise<T | undefined> { try { const jsonString = await this.getString(key, ''); if (!jsonString) { return defaultValue; } return JSON.parse(jsonString) as T; } catch (error) { hilog.error(0x0001, 'BirthdayReminder', `Faile...
AST#method_declaration#Left async getObject AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Ri...
async getObject<T>(key: string, defaultValue?: T): Promise<T | undefined> { try { const jsonString = await this.getString(key, ''); if (!jsonString) { return defaultValue; } return JSON.parse(jsonString) as T; } catch (error) { hilog.error(0x0001, 'BirthdayReminder', `Faile...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L218-L229
85fde6d888574272ceeb3bca16b8f278e0ebe44a
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
setWindowTouchable
设置窗口是否为可触状态,使用Promise异步回调。 @param isTouchable 窗口是否为可触状态。true表示可触;false表示不可触。 @param windowClass 不传该值,默认主窗口。 @returns
static async setWindowTouchable(isTouchable: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setWindowTouchable(isTouchable); }
AST#method_declaration#Left static async setWindowTouchable AST#parameter_list#Left ( AST#parameter#Left isTouchable : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowClass : AST#type_annotation#Left AST#primary_type#...
static async setWindowTouchable(isTouchable: boolean, windowClass: window.Window = AppUtil.getMainWindow()): Promise<void> { return windowClass.setWindowTouchable(isTouchable); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L274-L277
96ab1b26817f4651a877af17ec9df97cd14a5edb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/data/FestivalData2025.ets
arkts
getAllFestivals
获取所有节日数据
public static getAllFestivals(): FestivalInfo[] { return [...SOLAR_FESTIVALS, ...LUNAR_FESTIVALS, ...SOLAR_TERMS]; }
AST#method_declaration#Left public static getAllFestivals AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FestivalInfo [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#ret...
public static getAllFestivals(): FestivalInfo[] { return [...SOLAR_FESTIVALS, ...LUNAR_FESTIVALS, ...SOLAR_TERMS]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData2025.ets#L193-L195
1196d567eb3fdb6d373fffaafa40813ad4320a85
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/viewmodel/MainEntryVM.ets
arkts
init
初始化
public async init() { await AccountUtil.silentLogin(); }
AST#method_declaration#Left public async init AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#await_expression#Left await AST#expression...
public async init() { await AccountUtil.silentLogin(); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/viewmodel/MainEntryVM.ets#L24-L26
116a9257485f2066d1aa694c5a351a3641e3e8f1
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_007_T.ets
arkts
Introduction 库函数-string_replace
export function string_lib_func_007_T(taint_src : string) { let t = taint_src.replace("a","b"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_007_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_007_T(taint_src : string) { let t = taint_src.replace("a","b"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_007_T.ets#L7-L10
684b4c45480277947e82670e6b8a310c3749cbed
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/TextBlockDrawing.ets
arkts
setDrawIndex
暴露设置绘制函数下标的方法
setDrawIndex(index: number) { this.myRenderNode.setDrawIndex(index); }
AST#method_declaration#Left setDrawIndex AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expressio...
setDrawIndex(index: number) { this.myRenderNode.setDrawIndex(index); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/TextBlockDrawing.ets#L143-L145
fb1ad2246b494da10d7ce9bda4f8418b55e9b2f7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listexchange/src/main/ets/view/ListExchangeView.ets
arkts
deductionView
ListItem自定义组件(开发者可以根据自己的需求设置列表项的UI)
@Builder deductionView(listItemInfo: ListInfo) { Row() { Image(listItemInfo.icon) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .draggable(false) // TODO:知识点:保持默认值true时,图片有默认拖拽效果,会影响Grid子组件拖拽判断,所以修改为false Text(listItemInfo....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right deductionView AST#parameter_list#Left ( AST#parameter#Left listItemInfo : AST#type_annotation#Left AST#primary_type#Left ListInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_funct...
@Builder deductionView(listItemInfo: ListInfo) { Row() { Image(listItemInfo.icon) .width($r('app.integer.list_exchange_icon_size')) .height($r('app.integer.list_exchange_icon_size')) .draggable(false) Text(listItemInfo.name) .margin({ left: $r('app.string.ohos_id_eleme...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/view/ListExchangeView.ets#L133-L156
ac719cdb79d8c533c7cae3e8c20a207a96f120e2
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
arkts
encryptGCMSegmentSync
加密(GCM模式)分段,同步 @param dataBlob 加密或者解密的数据。dataBlob不能为null。 @param key 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param len 自定义的数据拆分长度。 @returns
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, gc...
AST#method_declaration#Left static encryptGCMSegmentSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, key, gc...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L280-L297
0125194520e6e31e9d1cff9fc3b86331ade145c4
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets
arkts
中文释义2
export const titleCn3 = "item6";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left titleCn3 = AST#expression#Left "item6" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const titleCn3 = "item6";
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/BaseWordDbAccess.ets#L27-L27
da2d669597f4671292ce5c9f7816b56d8df335d6
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
decodeAsymSegment
非对称分段解密 @param str 待解密的字符串 @param priKey 给定秘钥规格私钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param dataCoding 入参字符串编码方式(hex/base64) @param isPem 是否为pem格式的key
static decodeAsymSegment(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding, isPem: boolean): OutDTO<string> { //将私钥转换 let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgNam...
AST#method_declaration#Left static decodeAsymSegment 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 priKey : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static decodeAsymSegment(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding, isPem: boolean): OutDTO<string> { let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) : ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L352-L381
8b69f8946239edc222d79674dc854f0a44b25e2d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
arkts
parseQRCodeImageWithNameFromCamera
解析从相机获取的二维码图片,指定文件名称 @param cameraService @param canvasContext
parseQRCodeImageWithNameFromCamera(cameraService: CameraService, imageComponentType?: image.ComponentType): void { Logger.info("parseQRCodeImageWithNameFromCamera...") cameraService.imageReceiver.on('imageArrival', async () => { Logger.info("parseQRCodeImageWithNameFro...
AST#method_declaration#Left parseQRCodeImageWithNameFromCamera AST#parameter_list#Left ( AST#parameter#Left cameraService : AST#type_annotation#Left AST#primary_type#Left CameraService AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left imageComponentType ? : AST#type_annotation#Le...
parseQRCodeImageWithNameFromCamera(cameraService: CameraService, imageComponentType?: image.ComponentType): void { Logger.info("parseQRCodeImageWithNameFromCamera...") cameraService.imageReceiver.on('imageArrival', async () => { Logger.info("parseQRCodeImageWithNameFro...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets#L72-L102
5642db06b7dc3bfa5dd6d4aa9c9922bb70bc77c0
gitee
ccccjiemo/egl.git
d18849c3da975ccf9373fd09874aa5637ccbe6bd
Index.d.ets
arkts
createPixmapSurface
OHOS好像不支持pixmapsurface
createPixmapSurface(config: EGLConfig, pixmap: image.PixelMap, attrib_list?: number[]): EGLSurface | undefined;
AST#method_declaration#Left createPixmapSurface AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left EGLConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pixmap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_t...
createPixmapSurface(config: EGLConfig, pixmap: image.PixelMap, attrib_list?: number[]): EGLSurface | undefined;
https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L257-L257
9a8ec6ee6b4fe5da9e2da04ad18a7eed7400146a
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets
arkts
toSimpleString
Returns a simple string representation of the DataSet with the type and the number of Entries. @return
public toSimpleString(): string { var str: string = 'DataSet, label: ' + (!this.getLabel() ? '' : this.getLabel()) + ', entries: ' + this.mEntries.size() + '\n'; return str; }
AST#method_declaration#Left public toSimpleString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left var AST#variable_declarator#Left str...
public toSimpleString(): string { var str: string = 'DataSet, label: ' + (!this.getLabel() ? '' : this.getLabel()) + ', entries: ' + this.mEntries.size() + '\n'; return str; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets#L204-L208
d369e62e5cb44dca36faa144c87abba26ba4d9a8
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinF.ets
arkts
SpinF
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinF { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0; @Local scale2: number = 1; @Local angle1: number = 0; build() { RelativeContainer() { Canvas() .alignRules({ top: { anchor: '__container__', ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinF 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 SpinF { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local scale1: number = 0; @Local scale2: number = 1; @Local angle1: number = 0; build() { RelativeContainer() { Canvas() .alignRules({ top: { anchor: '__container__', ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinF.ets#L22-L91
805c4f31ea4d60e3d26d3a0cb38cb67269307a14
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/Index.ets
arkts
OperateRDBInTaskPool
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { OperateRDBInTaskPool } from './src/main/ets/view/OperateRDBInTaskPool';
AST#export_declaration#Left export { OperateRDBInTaskPool } from './src/main/ets/view/OperateRDBInTaskPool' ; AST#export_declaration#Right
export { OperateRDBInTaskPool } from './src/main/ets/view/OperateRDBInTaskPool';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/operaterdbintaskpool/Index.ets#L16-L16
575a475ec643024cba214666fd1e2e58d6aa4f73
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
getOrderLogistics
查询订单物流信息 @param {number} orderId - 订单 ID @returns {Promise<NetworkResponse<Logistics>>} 物流详情
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { const resp: AxiosResponse<NetworkResponse<Logistics>> = await NetworkClient.http.get("order/info/logistics", { params: { orderId } }); return resp.data; }
AST#method_declaration#Left async getOrderLogistics AST#parameter_list#Left ( AST#parameter#Left orderId : 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 AST#generic_ty...
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { const resp: AxiosResponse<NetworkResponse<Logistics>> = await NetworkClient.http.get("order/info/logistics", { params: { orderId } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets#L103-L107
0371bc738e40f5b1a09b299cf2b1a360fb6a7406
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/OAuth2Application.ets
arkts
reset
Reset the app's secret and bot token. @deprecated userbot methods will be removed
reset(): OAuth2Application { return this.client.rest.methods.resetApplication(this.id); }
AST#method_declaration#Left reset AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left OAuth2Application AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressio...
reset(): OAuth2Application { return this.client.rest.methods.resetApplication(this.id); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/OAuth2Application.ets#L107-L109
19a8fdbece63e8320add7ddd7e61aa0c5ee83e47
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/core/crash/CrashReporter.ets
arkts
report
上报崩溃信息
report(crashInfo: CrashInfo): void { const fullCrashInfo: CrashInfo = { error: crashInfo.error, stack: crashInfo.stack, timestamp: crashInfo.timestamp || Date.now(), page: crashInfo.page, userId: crashInfo.userId, deviceInfo: crashInfo.deviceInfo }; Logger.error('CrashRe...
AST#method_declaration#Left report AST#parameter_list#Left ( AST#parameter#Left crashInfo : AST#type_annotation#Left AST#primary_type#Left CrashInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
report(crashInfo: CrashInfo): void { const fullCrashInfo: CrashInfo = { error: crashInfo.error, stack: crashInfo.stack, timestamp: crashInfo.timestamp || Date.now(), page: crashInfo.page, userId: crashInfo.userId, deviceInfo: crashInfo.deviceInfo }; Logger.error('CrashRe...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/crash/CrashReporter.ets#L51-L74
d3f15302c99ba05a249ed1aff078920df14a83bf
github
yangsongming/ArkTs-HuXiHelper.git
ed148299fc6dcf351bcc0f2863a5aee4885fbaf5
ets/viewmodel/PositionItem.ets
arkts
PixelCoordinates.
export class PixelCoordinates{ coordinateX: number = 0; coordinateY: number = 0; }
AST#export_declaration#Left export AST#class_declaration#Left class PixelCoordinates AST#class_body#Left { AST#property_declaration#Left coordinateX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declar...
export class PixelCoordinates{ coordinateX: number = 0; coordinateY: number = 0; }
https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/viewmodel/PositionItem.ets#L33-L36
39303fa609ce0b627b22de45fca697ac4c9161c2
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/networks/Http.ets
arkts
_buildQueryString
构建查询字符串
private static _buildQueryString(params: HttpUtils.HttpParams): string { if (!params) return ''; return Object.keys(params) .map(key => { const value = params[key]; // 安全编码参数 return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}` }) .join('&'); }
AST#method_declaration#Left private static _buildQueryString AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left HttpUtils . HttpParams AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_l...
private static _buildQueryString(params: HttpUtils.HttpParams): string { if (!params) return ''; return Object.keys(params) .map(key => { const value = params[key]; return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}` }) .join('&'); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/networks/Http.ets#L226-L236
ac57182ad401a86b9ee90f3d02546e347a37e873
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpClient.ets
arkts
构建界面
build() { Column() { Column() { Row({ space: 12 }) { // Row布局使输入框水平排列 // Server IP 输入框 Column() { Text($r('app.string.Enter_Server_Ip')) .fontSize(FONT.MEDIUM) .fontColor(Color.Gray) .textAlign(TextAlign.Start) .wi...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_...
build() { Column() { Column() { Row({ space: 12 }) { Column() { Text($r('app.string.Enter_Server_Ip')) .fontSize(FONT.MEDIUM) .fontColor(Color.Gray) .textAlign(TextAlign.Start) .width('100%') TextInpu...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TcpClient.ets#L78-L181
f8420a1477841fbe8bcb88025ceae91c9ea48518
gitee
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/TaoYao.ets
arkts
with
直接在UIAbility中申请权限 @param uiAbility @returns
static with(uiAbility: UIAbility): IAccessControl;
AST#method_declaration#Left static with AST#parameter_list#Left ( AST#parameter#Left uiAbility : AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left IAccessControl AST#pr...
static with(uiAbility: UIAbility): IAccessControl;
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L40-L40
507161f32f67c66e87f239899e7ba75d13cc8f81
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/bean/Caller.ets
arkts
Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable l...
export default interface
AST#export_declaration#Left export default AST#expression#Left interface AST#expression#Right AST#export_declaration#Right
export default interface
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/bean/Caller.ets#L16-L16
0904cfa75f5524dfc3d5f939a63247c914e21b75
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
setSessionListener
设置会话监听 @param sessionListener 会话监听事件 @returns
setSessionListener(sessionListener: efRcpConfig.sessionListener): EfRcp { this.cfg.sessionListener = sessionListener; return this; }
AST#method_declaration#Left setSessionListener AST#parameter_list#Left ( AST#parameter#Left sessionListener : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . sessionListener AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
setSessionListener(sessionListener: efRcpConfig.sessionListener): EfRcp { this.cfg.sessionListener = sessionListener; return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L296-L299
0c0405cda784e08e7ba2cfd29b1d3b410a18dd5b
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/Index.ets
arkts
KColors
/ configs
export { KColors } from '../JhCommon/src/main/ets/JhCommon/configs/Colors'
AST#export_declaration#Left export { KColors } from '../JhCommon/src/main/ets/JhCommon/configs/Colors' AST#export_declaration#Right
export { KColors } from '../JhCommon/src/main/ets/JhCommon/configs/Colors'
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/Index.ets#L15-L15
6e97e4cbecfddc0ca61a76abd74b92beb335b9ea
github
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/utils/GestureUtils.ets
arkts
手势工具类
export class GestureUtils { /** * 创建初始手势状态 * @param startX - 起始X坐标 * @param startY - 起始Y坐标 * @returns 初始手势状态 */ static createInitialGestureState(startX: number, startY: number): GestureState { return { startX: startX, startY: startY, currentX: startX, currentY: startY, ...
AST#export_declaration#Left export AST#class_declaration#Left class GestureUtils AST#class_body#Left { /** * 创建初始手势状态 * @param startX - 起始X坐标 * @param startY - 起始Y坐标 * @returns 初始手势状态 */ AST#method_declaration#Left static createInitialGestureState AST#parameter_list#Left ( AST#parameter#Left startX : AST...
export class GestureUtils { static createInitialGestureState(startX: number, startY: number): GestureState { return { startX: startX, startY: startY, currentX: startX, currentY: startY, deltaX: 0, deltaY: 0, velocity: 0, isActive: true }; } static upd...
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/GestureUtils.ets#L21-L251
50ca898b788eac700dadb930bc0b081e202f5fb4
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/theme/ThemeManager.ets
arkts
字体大小类型
export enum FontSizeType { SMALL = 'small', NORMAL = 'normal', LARGE = 'large', EXTRA_LARGE = 'extra_large' }
AST#export_declaration#Left export AST#enum_declaration#Left enum FontSizeType AST#enum_body#Left { AST#enum_member#Left SMALL = AST#expression#Left 'small' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NORMAL = AST#expression#Left 'normal' AST#expression#Right AST#enum_member#Right , AST#enum_membe...
export enum FontSizeType { SMALL = 'small', NORMAL = 'normal', LARGE = 'large', EXTRA_LARGE = 'extra_large' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L39-L44
15a17da3191ec2b75b4b31d36d264259ae896a0d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogBuilder.ets
arkts
AlertDialogBuilder
AlertDialog
@Builder export function AlertDialogBuilder(options: DialogOptions) { AlertDialog(options) .height(options.height) .width(options.width) .constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight }) .backgroundColor(options.backgroundColor) .backgroundBlurStyle(options.backgroundBl...
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function AlertDialogBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left DialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#paramet...
@Builder export function AlertDialogBuilder(options: DialogOptions) { AlertDialog(options) .height(options.height) .width(options.width) .constraintSize({ maxWidth: options.maxWidth, maxHeight: options.maxHeight }) .backgroundColor(options.backgroundColor) .backgroundBlurStyle(options.backgroundBl...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogBuilder.ets#L41-L54
63f5518b4599985123278d213c7ddf4e9b0e69c8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/DatabasePage.ets
arkts
DatabaseContent
数据库示例页内容视图 @returns {void} 无返回值
@Builder private DatabaseContent() { MediumPaddingVerticalScroll({ scroller: this.scroller }) { ColumnBase({ widthValue: P100 }) { this.InputSection(); SpaceVerticalLarge(); this.ListSection(); }; }; }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private DatabaseContent 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 MediumPaddingVerticalScroll ( AST#component_parame...
@Builder private DatabaseContent() { MediumPaddingVerticalScroll({ scroller: this.scroller }) { ColumnBase({ widthValue: P100 }) { this.InputSection(); SpaceVerticalLarge(); this.ListSection(); }; }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L56-L65
2d8881e4ff0e6fb75cd892ff2d1543172de05c12
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/accessibility/AccessibilityService.ets
arkts
语音速度
export enum SpeechRate { VERY_SLOW = 'very_slow', SLOW = 'slow', NORMAL = 'normal', FAST = 'fast', VERY_FAST = 'very_fast' }
AST#export_declaration#Left export AST#enum_declaration#Left enum SpeechRate AST#enum_body#Left { AST#enum_member#Left VERY_SLOW = AST#expression#Left 'very_slow' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SLOW = AST#expression#Left 'slow' AST#expression#Right AST#enum_member#Right , AST#enum_mem...
export enum SpeechRate { VERY_SLOW = 'very_slow', SLOW = 'slow', NORMAL = 'normal', FAST = 'fast', VERY_FAST = 'very_fast' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L49-L55
5501c75619bf413b1fb88b68e7407ab08d9468b6
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/MediaQuery/entry/src/main/ets/common/TitleBar.ets
arkts
TitleBar
Copyright (c) 2022-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,...
@Component export struct TitleBar { private title: Resource = $r("app.string.entry_title") build() { Row() { Text(this.title) .fontColor(Color.Black) .fontWeight(FontWeight.Bold) .fontSize(30) } .width('100%') .height('8%') .constraintSize({ minHeight: 50 }) .p...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resou...
@Component export struct TitleBar { private title: Resource = $r("app.string.entry_title") build() { Row() { Text(this.title) .fontColor(Color.Black) .fontWeight(FontWeight.Bold) .fontSize(30) } .width('100%') .height('8%') .constraintSize({ minHeight: 50 }) .p...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/MediaQuery/entry/src/main/ets/common/TitleBar.ets#L15-L31
ec1900d5668047b46531d7cee5d0cd00e575a696
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
showSharePanel
显示分享面板(私有方法) @private
private static showSharePanel(data: systemShare.SharedData): void { // 上下文检查 if (!ShareUtils.context) { console.error('ShareUtils: 未初始化上下文!请先调用 ShareUtils.init(context)'); return; } try { // 创建分享控制器 const controller = new systemShare.ShareController(data); // 添加面板关闭监听 ...
AST#method_declaration#Left private static showSharePanel AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . SharedData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list...
private static showSharePanel(data: systemShare.SharedData): void { if (!ShareUtils.context) { console.error('ShareUtils: 未初始化上下文!请先调用 ShareUtils.init(context)'); return; } try { const controller = new systemShare.ShareController(data); controller.on('dismiss', (...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L361-L391
d08233d865423c3c5f1b3168901c5644d8b3c671
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
getAllTextForQuestionWord
获取问题单词的所有可能文本(用于测试选项) 获取问题单词的所有可能文本(用于测试选项) @param question 当前题目单词 @param isEnglishAnswer true:答案是英文;false:答案是中文
async getAllTextForQuestionWord(question: WordUser, isEnglishAnswer : boolean): Promise<string[]> { const result: string[] = [] // ====== 英文作为答案 ====== if (isEnglishAnswer) { // 懒加载所有中英文映射 if (this.allCnTexts.length === 0) { const textDb = BookManager.shared.currentBook?.textDb ...
AST#method_declaration#Left async getAllTextForQuestionWord AST#parameter_list#Left ( AST#parameter#Left question : AST#type_annotation#Left AST#primary_type#Left WordUser AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isEnglishAnswer : AST#type_annotation#Left AST#primary_typ...
async getAllTextForQuestionWord(question: WordUser, isEnglishAnswer : boolean): Promise<string[]> { const result: string[] = [] if (isEnglishAnswer) { if (this.allCnTexts.length === 0) { const textDb = BookManager.shared.currentBook?.textDb if (!textDb) return [] co...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L876-L926
cc9b5d46ffb30d2a45a23817e5b313c2f00ed6ac
github
wuyuanwuhui999/harmony-arkts-movie-app-ui.git
d5e9bebe1dca2759cba417d2b6b402941d3bc273
entry/src/main/ets/components/MyComponent.ets
arkts
usePlayRecord
@description: 获取用户观看记录 @date: 2023-12-13 21:47 @author wuwenqiang
usePlayRecord() { getPlayRecordMovieListService(1,20).then(res => { this.playRecordMovieList = res.data; }) }
AST#method_declaration#Left usePlayRecord 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 getPlayRecordMovieListService ( AST#expression#Left 1 AST#expression#Right , AST#expression#Left 20 AST#expre...
usePlayRecord() { getPlayRecordMovieListService(1,20).then(res => { this.playRecordMovieList = res.data; }) }
https://github.com/wuyuanwuhui999/harmony-arkts-movie-app-ui.git/blob/d5e9bebe1dca2759cba417d2b6b402941d3bc273/entry/src/main/ets/components/MyComponent.ets#L72-L76
f104efdf622addc807be771ab2e15498ae6398e9
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/MultiDeviceMusic/common/src/main/ets/bean/MenuData.ets
arkts
Menu item info.
export class MenuData { /** * Indicates menu title. */ value: string; /** * Indicates menu action. */ action: () => void; }
AST#export_declaration#Left export AST#class_declaration#Left class MenuData AST#class_body#Left { /** * Indicates menu title. */ AST#property_declaration#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /** * I...
export class MenuData { value: string; action: () => void; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/MultiDeviceMusic/common/src/main/ets/bean/MenuData.ets#L19-L30
786a60d20cbd3e7f092054f6c1db53efb8d05667
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets
arkts
save
/保存plan到DB
public static async save(plan: Plan): Promise<void> { //如果planId为nil时,为新增 if (plan.planId === null) { plan.planId = await PlanDbAccess.shared.getNextPlanId(); } await PlanDbAccess.shared.addOrUpdateInTransaction( plan.asDBPlan(), plan.getDBPieces(), plan.getDBBoxes() ); ...
AST#method_declaration#Left public static async save AST#parameter_list#Left ( AST#parameter#Left plan : AST#type_annotation#Left AST#primary_type#Left Plan 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#L...
public static async save(plan: Plan): Promise<void> { if (plan.planId === null) { plan.planId = await PlanDbAccess.shared.getNextPlanId(); } await PlanDbAccess.shared.addOrUpdateInTransaction( plan.asDBPlan(), plan.getDBPieces(), plan.getDBBoxes() ); SimpleEventBu...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/PlanManager.ets#L222-L236
a10600f04df8432ef7e0c88f4074cce8423826db
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Render/SameLayer/DMPAvPlayer.ets
arkts
setAVPlayerCallback
注册avplayer回调函数。
setAVPlayerCallback(avPlayer: media.AVPlayer) { // seek操作结果回调函数。 avPlayer.on('seekDone', (seekDoneTime: number) => { console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) // error回调监听函数,当avplayer在操作过程中出现错误时,调用reset接口触发重置流程。 avPlayer.on('error', (err: BusinessError) => { ...
AST#method_declaration#Left setAVPlayerCallback AST#parameter_list#Left ( AST#parameter#Left avPlayer : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left media . AVPlayer AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#ERR...
setAVPlayerCallback(avPlayer: media.AVPlayer) { avPlayer.on('seekDone', (seekDoneTime: number) => { console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); }) avPlayer.on('error', (err: BusinessError) => { console.error(`Invoke avPlayer failed, code is ${err.code}, messa...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Render/SameLayer/DMPAvPlayer.ets#L15-L38
ae571c25969c172c218aa3e0862ccadc433d533b
github
sea5241/PictureSelector
09bac407ebd61100d1ccbf6e6d3b6349cb0013d7
selector/src/main/ets/model/CommonDialogData.ets
arkts
自定义弹窗数据 @Author sea @Date 2024/7/8
export class CommonDialogData { title: (Resource | string) = $r('app.string.tips') content: (Resource | string) = $r('app.string.tipsContent') cancelText: (Resource | string) = $r('app.string.cancel') confirmText: (Resource | string) = $r('app.string.confirm') }
AST#export_declaration#Left export AST#class_declaration#Left class CommonDialogData AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left AST#parenthesized_type#Left ( AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right...
export class CommonDialogData { title: (Resource | string) = $r('app.string.tips') content: (Resource | string) = $r('app.string.tipsContent') cancelText: (Resource | string) = $r('app.string.cancel') confirmText: (Resource | string) = $r('app.string.confirm') }
https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/model/CommonDialogData.ets#L6-L11
09ecab16655bf3f73dd17945b85350e24aebb2a6
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets
arkts
onWindowStageCreate
[EndExclude request_permission_in_UIAbility]
onWindowStageCreate(windowStage: window.WindowStage): void { // [StartExclude request_permission_in_UIAbility] // Main window is created, set main page for this ability hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); // [EndExclude request_permission_in_UIAbility] windowSta...
AST#method_declaration#Left onWindowStageCreate AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
onWindowStageCreate(windowStage: window.WindowStage): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); windowStage.loadContent('secondpages/Index', (err) => { reqPermissionsFromUser(permissions, this.context); if (err.code) { hilog.error(...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/RequestUserAuthorization/entry/src/main/ets/secondability/SecondAbility.ets#L67-L82
490ee19e27123d8a5a33488c7e2bcbe38e4f145e
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Spacer.ets
arkts
SpaceVerticalXSmall
创建一个超小垂直间距(4vp) @returns {void} 无返回值
@Builder export function SpaceVerticalXSmall(): void { Blank().height($r("app.float.space_vertical_small_x")); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SpaceVerticalXSmall 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#arkt...
@Builder export function SpaceVerticalXSmall(): void { Blank().height($r("app.float.space_vertical_small_x")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Spacer.ets#L55-L58
a1d1e9631ded50c761bdac706f05817de2f9689f
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/AlarmItemBean.ets
arkts
Alarm item description.
@Observed export default class AlarmItemBean extends ReminderItem { /** * Custom alarm name. */ name = '闹钟'; /** * Custom alarm is open. */ isOpen: boolean = true; /** * Custom alarm is repeat. */ isRepeat: boolean = false; /** * Custom alarm duration. */ duration: number = 5;...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export default AST#class_declaration#Left class AlarmItemBean extends AST#type_annotation#Left AST#primary_type#Left ReminderItem AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * Custom alarm name. ...
@Observed export default class AlarmItemBean extends ReminderItem { name = '闹钟'; isOpen: boolean = true; isRepeat: boolean = false; duration: number = 5; intervalMinute: number = 10; intervalTimes: number = 3; notificationId: number = 0; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/AlarmItemBean.ets#L21-L56
7f809533a411e42f3e96dec45165e27e8c96940c
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
@file 个人中心 ViewModel @author Joker.X
@ObservedV2 export default class ProfileViewModel extends BaseViewModel { /** * 全局用户状态 */ private readonly userState: UserState = getUserState(); /** * 获取展示昵称 * @returns {ResourceStr} 展示昵称 */ getDisplayNickName(): ResourceStr { const nickName: string = this.userState.getUserInfo().nickName?....
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class ProfileViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 全局用户状态 */ AST...
@ObservedV2 export default class ProfileViewModel extends BaseViewModel { private readonly userState: UserState = getUserState(); getDisplayNickName(): ResourceStr { const nickName: string = this.userState.getUserInfo().nickName?.trim() ?? ""; return nickName.length > 0 ? nickName : $r("app.string.us...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L9-L51
0ba6852aca55031debe5885231865fd33792f536
github
azhuge233/ASFShortcut-HN.git
d1669c920c56317611b5b0375aa5315c1b91211b
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
pickFile
导入功能 选择备份文件路径
public async pickFile(context: common.UIAbilityContext): Promise<string[]> { const documentSelectOptions = new picker.DocumentSelectOptions(); documentSelectOptions.maxSelectNumber = 1; documentSelectOptions.fileSuffixFilters = [".json"]; const documentViewPicker = new picker.DocumentVi...
AST#method_declaration#Left public async pickFile 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#Rig...
public async pickFile(context: common.UIAbilityContext): Promise<string[]> { const documentSelectOptions = new picker.DocumentSelectOptions(); documentSelectOptions.maxSelectNumber = 1; documentSelectOptions.fileSuffixFilters = [".json"]; const documentViewPicker = new picker.DocumentVi...
https://github.com/azhuge233/ASFShortcut-HN.git/blob/d1669c920c56317611b5b0375aa5315c1b91211b/entry/src/main/ets/common/utils/CommonUtils.ets#L126-L136
367e9787f582818530fbf313782b13a9e38a8ba1
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/TaskViewModel.ets
arkts
deleteTask
删除任务
async deleteTask(id: number): Promise<boolean> { const index = this.tasks.findIndex(task => task.id === id); if (index === -1) { return false; } const deletedTask = this.tasks[index]; this.tasks.splice(index, 1); await this.saveTasks(); this.notifyListeners(); // 记录离线操作 await...
AST#method_declaration#Left async deleteTask AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Prom...
async deleteTask(id: number): Promise<boolean> { const index = this.tasks.findIndex(task => task.id === id); if (index === -1) { return false; } const deletedTask = this.tasks[index]; this.tasks.splice(index, 1); await this.saveTasks(); this.notifyListeners(); await this.off...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L293-L311
58d77d18792f34cef1eeff0a01c6b5a3f2f299df
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets
arkts
calAddSum
[End Case] [Start Case2]
function calAddSum(addNum: number): number { // count is expected to be int, do not declare it as undefined/null or 0.0, directly initialize it to 0 let count = 0; count += addNum; return count; }
AST#function_declaration#Left function calAddSum AST#parameter_list#Left ( AST#parameter#Left addNum : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary...
function calAddSum(addNum: number): number { let count = 0; count += addNum; return count; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets#L26-L31
f0ed3eca9198e9b7ab0f1219d680612f4d8d6daf
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets
arkts
lineComponent
线条组件
@Builder lineComponent(angle: number) { Row({ space: 20 }) { Text() .animatableWidth(this.lineWidth) .animation({ duration: 500, curve: "ease" }) .height(1) .backgroundColor($r('app.color.COLOR_8C9BA2')) Text() .animatableWidth(this.lineWidth) .animation...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right lineComponent 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#builder_function_body#...
@Builder lineComponent(angle: number) { Row({ space: 20 }) { Text() .animatableWidth(this.lineWidth) .animation({ duration: 500, curve: "ease" }) .height(1) .backgroundColor($r('app.color.COLOR_8C9BA2')) Text() .animatableWidth(this.lineWidth) .animation...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets#L100-L119
f64779bb6d435c418d25b59dc9d1236f4c1a44a5
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Ability/StageAbility/entry/src/main/ets/common/utils/Logger.ets
arkts
warn
Outputs warning-level logs. @param args Indicates the log parameters.
warn(...args: string[]) { hilog.warn(this.domain, this.prefix, this.format, args); }
AST#method_declaration#Left warn AST#parameter_list#Left ( AST#parameter#Left ... args : 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#builder_function_body#Left { AST...
warn(...args: string[]) { hilog.warn(this.domain, this.prefix, this.format, args); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Ability/StageAbility/entry/src/main/ets/common/utils/Logger.ets#L56-L58
0d4d7de61fcdb0357cf9ffda0c35b4ea33e5aa54
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets
arkts
getListView
必须使用@Builder修饰方法
@Builder private getListView() { List({ space: 3, scroller: this.scroller }) { // TODO: 性能知识点:使用懒加载组件渲染数据 LazyForEach(this.newsData, (item: NewsData) => { ListItem() { newsItem({ newsTitle: item.newsTitle, newsContent: item.newsContent, n...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private getListView 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_p...
@Builder private getListView() { List({ space: 3, scroller: this.scroller }) { LazyForEach(this.newsData, (item: NewsData) => { ListItem() { newsItem({ newsTitle: item.newsTitle, newsContent: item.newsContent, newsTime: item.newsTime ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/PullToRefresh/pulltorefresh/src/main/ets/pages/PullToRefreshNews.ets#L299-L326
ad64e2c70a4ea5f25a46eb5d27d8c3cd58dafa7b
gitee
HarmonyCandies/image_editor.git
16924481f667efa4bdd1a0b39e6f5a80c43e5ff4
image_editor/src/main/ets/components/option/DrawOption.ets
arkts
类似地为其他类添加 fromMap 方法
export class PointDrawPart implements DrawPart { static readonly key: string = 'point'; offsets: Array<Offset>; paint: DrawPaint; constructor(paint: DrawPaint, offsets: Array<Offset>) { this.paint = paint; this.offsets = offsets; } static fromMap(data: Map<string, ESObject>): PointDrawPart { c...
AST#export_declaration#Left export AST#class_declaration#Left class PointDrawPart AST#implements_clause#Left implements DrawPart AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left static readonly key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_ann...
export class PointDrawPart implements DrawPart { static readonly key: string = 'point'; offsets: Array<Offset>; paint: DrawPaint; constructor(paint: DrawPaint, offsets: Array<Offset>) { this.paint = paint; this.offsets = offsets; } static fromMap(data: Map<string, ESObject>): PointDrawPart { c...
https://github.com/HarmonyCandies/image_editor.git/blob/16924481f667efa4bdd1a0b39e6f5a80c43e5ff4/image_editor/src/main/ets/components/option/DrawOption.ets#L123-L160
ef00896aa5b9390b23fb337679d838aa151c38e7
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets
arkts
SetDataCallBack
设置有序公共事件的结果数据回调
function SetDataCallBack() { }
AST#function_declaration#Left function SetDataCallBack AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#function_declaration#Right
function SetDataCallBack() { }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L359-L360
b49085061fc3580ff6652ddbc37c56e87696c662
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/view/CustomDialogComponent.ets
arkts
fancy
Common text styles.
@Extend(Text) function fancy () { .fontColor($r("app.color.dialog_fancy_text_color")) .fontSize($r("app.float.dialog_fancy_text_size")) .textAlign(TextAlign.Center) .fontWeight(FontWeight.Medium) .layoutWeight(CommonConstants.COMMON_LAYOUT_WEIGHT) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function fancy AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fontColor ( AST#expression#Left AST#resource_...
@Extend(Text) function fancy () { .fontColor($r("app.color.dialog_fancy_text_color")) .fontSize($r("app.float.dialog_fancy_text_size")) .textAlign(TextAlign.Center) .fontWeight(FontWeight.Medium) .layoutWeight(CommonConstants.COMMON_LAYOUT_WEIGHT) }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/view/CustomDialogComponent.ets#L91-L97
fb34c46c5b2bce2a7f917992efb16aeabc061d2d
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/NetworkDemoViewModel.ets
arkts
@file Network Demo 示例页 ViewModel @author Joker.X
@ObservedV2 export default class NetworkDemoViewModel extends BaseNetWorkViewModel<Goods> { /** * 商品仓库 */ private repository: GoodsRepository = new GoodsRepository(); /** * 请求商品详情数据 * @returns {Promise<NetworkResponse<Goods>>} 网络请求 Promise */ protected requestRepository(): Promise<NetworkRespons...
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class NetworkDemoViewModel extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BaseNetWorkViewModel AST#type_arguments#Left < AST#type_annotation#Left AST#primary_...
@ObservedV2 export default class NetworkDemoViewModel extends BaseNetWorkViewModel<Goods> { private repository: GoodsRepository = new GoodsRepository(); protected requestRepository(): Promise<NetworkResponse<Goods>> { return this.repository.getGoodsInfo("1"); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NetworkDemoViewModel.ets#L9-L23
451c484161b8be820771bdc442121e28c3180ec3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/PieChartRenderer.ets
arkts
drawHole
draws the hole in the center of the chart and the transparent circle / hole
protected drawHole(c: CanvasRenderingContext2D): void { if (this.mChart.isDrawHoleEnabled()) { let radius: number = this.mChart.getRadius(); let holeRadius: number = radius * (this.mChart.getHoleRadius() / 100); let center: MPPointF = this.mChart.getCenterCircleBox(); // if (MyColor.alpha...
AST#method_declaration#Left protected drawHole AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AS...
protected drawHole(c: CanvasRenderingContext2D): void { if (this.mChart.isDrawHoleEnabled()) { let radius: number = this.mChart.getRadius(); let holeRadius: number = radius * (this.mChart.getHoleRadius() / 100); let center: MPPointF = this.mChart.getCenterCircleBox(); ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/PieChartRenderer.ets#L726-L780
b33635d6ca1e66931bdced3671a6f856a4737c22
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/DES.ets
arkts
encryptSync
加密,同步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param params 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(3DES192|ECB|PKCS7、3DES192|CBC|PKCS7、等)。 @returns
static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob { return CryptoUtil.encryptSync(data, symKey, params, transformation); }
AST#method_declaration#Left static encryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKey :...
static encryptSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, params: cryptoFramework.ParamsSpec | null, transformation: string): cryptoFramework.DataBlob { return CryptoUtil.encryptSync(data, symKey, params, transformation); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/DES.ets#L155-L158
8b06a4242cc3643fedfff0717252b4cc178df6b1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets
arkts
obtainingSupported
obtain-supported-authentication-capabilities.md 以查询设备是否支持认证可信等级≥ATL1的PIN认证功能为例 [Start obtain_supported_capabilities]
obtainingSupported() { try { // 查询认证能力是否支持 userAuth.getAvailableStatus(userAuth.UserAuthType.PIN, userAuth.AuthTrustLevel.ATL1); Logger.info('current auth trust level is supported'); return true; } catch (error) { const err: BusinessError = error as BusinessError; Logger.erro...
AST#method_declaration#Left obtainingSupported AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 查询认证能力是否支持 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressi...
obtainingSupported() { try { userAuth.getAvailableStatus(userAuth.UserAuthType.PIN, userAuth.AuthTrustLevel.ATL1); Logger.info('current auth trust level is supported'); return true; } catch (error) { const err: BusinessError = error as BusinessError; Logger.error(`current au...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/UserAuthentication/entry/src/main/ets/pages/Index.ets#L83-L94
bf520c3b5099684aa8d86c33c7a37a44690d3fe1
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
绑定网络日志拦截器 @param {AxiosInstance} axiosInstance - Axios 实例 @returns {void} 无返回值
export function setupLogInterceptor(axiosInstance: AxiosInstance): void { axiosInstance.interceptors.request.use( (config: InternalAxiosRequestConfig) => { logRequest(config); return config; }, (error: AxiosError) => { logRequestError(error); return Promise.reject(error); } )...
AST#export_declaration#Left export AST#function_declaration#Left function setupLogInterceptor AST#parameter_list#Left ( AST#parameter#Left axiosInstance : AST#type_annotation#Left AST#primary_type#Left AxiosInstance AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#ty...
export function setupLogInterceptor(axiosInstance: AxiosInstance): void { axiosInstance.interceptors.request.use( (config: InternalAxiosRequestConfig) => { logRequest(config); return config; }, (error: AxiosError) => { logRequestError(error); return Promise.reject(error); } )...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L19-L41
6e6305c6b13b553ca0415c25123b0a237e2a1944
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets
arkts
pushData
在数据尾部增加一个元素 @param data 元素对象
public pushData(data: ESObject): void { this.originDataArray.push(data); this.notifyDataAdd(this.originDataArray.length - 1); }
AST#method_declaration#Left public pushData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
public pushData(data: ESObject): void { this.originDataArray.push(data); this.notifyDataAdd(this.originDataArray.length - 1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/BasicDataSource.ets#L79-L82
3ad05183d538aa80f53ebb1d17e1c676e3ca5540
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets
arkts
genTestDlpProperty
生成DLP策略
async genTestDlpProperty(): Promise<dlpPermission.DLPProperty> { this.accountInfo = await this.getOsAccountInfo(); let property: dlpPermission.DLPProperty = { 'ownerAccount': this.accountInfo.distributedInfo.name, 'ownerAccountID': this.accountInfo.distributedInfo.name, 'ownerAccountType': dlp...
AST#method_declaration#Left async genTestDlpProperty AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dlpPermission . DLPProperty AST#qualif...
async genTestDlpProperty(): Promise<dlpPermission.DLPProperty> { this.accountInfo = await this.getOsAccountInfo(); let property: dlpPermission.DLPProperty = { 'ownerAccount': this.accountInfo.distributedInfo.name, 'ownerAccountID': this.accountInfo.distributedInfo.name, 'ownerAccountType': dlp...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLP/entry/src/main/ets/feature/DlpManager.ets#L168-L180
57f469f1fabea6b5057740f4908bb3add176f01f
gitee
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
setAssetMap
新增数据 @param attr 要添加的属性集 @returns Promise<AssetStoreResult> 表示添加操作的异步结果
public static async setAssetMap(attr: asset.AssetMap): Promise<AssetStoreResult> { try { if (canIUse("SystemCapability.Security.Asset")) { await asset.add(attr); return { isSuccess: true }; } return { isSuccess: false, error: AssetStore.getUnSupportedPlatforms() }; } catch (err...
AST#method_declaration#Left public static async setAssetMap AST#parameter_list#Left ( AST#parameter#Left attr : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left asset . AssetMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right...
public static async setAssetMap(attr: asset.AssetMap): Promise<AssetStoreResult> { try { if (canIUse("SystemCapability.Security.Asset")) { await asset.add(attr); return { isSuccess: true }; } return { isSuccess: false, error: AssetStore.getUnSupportedPlatforms() }; } catch (err...
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/utils/AssetUtils.ets#L104-L117
c7b132be54fa965ffe5013f047b1f38a0d47d90f
github
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getResumeItems
获取恢复播放媒体列表 @returns
public getResumeItems(): Promise<Array<FinItem>> { return this.requireApi().getResumeItems() }
AST#method_declaration#Left public getResumeItems 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#type_an...
public getResumeItems(): Promise<Array<FinItem>> { return this.requireApi().getResumeItems() }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L32-L34
6354c10bd19bc35ee8075b0c3bb4edfab5409dc4
github
patient-fyd/HarmonyOS4.git
5ee3421130cb66278a1eac52fbd43dde7843f845
RentRoom/entry/src/main/ets/pages/Index.ets
arkts
handleTabChange
处理tab变化的回调
handleTabChange(index: number) { this.currentTabIndex = index; }
AST#method_declaration#Left handleTabChange AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expres...
handleTabChange(index: number) { this.currentTabIndex = index; }
https://github.com/patient-fyd/HarmonyOS4.git/blob/5ee3421130cb66278a1eac52fbd43dde7843f845/RentRoom/entry/src/main/ets/pages/Index.ets#L15-L17
94ba19d31bd7d64174bc82055bd27a50a0f76d27
github
tobias910903/komue-harmonyapp.git
cd4dd4e7859ec5b33a5140bdd1d050377f13175b
entry/src/main/ets/utils/Router.ets
arkts
获取路由参数
export function getRouteParams(): object { let uiContext: UIContext = AppUtil.getUIContext(); let router: Router = uiContext.getRouter(); return router.getParams(); }
AST#export_declaration#Left export AST#function_declaration#Left function getRouteParams AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Le...
export function getRouteParams(): object { let uiContext: UIContext = AppUtil.getUIContext(); let router: Router = uiContext.getRouter(); return router.getParams(); }
https://github.com/tobias910903/komue-harmonyapp.git/blob/cd4dd4e7859ec5b33a5140bdd1d050377f13175b/entry/src/main/ets/utils/Router.ets#L31-L35
8944da8d0ba5918d3a50635bf351e4074f73d1c7
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/controller/AvPlayerController.ets
arkts
setInterruptCallback
[End listener1] [Start set_back1]
private setInterruptCallback(): void { if (!this.avPlayer) { return; } this.avPlayer.on('audioInterrupt', async (interruptEvent: audio.InterruptEvent) => { if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) { // INTERRUPT_FORCE: The audio-related processing has be...
AST#method_declaration#Left private setInterruptCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Le...
private setInterruptCallback(): void { if (!this.avPlayer) { return; } this.avPlayer.on('audioInterrupt', async (interruptEvent: audio.InterruptEvent) => { if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) { switch (interruptEvent.hintType) { c...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvPlayerController.ets#L139-L166
776aef72e23fd05fafd03a9789c537a728c97569
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/SimpleAIService.ets
arkts
getOccasionText
获取场合文本
private getOccasionText(occasion: GreetingOccasion): string { switch (occasion) { case GreetingOccasion.BIRTHDAY: return '生日'; case GreetingOccasion.ANNIVERSARY: return '纪念日'; case GreetingOccasion.HOLIDAY: return '节日'; case GreetingOccasion.NEW_YEAR: return '...
AST#method_declaration#Left private getOccasionText AST#parameter_list#Left ( AST#parameter#Left occasion : AST#type_annotation#Left AST#primary_type#Left GreetingOccasion AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left str...
private getOccasionText(occasion: GreetingOccasion): string { switch (occasion) { case GreetingOccasion.BIRTHDAY: return '生日'; case GreetingOccasion.ANNIVERSARY: return '纪念日'; case GreetingOccasion.HOLIDAY: return '节日'; case GreetingOccasion.NEW_YEAR: return '...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L596-L627
196414e3dfdd0c5629bcd6e52b2d585b5233a96b
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
updateMessagesSendStatus
更新指定指纹码的消息的发送状态(更新多条消息)。 目前用于QoS送达机制中告诉应用层有哪些原始消息报文未成功送达给对方。 @param protocals 原始消息报文对象数组,数组中Protocal对象指纹码(消息id)就是本次要更新的对象,这个数组目前来自于SDK的 EventType.onMessagesLost 事件通知 @param sendStatus 发送状态,see {@link MsgSendStatus}
updateMessagesSendStatus(protocals: Protocal[], sendStatus: MsgSendStatus): void { let updateIndexes: number[] = []; // 遍历消息列表 // this.messages.forEach((m: Message) => { for(let mi = 0; mi < this.messages.length; mi++) { let m = this.messages[mi]; for(let i = 0; i < protocals.length; i++){ ...
AST#method_declaration#Left updateMessagesSendStatus AST#parameter_list#Left ( AST#parameter#Left protocals : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Protocal [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sendStatus : AST#ty...
updateMessagesSendStatus(protocals: Protocal[], sendStatus: MsgSendStatus): void { let updateIndexes: number[] = []; for(let mi = 0; mi < this.messages.length; mi++) { let m = this.messages[mi]; for(let i = 0; i < protocals.length; i++){ let p = protocals[i]; if(m...
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/model/MessagesProvider.ets#L101-L125
e3473d45447f65e9bba96c9c0daf8c4b53a78551
github