nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
swapWidthHeight
Convert width and height. @param rect
static swapWidthHeight(rect: RectF): void { let centerX = rect.getCenterX(); let centerY = rect.getCenterY(); let halfWidth = rect.getWidth() / 2; let halfHeight = rect.getHeight() / 2; rect.left = centerX - halfHeight; rect.right = centerX + halfHeight; rect.top = centerY - halfWidth; r...
AST#method_declaration#Left static swapWidthHeight AST#parameter_list#Left ( AST#parameter#Left rect : AST#type_annotation#Left AST#primary_type#Left RectF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
static swapWidthHeight(rect: RectF): void { let centerX = rect.getCenterX(); let centerY = rect.getCenterY(); let halfWidth = rect.getWidth() / 2; let halfHeight = rect.getHeight() / 2; rect.left = centerX - halfHeight; rect.right = centerX + halfHeight; rect.top = centerY - halfWidth; r...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets#L75-L84
ef4ea276ddb24e829ab960eb391d2746031146d8
gitee
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets
arkts
notifyDataReload
Notify the LazyForEach component that all subcomponents need to be reloaded.
notifyDataReload(): void { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
AST#method_declaration#Left notifyDataReload AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#express...
notifyDataReload(): void { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/NewsDataSource.ets#L60-L64
a3520c74cf2472349f98a913ee400b1026543f55
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
verify
对数据进行验签,异步 @param dataBlob 待验签数据 @param signDataBlob 签名数据 @param pubKey 公钥 @param algName 指定签名算法(SM2_256|SM3、SM2|SM3)。 @returns
static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): Promise<boolean> { return CryptoUtil.verify(dataBlob, signDataBlob, pubKey, algName); }
AST#method_declaration#Left static async verify 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#Left sig...
static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob, pubKey: cryptoFramework.PubKey, algName: string = 'SM2_256|SM3'): Promise<boolean> { return CryptoUtil.verify(dataBlob, signDataBlob, pubKey, algName); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L236-L239
cff739ca8fcee81d626b61b44b14d99e2838c3f1
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/GlobalThemeState.ets
arkts
主题状态结果接口
export interface ThemeStateResult { themeVersion: number; currentTheme: ThemeModel; refreshTheme: () => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ThemeStateResult AST#object_type#Left { AST#type_member#Left themeVersion : 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 currentTheme : AST#t...
export interface ThemeStateResult { themeVersion: number; currentTheme: ThemeModel; refreshTheme: () => void; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/GlobalThemeState.ets#L65-L69
2e4aa70ae79ef44c90c18c9ba3abef5cb81ae1dd
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/EntryOhos.ets
arkts
Class representing one entry in the chart. Might contain multiple values. Might only contain a single value depending on the used constructor.
export default class EntryOhos extends BaseEntry { private x: number = 0.0; constructor(x?: number, y?: number, icon?: ChartPixelMap, data?: Object) { super(y, icon, data); this.x = x ? x : 0; } /** * Returns the x-value of this Entry object. * * @return */ public getX(): number { re...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryOhos extends AST#type_annotation#Left AST#primary_type#Left BaseEntry AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private x : AST#type_annotation#Left AST#primary_type#Left number AS...
export default class EntryOhos extends BaseEntry { private x: number = 0.0; constructor(x?: number, y?: number, icon?: ChartPixelMap, data?: Object) { super(y, icon, data); this.x = x ? x : 0; } public getX(): number { return this.x; } public setX(x: number): void { this.x = x; } ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/EntryOhos.ets#L25-L100
d8570ffbb3bbf0ca8cd16bb55dafcf8fc36a0025
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/PreferencesUtils.ets
arkts
put
将数据缓存 @param key @param value @param preferenceName
static async put(key: string, value: preferences.ValueType, preferenceName: string = defaultPreferenceName) { let preferences = await PreferencesUtils.getPreferences(preferenceName); //获取实例 try { await preferences.put(key, value); await preferences.flush(); //此处一定要flush,要不然不能永久序列化到本地 } catch (e)...
AST#method_declaration#Left static async put AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left p...
static async put(key: string, value: preferences.ValueType, preferenceName: string = defaultPreferenceName) { let preferences = await PreferencesUtils.getPreferences(preferenceName); try { await preferences.put(key, value); await preferences.flush(); } catch (e) { LogUtils.debug('Prefere...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/PreferencesUtils.ets#L38-L46
6dec850ba7971533d84190b446e6a84c79f8b432
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CombinedChartModel.ets
arkts
getDrawOrder
Returns the currently set draw order. @return
public getDrawOrder(): DrawOrder[] { return this.mDrawOrder; }
AST#method_declaration#Left public getDrawOrder AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DrawOrder [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement...
public getDrawOrder(): DrawOrder[] { return this.mDrawOrder; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L227-L229
9ce15a9728dfb466f960b4b7813a54a6980ab6ae
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/web_actions.ets
arkts
Should be called when a tab gets its controller attached. @param pk The tab_info_packed.
export function on_controller_attached(pk: tab_info_packed) { // bind download delegate try { pk.controller!.setDownloadDelegate(pk.storage.get('dl_delegate') as webview.WebDownloadDelegate); } catch (e) { console.error('[meowWebView] onControllerAttached setDownloadDelegate error: ' + e); } // Set D...
AST#export_declaration#Left export AST#function_declaration#Left function on_controller_attached AST#parameter_list#Left ( AST#parameter#Left pk : AST#type_annotation#Left AST#primary_type#Left tab_info_packed AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stat...
export function on_controller_attached(pk: tab_info_packed) { try { pk.controller!.setDownloadDelegate(pk.storage.get('dl_delegate') as webview.WebDownloadDelegate); } catch (e) { console.error('[meowWebView] onControllerAttached setDownloadDelegate error: ' + e); } try { pk.controller!.setEr...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/web_actions.ets#L295-L356
e502f9574b27532a0714f91db0ef927da6b0643c
gitee
Neptune-EX/OS_System_Design.git
c728a82d48079ae0c52d50c4a2e2586b69f4ce55
entry/src/main/ets/view/PublicFilesTab.ets
arkts
executeDeleteFile
执行删除文件的方法
private async executeDeleteFile(filename: string) { console.log(`执行删除文件: ${filename}`); const success = deleteFile(filename); if (success) { console.log(`文件 ${filename} 删除成功`); await this.loadFileListWithInfo(); if (this.selectedFile === filename) { this.selectedFile = ''; ...
AST#method_declaration#Left private async executeDeleteFile AST#parameter_list#Left ( AST#parameter#Left filename : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expr...
private async executeDeleteFile(filename: string) { console.log(`执行删除文件: ${filename}`); const success = deleteFile(filename); if (success) { console.log(`文件 ${filename} 删除成功`); await this.loadFileListWithInfo(); if (this.selectedFile === filename) { this.selectedFile = ''; ...
https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/view/PublicFilesTab.ets#L250-L276
cd1f2ffcd9a65c98d3bb54e955339ce015029ab7
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/viewmodel/NavigationResultViewModel.ets
arkts
updateTitleInput
更新标题输入 @param {string} value - 标题输入内容 @returns {void} 无返回值
updateTitleInput(value: string): void { this.titleInput = value; }
AST#method_declaration#Left updateTitleInput AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
updateTitleInput(value: string): void { this.titleInput = value; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/viewmodel/NavigationResultViewModel.ets#L26-L28
b4f5ca1a8398f7c8d2db1767cd4cfd3c8cd32ed1
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/AppUtility.ets
arkts
getTextOfKindString
================== 词性类型转换 ================== 返回单词类型,如:动词,形容词。。 - kindStr 词性标识符:如:n,v,vt,vi,adj,adv
static getTextOfKindString(kindStr: string): string { if (kindStr) { // 使用资源引用方式获取本地化字符串 const kindMap: Record<string, ResourceStr> = { "n" : $r('app.string.word_kind_n'), "v" : $r('app.string.word_kind_v'), "vt" : $r('app.string.word_kind_vt'), "vi" ...
AST#method_declaration#Left static getTextOfKindString AST#parameter_list#Left ( AST#parameter#Left kindStr : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#...
static getTextOfKindString(kindStr: string): string { if (kindStr) { const kindMap: Record<string, ResourceStr> = { "n" : $r('app.string.word_kind_n'), "v" : $r('app.string.word_kind_v'), "vt" : $r('app.string.word_kind_vt'), "vi" : $r('app.str...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/AppUtility.ets#L383-L415
45ab0a63deb1df31b8e6e454654a65e739ff3d98
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BaseCustomBuilderProxy.ets
arkts
title
【非系统】自定标题 @param title @returns
title(title: string) { this.builderOptions.title = title return this; }
AST#method_declaration#Left title AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#exp...
title(title: string) { this.builderOptions.title = title return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BaseCustomBuilderProxy.ets#L16-L19
308b06fadc68ed5afe3752247762af3ff913232f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
generateIvParamsSpec
生成IvParamsSpec @returns
static generateIvParamsSpec(): cryptoFramework.IvParamsSpec { let dataIv = CryptoHelper.getRandomUint8Array(16); let ivBlob: cryptoFramework.DataBlob = { data: dataIv }; let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob }; return ivParamsSpec; }
AST#method_declaration#Left static generateIvParamsSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . IvParamsSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#st...
static generateIvParamsSpec(): cryptoFramework.IvParamsSpec { let dataIv = CryptoHelper.getRandomUint8Array(16); let ivBlob: cryptoFramework.DataBlob = { data: dataIv }; let ivParamsSpec: cryptoFramework.IvParamsSpec = { algName: "IvParamsSpec", iv: ivBlob }; return ivParamsSpec; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L230-L235
83afa783209b9a54c0ca13b3820a3fed8e9d640d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/IndicatorBarAttribute.ets
arkts
自定义背景条属性
export class IndicatorBarAttribute { // background模式背景条 public static readonly BACKGROUNDBAR: IndicatorBarAttribute = new IndicatorBarAttribute(backgroundBar, SizeMode.Padding, 20, 10, 0, 1, VerticalAlign.Center); // thinstrip模式背景条 public static readonly THINSTRIP: IndicatorBarAttribute = new IndicatorB...
AST#export_declaration#Left export AST#class_declaration#Left class IndicatorBarAttribute AST#class_body#Left { // background模式背景条 AST#property_declaration#Left public static readonly BACKGROUNDBAR : AST#type_annotation#Left AST#primary_type#Left IndicatorBarAttribute AST#primary_type#Right AST#type_annotation#Right = ...
export class IndicatorBarAttribute { public static readonly BACKGROUNDBAR: IndicatorBarAttribute = new IndicatorBarAttribute(backgroundBar, SizeMode.Padding, 20, 10, 0, 1, VerticalAlign.Center); public static readonly THINSTRIP: IndicatorBarAttribute = new IndicatorBarAttribute(thinStrip, SizeMode.Nor...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/IndicatorBarAttribute.ets#L23-L91
e98ec968e2e065906d3d72286c1e3708d8fa49a6
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
礼物价格范围枚举
export enum PriceRange { UNDER_50 = 'under_50', RANGE_50_100 = '50_100', RANGE_100_300 = '100_300', RANGE_300_500 = '300_500', RANGE_500_1000 = '500_1000', OVER_1000 = 'over_1000' }
AST#export_declaration#Left export AST#enum_declaration#Left enum PriceRange AST#enum_body#Left { AST#enum_member#Left UNDER_50 = AST#expression#Left 'under_50' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left RANGE_50_100 = AST#expression#Left '50_100' AST#expression#Right AST#enum_member#Right , AST#...
export enum PriceRange { UNDER_50 = 'under_50', RANGE_50_100 = '50_100', RANGE_100_300 = '100_300', RANGE_300_500 = '300_500', RANGE_500_1000 = '500_1000', OVER_1000 = 'over_1000' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L538-L545
a4266317ff4b8c8f3e837c574a48f7870261d400
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/entryability/EntryAbility.ets
arkts
Lift cycle management of Ability.
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { Logger.info(CommonConstants.TAG_ABILITY, 'want = ' + JSON.stringify(want)); Logger.info(CommonConstants.TAG_ABILITY, 'launchParam = ' + JSON.stringify(launchParam)); CommonUtils.createRdb...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#method_declaration#Left onCreate AST#parameter_list#Left ( AST#parameter#Left want : AST#ty...
export default class EntryAbility extends UIAbility { onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { Logger.info(CommonConstants.TAG_ABILITY, 'want = ' + JSON.stringify(want)); Logger.info(CommonConstants.TAG_ABILITY, 'launchParam = ' + JSON.stringify(launchParam)); CommonUtils.createRdb...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/entryability/EntryAbility.ets#L27-L44
0dca1d79d997f57afd5515dbd38f14e7ee4b81c7
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
logRequestError
打印请求错误日志 @param {AxiosError} error - 请求错误 @returns {void} 无返回值
function logRequestError(error: AxiosError): void { const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined; const method: string = config ? normalizeMethod(config.method) : "UNKNOWN"; const url: string = config ? buildRequestUrl(config) : "unknown"; const m...
AST#function_declaration#Left function logRequestError AST#parameter_list#Left ( AST#parameter#Left error : AST#type_annotation#Left AST#primary_type#Left AxiosError 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#...
function logRequestError(error: AxiosError): void { const config: InternalAxiosRequestConfig | undefined = error.config as InternalAxiosRequestConfig | undefined; const method: string = config ? normalizeMethod(config.method) : "UNKNOWN"; const url: string = config ? buildRequestUrl(config) : "unknown"; const m...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/interceptors/LogInterceptor.ets#L67-L78
ebb57a73240c16767199296ee8c03530ab82f21e
github
acclea/wechatDemo.git
7eef1379e8cb5926ed2114eb470959837b0b04a8
entry/src/main/ets/views/weather/FmpchartDemo.ets
arkts
this
Step2:配置图表指定样式,各部件间没有先后之分 为图表添加数据选择的监听器
this.model.setOnChartValueSelectedListener(this.valueSelectedListener);
AST#method_declaration#Left this AST#ERROR#Left . model . setOnChartValueSelected List ener AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left this AST#parameter#Right AST#ERROR#Left . valueSelected List ener AST#ERROR#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.model.setOnChartValueSelectedListener(this.valueSelectedListener);
https://github.com/acclea/wechatDemo.git/blob/7eef1379e8cb5926ed2114eb470959837b0b04a8/entry/src/main/ets/views/weather/FmpchartDemo.ets#L61-L61
c8fd2c86700d6d2fce09857246cc2bce22e531b2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets
arkts
TopView
顶部视图
@Component export struct TopView { private utils = new Utils(); build() { RelativeContainer() { Image($r("app.media.tabcontentoverflow_search_icon")) .width($r('app.integer.tabcontentoverflow_search_icon_width')) .height($r('app.integer.tabcontentoverflow_search_icon_height')) .id...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TopView AST#component_body#Left { AST#property_declaration#Left private utils = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left Utils AST#expression#Rig...
@Component export struct TopView { private utils = new Utils(); build() { RelativeContainer() { Image($r("app.media.tabcontentoverflow_search_icon")) .width($r('app.integer.tabcontentoverflow_search_icon_width')) .height($r('app.integer.tabcontentoverflow_search_icon_height')) .id...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/tabcontentoverflow/src/main/ets/view/Side.ets#L353-L462
4628e803f36eee94dff090611dc3945f1b20bd4c
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets
arkts
getSrcPath
Obtains the description of a media file. @param path Resource path. @param callback Callback function.
public static getSrcPath(path: string, callback: Function) { if (callback === undefined) { Logger.error(TAG, 'getSrcPath fail,callback is empty.'); return; } try { let resourceManager = GlobalContext.getContext() .getObject('resourceManager') as resourceManager.ResourceManager; ...
AST#method_declaration#Left public static getSrcPath AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#...
public static getSrcPath(path: string, callback: Function) { if (callback === undefined) { Logger.error(TAG, 'getSrcPath fail,callback is empty.'); return; } try { let resourceManager = GlobalContext.getContext() .getObject('resourceManager') as resourceManager.ResourceManager; ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/AudioPlayer/entry/src/main/ets/common/utils/ResourceManagerUtil.ets#L32-L51
770c5d48b631ec4d9a1eb3ac9285df0be8bd6542
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets
arkts
磁盘缓存类型
export type DiskCacheType = DiskLruCache;
AST#export_declaration#Left export AST#type_declaration#Left type DiskCacheType = AST#type_annotation#Left AST#primary_type#Left DiskLruCache AST#primary_type#Right AST#type_annotation#Right ; AST#type_declaration#Right AST#export_declaration#Right
export type DiskCacheType = DiskLruCache;
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/common/DiskCacheManager.ets#L20-L20
38627c82b91f003cd7a10f7fb8f843aa55789e23
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineRadarRenderer.ets
arkts
drawFilledPath
Draws the provided path in filled mode with the provided drawable. @param c @param filledPath @param drawable
protected drawFilledPath(filledPath: string, icon?: ImagePaint, fillColor?: number, fillAlpha?: number): Paint[] { if (icon != null) { icon.setX(this.mViewPortHandler.contentLeft()); icon.setY(this.mViewPortHandler.contentTop()); icon.setWidth(this.mViewPortHandler.contentRight() - this.mViewPortH...
AST#method_declaration#Left protected drawFilledPath AST#parameter_list#Left ( AST#parameter#Left filledPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left icon ? : AST#type_annotation#Left AST#primary_type#Left ImagePain...
protected drawFilledPath(filledPath: string, icon?: ImagePaint, fillColor?: number, fillAlpha?: number): Paint[] { if (icon != null) { icon.setX(this.mViewPortHandler.contentLeft()); icon.setY(this.mViewPortHandler.contentTop()); icon.setWidth(this.mViewPortHandler.contentRight() - this.mViewPortH...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/LineRadarRenderer.ets#L37-L51
5bd0c4255d305785bfeb8cab27deddd5653d5542
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
isValidDate
检查是否为有效日期 @param year 年 @param month 月(1-12) @param day 日 @returns 是否有效
static isValidDate(year: number, month: number, day: number): boolean { if (year < 1900 || year > 2100) return false; if (month < 1 || month > 12) return false; if (day < 1) return false; const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // 闰年检查 if (DateUtils.isLeapYear...
AST#method_declaration#Left static isValidDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
static isValidDate(year: number, month: number, day: number): boolean { if (year < 1900 || year > 2100) return false; if (month < 1 || month > 12) return false; if (day < 1) return false; const daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (DateUtils.isLeapYear(year) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L328-L341
e87f787ba35d583f608ad3dcfc0073c38c6cd89d
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/pages/Expenditure.ets
arkts
startEntryAbility
启动EntryAbility,跳转到支出页
startEntryAbility() { let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; // UIAbilityContext let wantInfo: Want = { deviceId: '', // deviceId为空表示本设备 bundleName: 'com.example.datasynchronization', moduleName: 'entry', // moduleName非必选 abilityName: 'EntryAb...
AST#method_declaration#Left startEntryAbility AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#q...
startEntryAbility() { let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; let wantInfo: Want = { deviceId: '', bundleName: 'com.example.datasynchronization', moduleName: 'entry', abilityName: 'EntryAbility', parameters: { info: '来...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/frame/AbilityKit/DataSynchronization/entry/src/main/ets/pages/Expenditure.ets#L142-L160
02b180be1bf92c71d524cdadf4b04f48b332f66e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/common/datasource/MovieListData.ets
arkts
Starring data
export const STARRING_DATA: Resource[] = [ $r("app.media.ic_movie_one"), $r("app.media.ic_movie_two"), $r("app.media.ic_movie_three"), $r("app.media.ic_movie_four"), $r("app.media.ic_movie_five"), $r("app.media.ic_movie_six") ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left STARRING_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#exp...
export const STARRING_DATA: Resource[] = [ $r("app.media.ic_movie_one"), $r("app.media.ic_movie_two"), $r("app.media.ic_movie_three"), $r("app.media.ic_movie_four"), $r("app.media.ic_movie_five"), $r("app.media.ic_movie_six") ];
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/datasource/MovieListData.ets#L146-L153
ccc403fc4b7c0cdf19ae5d89151d50a510d6fe60
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Checks if a zone is opened. @param zone_alias The alias of zone / window.
export function zone_opened(zone_alias: string) { let windowStorages = AppStorage.get('windowStorages') as LocalStorage[]; if (windowStorages) { // windowStorages may be undefined, if is called before any window creation for (let index = 0; index < windowStorages.length; index++) { let is_zone = windo...
AST#export_declaration#Left export AST#function_declaration#Left function zone_opened AST#parameter_list#Left ( AST#parameter#Left zone_alias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left {...
export function zone_opened(zone_alias: string) { let windowStorages = AppStorage.get('windowStorages') as LocalStorage[]; if (windowStorages) { for (let index = 0; index < windowStorages.length; index++) { let is_zone = windowStorages[index].get('is_zone') as boolean; let alias = windowStorage...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L73-L86
efe38ac6a17a28743ee511bc117fb8a613c73327
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderRepository.ets
arkts
createOrder
创建订单 @param params 创建订单参数 @returns 创建的订单信息
async createOrder(params: CreateOrderRequest): Promise<NetworkResponse<Order>> { return this.networkDataSource.createOrder(params); }
AST#method_declaration#Left async createOrder AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateOrderRequest 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...
async createOrder(params: CreateOrderRequest): Promise<NetworkResponse<Order>> { return this.networkDataSource.createOrder(params); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderRepository.ets#L74-L76
e42473aa0b01d248fe0745e7d7ed6d6caf563d6b
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/toolbox/src/main/ets/utils/FloatingWindow.ets
arkts
FloatingWindow
功能描述: 1.点击悬浮球,工具栏动效展开 2.拖拽悬浮球,悬浮球跟随手势滑动 3.长按悬浮球,禁用/启用悬浮球,不再响应/再次响应悬浮球本身的点击事件 4.点击屏幕,切换横竖屏,悬浮球根据位置等效切换 实现原理: 1.构建一个悬浮球页面作为工具栏的入口,并通过gesture接口聚合点击、长按以及拖拽手势,并在内部实现其逻辑 2.构建一个工具栏界面,通过显隐参数来保证本身展开/收回功能 3.通过zIndex将悬浮球以及工具栏放置在基本的页面之上 @param {CustomTool[]} [toolList] - 工具栏UI @param {($$: ToolTouchInterface) => void} [floatBall...
@Component export struct FloatingWindow { // 工具栏UI toolList: CustomTool[] = [ new CustomTool(wrapBuilder(tool), { x: 60, y: CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE / 2, y: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI) }), new CustomTool(wrapBuild...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FloatingWindow AST#component_body#Left { // 工具栏UI AST#property_declaration#Left toolList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CustomTool [ ] AST#array_type#Right AST#primary_type#Right ...
@Component export struct FloatingWindow { toolList: CustomTool[] = [ new CustomTool(wrapBuilder(tool), { x: 60, y: CommonConstants.MAXIMUM_DISTANCE / 2 }, { x: CommonConstants.MAXIMUM_DISTANCE / 2, y: CommonConstants.MAXIMUM_DISTANCE * Math.cos(30 / 180 * Math.PI) }), new CustomTool(wrapBuilder(tool)...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/toolbox/src/main/ets/utils/FloatingWindow.ets#L68-L208
ca03618e22158bf01b1811bfedc00849ee1b50df
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets
arkts
Constructs the file name of history index data in which history in [year, month] should be. @param year A number, the year, like 2024. @param month A number, the month, like 12. @returns A string, 'index_year_month_00_00_00_00_000.txt'
export function index_file_name_of_month(year: number, month: number) { let month_unified = month.toString(); if (month_unified.length == 1) { month_unified = '0' + month_unified; } return 'index_' + year.toString() + "_" + month_unified + '_00_00_00_00_000.txt'; }
AST#export_declaration#Left export AST#function_declaration#Left function index_file_name_of_month AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotati...
export function index_file_name_of_month(year: number, month: number) { let month_unified = month.toString(); if (month_unified.length == 1) { month_unified = '0' + month_unified; } return 'index_' + year.toString() + "_" + month_unified + '_00_00_00_00_000.txt'; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index_x_functions.ets#L303-L309
fdc654cd3a69e473a440cbf5d24d75aa8ee30672
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/DES.ets
arkts
@Author csx @DateTime 2024/3/18 10:07:03 @TODO DES @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class DES { /** * 生成3DES的对称密钥 * @returns 3DES密钥 */ static async generate3DESKey(): Promise<string> { // 获取对称密钥的二进制数据 return CryptoUtil.generateSymKey('3DES192'); } /** * 加密-ECB模式 * @param str 待加密的字符串 * @param desKey 3DES密钥 * @returns */ static async encodeECB(str: st...
AST#export_declaration#Left export AST#class_declaration#Left class DES AST#class_body#Left { /** * 生成3DES的对称密钥 * @returns 3DES密钥 */ AST#method_declaration#Left static async generate3DESKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
export class DES { static async generate3DESKey(): Promise<string> { return CryptoUtil.generateSymKey('3DES192'); } static async encodeECB(str: string, desKey: string): Promise<string> { return CryptoUtil.encodeECB(str, desKey, '3DES192', '3DES192|ECB|PKCS7', 192); } static async encod...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/DES.ets#L26-L77
8362ad44a32e78362b9237441e13f4724266f5cd
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets
arkts
CommonItemTwoRowSlider
New Slider style to two row Text Name at the top left of the slider ChangeValue at the top right of the slider @param changeValue slide to change
@Component export struct CommonItemTwoRowSlider { @Link changeValue: number; private min: number = 0; private max: number = 0; private name: ResourceStr = ''; private step: number = 1; private testId: string = 'test_colorSelect'; private vpTest: string = 'vp'; build() { Column() { Row() { ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CommonItemTwoRowSlider AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right changeValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right A...
@Component export struct CommonItemTwoRowSlider { @Link changeValue: number; private min: number = 0; private max: number = 0; private name: ResourceStr = ''; private step: number = 1; private testId: string = 'test_colorSelect'; private vpTest: string = 'vp'; build() { Column() { Row() { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/common/AttributeModificationTool.ets#L71-L114
fe0eff34803ce86dcb6f591b36c8bd5c9b3dfabd
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets
arkts
centerOnclick
云盘,书源,主题,净化点击事件
centerOnclick(value:number|string){ switch (value){ case 1: // promptAction.showToast({ // message: '请点击右上角,完成云盘登录', // duration: 1000, // }) router.pushUrl({ url: 'pages/view/myCenter/cloudDisk' }
AST#method_declaration#Left centerOnclick AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#p...
centerOnclick(value:number|string){ switch (value){ case 1: router.pushUrl({ url: 'pages/view/myCenter/cloudDisk' }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/MyCenter.ets#L184-L193
57aad0fe00ea8ba5c7de4497f7b5be7602b74525
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/textexpand/src/main/ets/utils/Model.ets
arkts
文本章节属性 @param {ResourceStr} title - 文本内容 @param {number} {maxLines} - 设置文本的最大行数 @param {ResourceStr} {fontColor} - 文本颜色 @param { Resource | number | string} {fontSize} - 文本大小 @param {number} lineHeight - 行高 @param {Resource | number | string} contraintWidth - 设置文本的行所占最大宽度
export class TextSectionAttribute { title: ResourceStr = ''; maxLines: number; fontColor: ResourceStr; fontSize: Resource | number | string; lineHeight: number; constraintWidth: Resource | number | string; constructor(title: ResourceStr = '', maxLines: number = 2, fontColor: ResourceStr = '#000', fon...
AST#export_declaration#Left export AST#class_declaration#Left class TextSectionAttribute AST#class_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; AST#property_de...
export class TextSectionAttribute { title: ResourceStr = ''; maxLines: number; fontColor: ResourceStr; fontSize: Resource | number | string; lineHeight: number; constraintWidth: Resource | number | string; constructor(title: ResourceStr = '', maxLines: number = 2, fontColor: ResourceStr = '#000', fon...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/textexpand/src/main/ets/utils/Model.ets#L40-L58
38f3acc665539f38df0a813078412799e5ec2cbd
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Sub.ets
arkts
aboutToAppear
生命周期函数,创建组件实例后,执行build渲染函数之前
aboutToAppear(): void { const params = router.getParams(); //页面参数 const data = Constants.SUB_LIST_DATA[params['type']]; this.title = data?.title || ''; this.dataSource = data?.dataSource || []; }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left params = AS...
aboutToAppear(): void { const params = router.getParams(); const data = Constants.SUB_LIST_DATA[params['type']]; this.title = data?.title || ''; this.dataSource = data?.dataSource || []; }
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Sub.ets#L14-L19
d6f1fe21463a39e075830b31815ce8c9901e5adf
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookPath.ets
arkts
get
/ 获取云端 Book Db 文件名
get fileName() : string { return this.baseName + ".sqlite.zip"; }
AST#method_declaration#Left get AST#ERROR#Left fileName AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#express...
get fileName() : string { return this.baseName + ".sqlite.zip"; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CBook/CBookPath.ets#L21-L23
6508eea68db06bf3196daf171546a00f47464c99
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
AVPlayer binding event.
export enum Events { STATE_CHANGE = 'stateChange', TIME_UPDATE = 'timeUpdate', ERROR = 'error' }
AST#export_declaration#Left export AST#enum_declaration#Left enum Events AST#enum_body#Left { AST#enum_member#Left STATE_CHANGE = AST#expression#Left 'stateChange' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left TIME_UPDATE = AST#expression#Left 'timeUpdate' AST#expression#Right AST#enum_member#Right ...
export enum Events { STATE_CHANGE = 'stateChange', TIME_UPDATE = 'timeUpdate', ERROR = 'error' }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/VideoPlayer/entry/src/main/ets/common/constants/CommonConstants.ets#L126-L130
752780186a5ddd56dda5b7ac05346dec11d5943d
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.file.RecentPhotoComponent.d.ets
arkts
The callback of onRecentPhotoClick event @typedef { function } RecentPhotoClickCallback @param { BaseItemInfo } recentPhotoInfo - The item information of recent photo @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core @atomicservice @since 12
export type RecentPhotoClickCallback = (recentPhotoInfo: BaseItemInfo) => boolean;
AST#export_declaration#Left export AST#type_declaration#Left type RecentPhotoClickCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left recentPhotoInfo : AST#type_annotation#Left AST#primary_type#Left BaseItemInfo AST#primary_type#Right AST#type_annotation#Right AST#par...
export type RecentPhotoClickCallback = (recentPhotoInfo: BaseItemInfo) => boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.RecentPhotoComponent.d.ets#L94-L94
0f70f1ac7f785e98fa57526b7167e52afb178706
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/address/AddressCard.ets
arkts
AddressCard
@file 通用收货地址卡片组件 @author Joker.X
@ComponentV2 export struct AddressCard { /** * 地址数据,为 null 时显示选择地址布局 */ @Param address: Address | null = null; /** * 卡片点击回调 */ @Param onTap: () => void = () => { }; /** * 右上角操作区域插槽,可根据场景定制 */ @BuilderParam actionSlot: CustomBuilder; /** * 是否显示底部栏,包含联系人和标签 */ @Param show...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct AddressCard AST#component_body#Left { /** * 地址数据,为 null 时显示选择地址布局 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right address : AST#type_annotation#Left AST#union_type#Left AST#prim...
@ComponentV2 export struct AddressCard { @Param address: Address | null = null; @Param onTap: () => void = () => { }; @BuilderParam actionSlot: CustomBuilder; @Param showBottomBar: boolean = true; @Param addressSelected: boolean = false; build(): void { Card({ onTap:...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/address/AddressCard.ets#L18-L219
4ee69b2154ff703d35a45d340096ec11d4bc5eed
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/WindowUtil.ets
arkts
shiftAppWindowFocus
在同应用内将窗口焦点从源窗口转移到目标窗口,仅支持应用主窗和子窗的焦点转移。 @param sourceWindowId 源窗口id,必须是获焦状态。 @param targetWindowId 目标窗口id。 @returns
static async shiftAppWindowFocus(sourceWindowId: number, targetWindowId: number): Promise<void> { return window.shiftAppWindowFocus(sourceWindowId, targetWindowId); }
AST#method_declaration#Left static async shiftAppWindowFocus AST#parameter_list#Left ( AST#parameter#Left sourceWindowId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetWindowId : AST#type_annotation#Left AST#primary...
static async shiftAppWindowFocus(sourceWindowId: number, targetWindowId: number): Promise<void> { return window.shiftAppWindowFocus(sourceWindowId, targetWindowId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WindowUtil.ets#L542-L544
ac2b14025ec3eb8be3346f7fa34f0869b5ac4763
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildThemeSettingsDialog
主题设置对话框
@Builder buildThemeSettingsDialog() { Stack() { // 遮罩层 Column() .width('100%') .height('100%') .backgroundColor('rgba(0,0,0,0.5)') .onClick(() => { this.showThemeSettings = false; }) // 对话框内容 Scroll() { Column({ space: 20 }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildThemeSettingsDialog 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 Stack ( ) AST#container_content_body#Left { // 遮罩...
@Builder buildThemeSettingsDialog() { Stack() { Column() .width('100%') .height('100%') .backgroundColor('rgba(0,0,0,0.5)') .onClick(() => { this.showThemeSettings = false; }) Scroll() { Column({ space: 20 }) { Text('🎨 主...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4719-L4861
8da4cb6d333739029e1a8508701b7b35c6abd0a6
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/CategoryListSample/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export class CommonConstants { /** * The placeholder of search component. Currently, component interfaces do not support the Resource type. * Therefore, you need to define constants. The default prompt in the search box does not support * internationalization. */ static readonly SEARCH_PLACEHOLDER = 'Se...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The placeholder of search component. Currently, component interfaces do not support the Resource type. * Therefore, you need to define constants. The default prompt in the search box does not support ...
export class CommonConstants { static readonly SEARCH_PLACEHOLDER = 'Search...'; static readonly SEARCH_FONT_FAMILY = 'serif'; static readonly SEARCH_WEIGHT: number = 10; static readonly DETAIL_PAGE = 'pages/DetailPage'; static readonly KEY_PARAM_DATA = 'data'; static readonly SCROLL_...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/CategoryListSample/entry/src/main/ets/common/constants/CommonConstants.ets#L4-L81
2c0854a6e812d2c05f6f8fe5fbdd977b395d13e3
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/MemberManager.ets
arkts
get
============================================================ MARK: - Member time
get isActive(): boolean { // 调试模式检查 if (this.isDebug() && this.debugMember) { return true; } // 检查订阅会员或礼品会员是否活跃 const subscribeActive = SubscribeManager.shared.currentItem?.isActive ?? false; // const giftActive = GiftMemberManager.shared.isActive; return subscribeActive //|| giftAc...
AST#method_declaration#Left get AST#ERROR#Left isActive AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 调试模式检查 AST#statement#Left AST#if_statement#Left if ( AST#ex...
get isActive(): boolean { if (this.isDebug() && this.debugMember) { return true; } const subscribeActive = SubscribeManager.shared.currentItem?.isActive ?? false; return subscribeActive }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/MemberManager.ets#L107-L119
8da3c43d91b78041f190d38a8989d387f82e6888
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
toggleEditMode
切换编辑模式 @returns {void} 无返回值
toggleEditMode(): void { // 清空选择状态 this.selectedSpecIds = new Set(); // 切换编辑模式 this.isEditing = !this.isEditing; }
AST#method_declaration#Left toggleEditMode AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 清空选择状态 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Le...
toggleEditMode(): void { this.selectedSpecIds = new Set(); this.isEditing = !this.isEditing; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L351-L356
9dcab1ee73fb7cc01489711d3ae3c5f1e9c81ae7
github
jerryzhou2/ArkTS-news-app.git
6dfa8631948f1def4269be5a48554b99ee64a18d
fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets
arkts
Data of popular cities in China.
export const HOT_CITY = uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.hot_city').id);
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HOT_CITY = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#non_null_assertion_expression#Left AST#express...
export const HOT_CITY = uiContext!.getHostContext()!.resourceManager.getStringArrayValueSync($r('app.strarray.hot_city').id);
https://github.com/jerryzhou2/ArkTS-news-app.git/blob/6dfa8631948f1def4269be5a48554b99ee64a18d/fluent-news-homepage-master/entry/src/main/ets/viewmodel/CityDetailData.ets#L99-L100
a445567698fc956e92f8e1ed7e396313b26446fd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
setSessionInfo
设置AVSession实例初始化数据和状态 @param {MusicModel | undefined} musicModel 歌曲数据 @returns {Promise<void>}
async setSessionInfo(musicModel?: MusicModel): Promise<void> { const resourceManager = this.bindContext!.resourceManager; const coverUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.cover!); const imageBuffer: ArrayBuffer = coverUInt8Arr.buffer as ArrayBuffer; const imageSource...
AST#method_declaration#Left async setSessionInfo AST#parameter_list#Left ( AST#parameter#Left musicModel ? : AST#type_annotation#Left AST#primary_type#Left MusicModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
async setSessionInfo(musicModel?: MusicModel): Promise<void> { const resourceManager = this.bindContext!.resourceManager; const coverUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.cover!); const imageBuffer: ArrayBuffer = coverUInt8Arr.buffer as ArrayBuffer; const imageSource...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets#L186-L225
7f4da99a3be5ceb6103f14591a552ea56fb5018c
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVRecorder/entry/src/main/ets/pages/Record.ets
arkts
startRecord
[Start start_record]
async startRecord() { if (this.avRecorder) { try { await this.avRecorder.start(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `avRecorder start error: ${JSON.stringify(err)}`); } } }
AST#method_declaration#Left async startRecord AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . avRecorder AST#member_expression#Right AST#expression...
async startRecord() { if (this.avRecorder) { try { await this.avRecorder.start(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `avRecorder start error: ${JSON.stringify(err)}`); } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVRecorder/entry/src/main/ets/pages/Record.ets#L442-L451
2d1260d0d4a520d9af4517ea8fd973a4b109e4d2
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildNotificationSettingsDialog
通知设置对话框
@Builder buildNotificationSettingsDialog() { Stack() { // 遮罩层 Column() .width('100%') .height('100%') .backgroundColor('rgba(0,0,0,0.5)') .onClick(() => { this.showNotificationSettings = false; }) // 对话框内容 Scroll() { Column({ space...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildNotificationSettingsDialog 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 Stack ( ) AST#container_content_body#Left ...
@Builder buildNotificationSettingsDialog() { Stack() { Column() .width('100%') .height('100%') .backgroundColor('rgba(0,0,0,0.5)') .onClick(() => { this.showNotificationSettings = false; }) Scroll() { Column({ space: 20 }) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4866-L5133
e3850fded279c078c6eaa6e2f1ef54cd6c478ee6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/GreetingGenerationService.ets
arkts
getGreetingTemplates
获取祝福语模板
private getGreetingTemplates(style: GreetingStyle, occasion: GreetingOccasion): string[] { const templates: Record<string, Record<string, string[]>> = { [GreetingStyle.WARM]: { [GreetingOccasion.BIRTHDAY]: [ '亲爱的{name},在这个特别的日子里,愿你被爱包围,被幸福环绕!{age_wish}希望你的每一个梦想都能实现,每一天都充满欢声笑语。{emoji}', ...
AST#method_declaration#Left private getGreetingTemplates AST#parameter_list#Left ( AST#parameter#Left style : AST#type_annotation#Left AST#primary_type#Left GreetingStyle AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left occasion : AST#type_annotation#Left AST#primary_type#Left G...
private getGreetingTemplates(style: GreetingStyle, occasion: GreetingOccasion): string[] { const templates: Record<string, Record<string, string[]>> = { [GreetingStyle.WARM]: { [GreetingOccasion.BIRTHDAY]: [ '亲爱的{name},在这个特别的日子里,愿你被爱包围,被幸福环绕!{age_wish}希望你的每一个梦想都能实现,每一天都充满欢声笑语。{emoji}', ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L397-L440
d9b1f03335408d4a53a0354a45a3103ead4b32e5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/constants/DoanloadConstants.ets
arkts
上传下载常量 任务常量
export default class TaskConstants { public static readonly TASK_MAX: number = 10; // 同时开启最大任务数 public static readonly TASK_PAUSE_MSG: number = -1; // 暂停 public static readonly TASK_RESUME_MSG: number = -2; // 继续下载 public static readonly TASK_NET_PAUSE_MSG: number = -3; // 网络异常 public static readonly ...
AST#export_declaration#Left export default AST#class_declaration#Left class TaskConstants AST#class_body#Left { AST#property_declaration#Left public static readonly TASK_MAX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 10 AST#expression#R...
export default class TaskConstants { public static readonly TASK_MAX: number = 10; public static readonly TASK_PAUSE_MSG: number = -1; public static readonly TASK_RESUME_MSG: number = -2; public static readonly TASK_NET_PAUSE_MSG: number = -3; public static readonly TASK_NET_RESUME_MSG: number = -...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/constants/DoanloadConstants.ets#L21-L32
4a25d15f41ac155b1d162686c45762ce90286906
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/AppUtils.ets
arkts
App相关工具类(使用该工具前请在UIAbility的onWindowStageCreate方法中调用AppUtil的init方法初始化)
export class AppUtils { private static context: common.UIAbilityContext //common.UIAbilityContext,上下文 private static windowStage: window.WindowStage private constructor() { } /** * 初始化方法,缓存全局变量,在UIAbility的onWindowStageCreate方法中初始化该方法。 * @param windowStage 窗口管理器 */ static init(context: common.UIAb...
AST#export_declaration#Left export AST#class_declaration#Left class AppUtils AST#class_body#Left { AST#property_declaration#Left private static 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#R...
export class AppUtils { private static context: common.UIAbilityContext private static windowStage: window.WindowStage private constructor() { } static init(context: common.UIAbilityContext, windowStage: window.WindowStage) { AppUtils.context = context AppUtils.windowStage = windowStage } ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/AppUtils.ets#L9-L190
2175b3e302e75d4a066e65c1009891931107fe8d
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/player/VHWarmPlayerView.ets
arkts
onPipStatusChange
画中画状态 @param state: 画中画播放状态
onPipStatusChange(state: VHPlayerPipState){ }
AST#method_declaration#Left onPipStatusChange AST#parameter_list#Left ( AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left VHPlayerPipState AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#...
onPipStatusChange(state: VHPlayerPipState){ }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWarmPlayerView.ets#L166-L168
233eb39500370a746769d4c8db20604ac4a5e159
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
isSameMonth
是否是同一月
static isSameMonth(selectDate: Date, date: Date): boolean { return DateHelper.isSameYear(selectDate, date) && selectDate.getMonth() == date.getMonth(); }
AST#method_declaration#Left static isSameMonth AST#parameter_list#Left ( AST#parameter#Left selectDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_ty...
static isSameMonth(selectDate: Date, date: Date): boolean { return DateHelper.isSameYear(selectDate, date) && selectDate.getMonth() == date.getMonth(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L123-L125
bceaf6afd8450cfb7249600db548f2375642945a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
getShareTemplates
获取分享模板
getShareTemplates(platform?: SharePlatform, contentType?: ShareContentType): ShareTemplate[] { let templates = [...this.shareTemplates]; if (platform) { templates = templates.filter(t => t.platform === platform || t.platform === SharePlatform.SYSTEM); } if (contentType) { templates = templ...
AST#method_declaration#Left getShareTemplates AST#parameter_list#Left ( AST#parameter#Left platform ? : AST#type_annotation#Left AST#primary_type#Left SharePlatform AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left contentType ? : AST#type_annotation#Left AST#primary_type#Left Sh...
getShareTemplates(platform?: SharePlatform, contentType?: ShareContentType): ShareTemplate[] { let templates = [...this.shareTemplates]; if (platform) { templates = templates.filter(t => t.platform === platform || t.platform === SharePlatform.SYSTEM); } if (contentType) { templates = templ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L301-L313
7d94cc754aef683cc3c78a47372d33eca8990165
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets
arkts
getImageByKey
获取对应 image_key 的图片资源,如果不存在则返回默认图片
private getImageByKey(imageKey: string): Resource { return this.imageMap[imageKey] ?? $r('app.media.img_16'); // 默认图片 }
AST#method_declaration#Left private getImageByKey AST#parameter_list#Left ( AST#parameter#Left imageKey : 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 Resource AST#pr...
private getImageByKey(imageKey: string): Resource { return this.imageMap[imageKey] ?? $r('app.media.img_16'); }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/shangpinxiangqing.ets#L87-L89
6198b7dbdc9f5091d65da1e37f932efef1fa3227
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
setAuthToken
设置认证Token
static setAuthToken(token: string): void { authToken = token; }
AST#method_declaration#Left static setAuthToken AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
static setAuthToken(token: string): void { authToken = token; }
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L243-L245
0cb88c18428125a0fe5b6e6c739854387c59fb86
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/MainPage.ets
arkts
buildQueueItem
队列项
@Builder buildQueueItem(episode: Episode, index: number) { Row() { // 序号 Text(`${index + 1}`) .fontSize(16) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.primary')) .width(28) .textAlign(TextAlign.Center) // 封面图 Image(episode.imageUrl) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildQueueItem AST#parameter_list#Left ( AST#parameter#Left episode : AST#type_annotation#Left AST#primary_type#Left Episode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#...
@Builder buildQueueItem(episode: Episode, index: number) { Row() { Text(`${index + 1}`) .fontSize(16) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.primary')) .width(28) .textAlign(TextAlign.Center) Image(episode.imageUrl) .width(4...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1141-L1217
65bc550924a47dbf21f73658f8bc125fc5600d89
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gbktranscoding/src/main/ets/pages/FriendsBook.ets
arkts
ChatContactItemView
通讯录页面中,联系人布局组件。
@Component export struct ChatContactItemView { private text: string | Resource = ''; build() { Row() { Image($r("app.media.gbk_userImage")) .width($r('app.integer.gbk_friends_page_contact_image_width')) .height($r('app.integer.gbk_friends_page_contact_image_width')) .borderRadius(...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChatContactItemView AST#component_body#Left { AST#property_declaration#Left private text : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resou...
@Component export struct ChatContactItemView { private text: string | Resource = ''; build() { Row() { Image($r("app.media.gbk_userImage")) .width($r('app.integer.gbk_friends_page_contact_image_width')) .height($r('app.integer.gbk_friends_page_contact_image_width')) .borderRadius(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gbktranscoding/src/main/ets/pages/FriendsBook.ets#L142-L165
ab508651c0c438b710b75e584e1cd26d37e83a91
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/CloudDBService.ets
arkts
saveUserInfo
保存或更新用户信息
async saveUserInfo(userInfo: CloudDBZoneObject): Promise<boolean> { try { // 模拟保存用户信息 console.log('保存用户信息:', userInfo); return true; } catch (error) { console.error('保存用户信息失败:', error); return false; } }
AST#method_declaration#Left async saveUserInfo AST#parameter_list#Left ( AST#parameter#Left userInfo : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen...
async saveUserInfo(userInfo: CloudDBZoneObject): Promise<boolean> { try { console.log('保存用户信息:', userInfo); return true; } catch (error) { console.error('保存用户信息失败:', error); return false; } }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L134-L143
71df91a1fdecfe6ca5aba51bba1e97b5ab13670b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Ability/Performance/Startup/entry/src/main/ets/pages/Index.ets
arkts
computeTaskAsync
运算任务异步处理
private computeTaskAsync(): void { setTimeout(() => { // 这里使用setTimeout来实现异步延迟运行 this.computeTask(); }, DELAYED_TIME); }
AST#method_declaration#Left private computeTaskAsync AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left setTimeout ( AST#expression#Left AST#ar...
private computeTaskAsync(): void { setTimeout(() => { this.computeTask(); }, DELAYED_TIME); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Ability/Performance/Startup/entry/src/main/ets/pages/Index.ets#L52-L56
7893267c9e19abb69c4908a55bd6094184dd1786
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/SettingsTypes.ets
arkts
通知声音配置接口
export interface NotificationSoundConfig { enabled: boolean; soundUri?: string; volume: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationSoundConfig AST#object_type#Left { AST#type_member#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left soundUri ? : AST#...
export interface NotificationSoundConfig { enabled: boolean; soundUri?: string; volume: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L292-L296
cd23309d9ae1066a52dcde12f636f7dfc035a6fe
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/customComponent.d.ets
arkts
Definition of base custom component, which is base class of custom component. @extends ExtendableComponent @implements CommonAttribute @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare abstract class BaseCustomComponent extends ExtendableComponent { /** * aboutToRecycle Method. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 20 */ aboutToRecycle(): void; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left abstract class BaseCustomComponent extends AST#type_annotation#Left AST#primary_type#Left ExtendableComponent AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * aboutToRecycle Method. ...
export declare abstract class BaseCustomComponent extends ExtendableComponent { aboutToRecycle(): void; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/customComponent.d.ets#L192-L202
a4d6719d915f772719bc389e2d0ecdaba637a7ba
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceWeb.d.ets
arkts
Message event after page is back or destroyed if postMessage() is called in H5 page. @typedef OnMessageEvent @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export declare interface OnMessageEvent { /** * The message data list. * * @type { object[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ data: object[]; }
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnMessageEvent AST#object_type#Left { /** * The message data list. * * @type { object[] } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#type_member#Le...
export declare interface OnMessageEvent { data: object[]; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L184-L194
724158c0ea4cd9fac3e2dc67af4984568b1ed149
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/downloadfilebutton/source/DownloadFileButton.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 enum DownloadIconStyle { FULL_FILLED = 1, LINES = 2 }
AST#export_declaration#Left export AST#enum_declaration#Left enum DownloadIconStyle AST#enum_body#Left { AST#enum_member#Left FULL_FILLED = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LINES = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right } AST#enum_body#Rig...
export enum DownloadIconStyle { FULL_FILLED = 1, LINES = 2 }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/downloadfilebutton/source/DownloadFileButton.ets#L16-L19
46204bd6fff3c2596bdb30b4b49487602168f714
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
feature/recents/src/main/ets/default/common/uicomponents/RecentMissionAppIcon.ets
arkts
RecentMissionAppIcon
App icon component for recent missions.
@Component export default struct RecentMissionAppIcon { @State iconSize: number = 0; @State @Watch('updateIcon') appIcon: number = 0; @State bundleName: string = ''; @State moduleName: string = ''; @State labelId: number = 0; @State icon: string = ''; @State useCache: boolean = true; private mIsSingleLa...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct RecentMissionAppIcon AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right iconSize : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Rig...
@Component export default struct RecentMissionAppIcon { @State iconSize: number = 0; @State @Watch('updateIcon') appIcon: number = 0; @State bundleName: string = ''; @State moduleName: string = ''; @State labelId: number = 0; @State icon: string = ''; @State useCache: boolean = true; private mIsSingleLa...
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/recents/src/main/ets/default/common/uicomponents/RecentMissionAppIcon.ets#L25-L60
b3ec3e5e4917bdc880acdafb03fa3d94f439f17c
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/CommunityService.ets
arkts
用户偏好接口
export interface UserPreferences { isPublic: boolean; allowMessages: boolean; allowNotifications: boolean; showBirthdays: boolean; showLocation: boolean; language: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UserPreferences AST#object_type#Left { AST#type_member#Left isPublic : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left allowMessages : AST#type...
export interface UserPreferences { isPublic: boolean; allowMessages: boolean; allowNotifications: boolean; showBirthdays: boolean; showLocation: boolean; language: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/CommunityService.ets#L49-L56
b103373d3bb0fbc92adbcb14e0e95bb27d1b44eb
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
authorizeNotification
请求通知授权,第一次调用会弹窗让用户选择。 @returns
static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> { let isEnabled = await NotificationUtils.isNotificationEnabled(); //查询通知是否授权 if (!isEnabled) { //未授权,拉起授权 try { await notificationManager.requestEnableNotification(ArkWebHelper.getContext()); callBac...
AST#method_declaration#Left static async authorizeNotification AST#parameter_list#Left ( AST#parameter#Left callBack ? : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left grant : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#...
static async authorizeNotification(callBack?: (grant: boolean) => void): Promise<boolean> { let isEnabled = await NotificationUtils.isNotificationEnabled(); if (!isEnabled) { try { await notificationManager.requestEnableNotification(ArkWebHelper.getContext()); callBack?.(true); r...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L95-L110
a0f47b8c2026ae056ae6c6e9550444a8d4c67afd
gitee
liudi25385/mybit.git
865f64ff6b2e10f5b79100064dff05e67607a5bc
entry/src/main/ets/base/BasicDataSource.ets
arkts
Basic implementation of IDataSource to handle data listener
export class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; public totalCount(): number { return 0; } public getData(index: number) { } // 该方法为框架侧调用,为LazyForEach组件向其数据源处添加listener监听 registerDataChangeListener(listener: DataChangeListener): void { if (this...
AST#export_declaration#Left export AST#class_declaration#Left class BasicDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListener ...
export class BasicDataSource implements IDataSource { private listeners: DataChangeListener[] = []; public totalCount(): number { return 0; } public getData(index: number) { } registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { con...
https://github.com/liudi25385/mybit.git/blob/865f64ff6b2e10f5b79100064dff05e67607a5bc/entry/src/main/ets/base/BasicDataSource.ets#L2-L63
c11c734ab0b4b7786186e6e73d4341ecb19ffa5b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsDetailRichImageItem.ets
arkts
GoodsDetailRichImageItem
@file 商品详情图片项组件 @author Joker.X
@ComponentV2 export struct GoodsDetailRichImageItem { /** * 商品详情图片项 */ @Param pic: string = ""; /** * 是否最后一张图片 */ @Param isLast: boolean = false; /** * 构建商品详情图片项 * @returns {void} 无返回值 */ build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsDetailRichImageItem AST#component_body#Left { /** * 商品详情图片项 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right pic : AST#type_annotation#Left AST#primary_type#Left string AST#...
@ComponentV2 export struct GoodsDetailRichImageItem { @Param pic: string = ""; @Param isLast: boolean = false; build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium")...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailRichImageItem.ets#L8-L45
9ea857ee585b5b28a8c89b92bca7b0188eda31ce
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets
arkts
createDatabase
创建数据库
createDatabase() { const options: distributedKVStore.Options = { createIfMissing: true, encrypt: false, backup: false, autoSync: false, // kvStoreType不填时,默认创建多设备协同数据库 kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION, // 多设备协同数据库:kvStoreType: distributedKVStore.KVS...
AST#method_declaration#Left createDatabase AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . Options AST...
createDatabase() { const options: distributedKVStore.Options = { createIfMissing: true, encrypt: false, backup: false, autoSync: false, kvStoreType: distributedKVStore.KVStoreType.SINGLE_VERSION, securityLevel: distributedKVStore.SecurityLevel.S1 }; if (kvMa...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/complete/ArkData/KVManagerDemo/entry/src/main/ets/database/KVManager.ets#L75-L97
254a58eab08a28f88e299d0547f6fb26b688904d
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/UserProfileComponent.ets
arkts
doLogout
退出登录
doLogout() { // 清除登录状态(使用正确的 Token key) AppStorage.setOrCreate('isLoggedIn', false); AppStorage.setOrCreate('auth_token', ''); // 正确的 key AppStorage.setOrCreate('username', ''); // 销毁子窗口并重新进入登录流程 let windowModel = WindowModel.getInstance(); windowModel.destroySubWindow(); // 重...
AST#method_declaration#Left doLogout AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 清除登录状态(使用正确的 Token key) AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AppStorage AST#expression#Ri...
doLogout() { AppStorage.setOrCreate('isLoggedIn', false); AppStorage.setOrCreate('auth_token', ''); AppStorage.setOrCreate('username', ''); let windowModel = WindowModel.getInstance(); windowModel.destroySubWindow(); windowModel.createSubWindow(); }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/UserProfileComponent.ets#L235-L247
b48eb656698734f404c148bb9fbe9d28de26f167
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/variablewatch/Index.ets
arkts
VariableWatchViewComponent
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 { VariableWatchViewComponent } from "./src/main/ets/view/VariableWatchView";
AST#export_declaration#Left export { VariableWatchViewComponent } from "./src/main/ets/view/VariableWatchView" ; AST#export_declaration#Right
export { VariableWatchViewComponent } from "./src/main/ets/view/VariableWatchView";
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/variablewatch/Index.ets#L15-L15
1b723d307461e9acbafb6065dc6be0e6b4054e7d
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
getInstance
创建单例 @returns
public static getInstance(): EfRcp { if (!EfRcp.efRcpInstance) { EfRcp.efRcpInstance = new EfRcp(); } return EfRcp.efRcpInstance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left EfRcp AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left A...
public static getInstance(): EfRcp { if (!EfRcp.efRcpInstance) { EfRcp.efRcpInstance = new EfRcp(); } return EfRcp.efRcpInstance; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L89-L94
ca6de5741d5232aee8f6486525d517b119f84e11
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
注册请求接口
export interface RegisterRequest { username: string; password: string; nickname?: string; email?: string; phone?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface RegisterRequest AST#object_type#Left { AST#type_member#Left username : 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 password : AST#type_annot...
export interface RegisterRequest { username: string; password: string; nickname?: string; email?: string; phone?: string; }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1183-L1189
74cb33b738a7685342ece6299eafb49f4d187e73
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/widgets/pages/WidgetCard2x4.ets
arkts
buildBirthdayItem
构建单个生日项
@Builder buildBirthdayItem(item: any) { Row() { // 头像 if (item.avatar) { Image(item.avatar) .width(32) .height(32) .borderRadius(16) } else { Circle({ width: 32, height: 32 }) .fill(item.isToday ? '#FF5722' : (item.isTomorrow ? '#2196F3' : ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildBirthdayItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#...
@Builder buildBirthdayItem(item: any) { Row() { if (item.avatar) { Image(item.avatar) .width(32) .height(32) .borderRadius(16) } else { Circle({ width: 32, height: 32 }) .fill(item.isToday ? '#FF5722' : (item.isTomorrow ? '#2196F3' : '#9E9...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/widgets/pages/WidgetCard2x4.ets#L99-L166
ae089a8e39f4ccf4b4fd20949c52365f43a349f7
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocache/src/main/ets/view/VideoCacheView.ets
arkts
rotateAnimation
旋转动画
rotateAnimation() { logger.info(`AVPlayManager, rotateAnimation start`); animateTo({ duration: ANIMATION_DURATION, // 动画时长 curve: Curve.Ease, // 动画曲线 iterations: -1, // 播放次数,-1为无限循环 playMode: PlayMode.Normal, // 动画模式 onFinish: () => { logger.info('AVPlayManager, play end') ...
AST#method_declaration#Left rotateAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left logger AST#expression#Right . info ...
rotateAnimation() { logger.info(`AVPlayManager, rotateAnimation start`); animateTo({ duration: ANIMATION_DURATION, curve: Curve.Ease, iterations: -1, playMode: PlayMode.Normal, onFinish: () => { logger.info('AVPlayManager, play end') } }, () => { this.ro...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocache/src/main/ets/view/VideoCacheView.ets#L84-L97
f5306798c746b810e06880ae1bdbdbd07c941a53
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionParameter.ets
arkts
initBindSheetDefault
初始化BaseSheetOptions参数 @param options
static initBindSheetDefault(options: BaseSheetOptions) { options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext(); if (options.title) { //有标题,默认显示关闭图标 options.showClose = options.showClose ?? true; //是否显示关闭图标,默认显示。 } else { //有标题,默认不显示关闭图标 options.showClose = options.showClose ??...
AST#method_declaration#Left static initBindSheetDefault AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left BaseSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_s...
static initBindSheetDefault(options: BaseSheetOptions) { options.uiContext = options.uiContext ?? DialogHelper.getMainUIContext(); if (options.title) { options.showClose = options.showClose ?? true; } else { options.showClose = options.showClose ?? false; } options.height = opti...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L558-L589
17c5c94c312c7003517e924f1196abdd86170a65
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets
arkts
contentListItemBuilder
右侧内容视图
@Builder contentListItemBuilder(item: CustomDataType, index: number) { ListItem() { Row({ space: COMPONENT_STYLE.ITEM_GUTTER }) { Text() .aspectRatio(1) .height('100%') .backgroundColor($r('sys.color.ohos_id_color_component_normal')) .borderRadius($r('sys.floa...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right contentListItemBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type...
@Builder contentListItemBuilder(item: CustomDataType, index: number) { ListItem() { Row({ space: COMPONENT_STYLE.ITEM_GUTTER }) { Text() .aspectRatio(1) .height('100%') .backgroundColor($r('sys.color.ohos_id_color_component_normal')) .borderRadius($r('sys.floa...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/SecondaryLinkExample.ets#L148-L185
28215a3c76cb15c0d11b9c3b4caad20e576257eb
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PasteboardUtil.ets
arkts
setDataTextSync
将纯文本数据写入系统剪贴板。 @param text 纯文本数据 @returns
static setDataTextSync(text: string) { PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_PLAIN, text); }
AST#method_declaration#Left static setDataTextSync AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#...
static setDataTextSync(text: string) { PasteboardUtil.setDataSync(pasteboard.MIMETYPE_TEXT_PLAIN, text); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L119-L121
89eacf4ebdcf7f5156d65e0edbc9cc475145cf66
gitee
hualinag/ymhc-tailwind.git
57295c4b00b15ba57d2ed2456deab0f8c2ee2092
src/main/ets/components/base/style/TailwindAttributeModifier.ets
arkts
对外提供工厂方法
export function tw(className: string): AttributeModifier<NodeLike> { return new TwModifier(className) }
AST#export_declaration#Left export AST#function_declaration#Left function tw AST#parameter_list#Left ( AST#parameter#Left className : 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#prima...
export function tw(className: string): AttributeModifier<NodeLike> { return new TwModifier(className) }
https://github.com/hualinag/ymhc-tailwind.git/blob/57295c4b00b15ba57d2ed2456deab0f8c2ee2092/src/main/ets/components/base/style/TailwindAttributeModifier.ets#L59-L61
3a4ae3c91246f06c4d1817255636f7983972014e
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/MessageUtil.ets
arkts
getInstance
创建单例 @returns
public static getInstance(): MessageUtil { if (!MessageUtil.instance) { MessageUtil.instance = new MessageUtil(); } return MessageUtil.instance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left MessageUtil AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#...
public static getInstance(): MessageUtil { if (!MessageUtil.instance) { MessageUtil.instance = new MessageUtil(); } return MessageUtil.instance; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L42-L47
b34b971493d52e78451b3ab5921784c3a8844732
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/dynamic_tracing/reflect_call/reflect_call_002_F.ets
arkts
Introduction 动态方法调用-反射
export function reflect_call_002_F(taint_src : string) { let _t = taint_src; class A { data: string = "_"; } let a = new A(); taint.Sink(Reflect.get(a,"data")); }
AST#export_declaration#Left export AST#function_declaration#Left function reflect_call_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function reflect_call_002_F(taint_src : string) { let _t = taint_src; class A { data: string = "_"; } let a = new A(); taint.Sink(Reflect.get(a,"data")); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/dynamic_tracing/reflect_call/reflect_call_002_F.ets#L6-L13
8887bc1019bb7a40a2466e92e9fb43e69fb3b069
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/TabInfo.ets
arkts
构建一个Tab项所需要的信息
export class TabInfo { // tab项标题(页签内容) title: string; // tab项内容 contentbuilder: WrappedBuilder<[ESObject]>; // tabBar(页签样式) barBuilder?: WrappedBuilder<[TabBarItemInterface]>; // tabBarIndex params?: ESObject /** * TabInfo构造器 * @param title - tab项标题 * @param contentBuilder - tab项内容 * @par...
AST#export_declaration#Left export AST#ERROR#Left class TabInfo { // tab项标题(页签内容) AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // tab项内容 AST#property_declaration#Left contentbuilder : AST#typ...
export class TabInfo { title: string; contentbuilder: WrappedBuilder<[ESObject]>; barBuilder?: WrappedBuilder<[TabBarItemInterface]>; params?: ESObject constructor
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/model/TabInfo.ets#L21-L37
2c452f8b2aa2ac44bb5b42bc96e0063bbeb415b1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets
arkts
get
获取单例实例
public static get shared(): CosService { return this.instance; }
AST#method_declaration#Left public static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CosService AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left re...
public static get shared(): CosService { return this.instance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CDownloadable/CosService.ets#L37-L39
06ea9e439fd44e7d4b8c36b54cfe25ed2473ab31
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showError
print error level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showError(tag: string, log: string) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left log : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig...
static showError(tag: string, log: string) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api11/entry/src/main/ets/MainAbility/common/Log.ets#L48-L50
e9c8efbbf6dec102157e8fe69866ff596b2d7f31
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
resetZoom
Zooms out to original size. @param outputMatrix
public resetZoom(outputMatrix: Matrix): void { outputMatrix.reset(); outputMatrix.set(this.mMatrixTouch); outputMatrix.postScale(1.0, 1.0, 0.0, 0.0); }
AST#method_declaration#Left public resetZoom AST#parameter_list#Left ( AST#parameter#Left outputMatrix : AST#type_annotation#Left AST#primary_type#Left Matrix 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...
public resetZoom(outputMatrix: Matrix): void { outputMatrix.reset(); outputMatrix.set(this.mMatrixTouch); outputMatrix.postScale(1.0, 1.0, 0.0, 0.0); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/ViewPortHandler.ets#L217-L221
55613e43580634395e79b8b97312ac5cfb99d2f9
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/net/wanAPI/response/ILoginRegist.ets
arkts
玩安卓登录以及注册接口响应数据类
export interface ILoginRegist { admin: boolean; chapterTops: any[]; coinCount: number; collectIds: number[]; email: string; icon: string; id: number; nickname: string; password: string; publicName: string; token: string; type: number; username: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ILoginRegist AST#object_type#Left { AST#type_member#Left admin : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left chapterTops : AST#type_annotat...
export interface ILoginRegist { admin: boolean; chapterTops: any[]; coinCount: number; collectIds: number[]; email: string; icon: string; id: number; nickname: string; password: string; publicName: string; token: string; type: number; username: string; }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/net/wanAPI/response/ILoginRegist.ets#L4-L18
550daa032e7f7023861f43d6f4e5bcf8ea338865
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/XAxis.ets
arkts
setPosition
sets the position of the x-labels @param pos
public setPosition(pos: XAxisPosition): void { this.mPosition = pos; }
AST#method_declaration#Left public setPosition AST#parameter_list#Left ( AST#parameter#Left pos : AST#type_annotation#Left AST#primary_type#Left XAxisPosition 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...
public setPosition(pos: XAxisPosition): void { this.mPosition = pos; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/XAxis.ets#L112-L114
c89917dc3a95deff4d5f6a421dd7399f18291107
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AES.ets
arkts
encodeCBC128
加密-CBC模式-128位 @param str 待加密的字符串 @param aesKey AES密钥 @param iv iv偏移量字符串 @returns
static async encodeCBC128(str: string, aesKey: string, iv: string): Promise<string> { return CryptoUtil.encodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128); }
AST#method_declaration#Left static async encodeCBC128 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 aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#prim...
static async encodeCBC128(str: string, aesKey: string, iv: string): Promise<string> { return CryptoUtil.encodeCBC(str, aesKey, iv, 'AES128', 'AES128|CBC|PKCS7', 128); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AES.ets#L126-L128
3ae10fb0a75bdabbc7e9beb093c3ec7dd03b78a9
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/efRcpConfig.ets
arkts
post/put请求所需参数对象
export class requestBaseParams extends commonParams { /** * 请求参数 post/put */ query?: Record<string, Object> | rcp.FormFields | rcp.MultipartFormFields | ESObject; /** * 解决post传参但是需要将参数拼接URL情况 */ isParams?: boolean; }
AST#export_declaration#Left export AST#class_declaration#Left class requestBaseParams extends AST#type_annotation#Left AST#primary_type#Left commonParams AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * 请求参数 post/put */ AST#property_declaration#Left query ? : AST#type_annotation#Le...
export class requestBaseParams extends commonParams { query?: Record<string, Object> | rcp.FormFields | rcp.MultipartFormFields | ESObject; isParams?: boolean; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/efRcpConfig.ets#L269-L278
92b08c035e6e7343e750c9b8903dd56d0b1c2c91
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBar.d.ets
arkts
Defines toolBar symbolGlyph options. @interface ToolBarSymbolGlyphOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 13 Defines toolBar symbolGlyph options. @interface ToolBarSymbolGlyphOptions @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 18
export interface ToolBarSymbolGlyphOptions { /** * Modifier of toolbar's normal symbol. * * @type { ?SymbolGlyphModifier } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 13 */ /** * Modifier of toolbar's normal symbol. * * @type { ?SymbolGlyphModifier } * @sy...
AST#export_declaration#Left export AST#interface_declaration#Left interface ToolBarSymbolGlyphOptions AST#object_type#Left { /** * Modifier of toolbar's normal symbol. * * @type { ?SymbolGlyphModifier } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 13 */ /** * Modifier of...
export interface ToolBarSymbolGlyphOptions { normal?: SymbolGlyphModifier; activated?: SymbolGlyphModifier; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBar.d.ets#L123-L160
1dd36a148499da59988c137ccce6c7235d528acf
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/ApplicationModels/DynamicRouter/harB/Index.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 function harInit(path: string): void{ // 动态引入要跳转的页面 switch (path) { case "./src/main/ets/components/mainpage/page1": import("./src/main/ets/components/mainpage/page1"); break; case "./src/main/ets/components/mainpage/page2": import("./src/main/ets/components/mainpage/page2"); ...
AST#export_declaration#Left export AST#function_declaration#Left function harInit AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prima...
export function harInit(path: string): void{ switch (path) { case "./src/main/ets/components/mainpage/page1": import("./src/main/ets/components/mainpage/page1"); break; case "./src/main/ets/components/mainpage/page2": import("./src/main/ets/components/mainpage/page2"); break; ca...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/harB/Index.ets#L15-L30
bb6bf9ef9dd5ec7eb0eb170b832a49c8045ae7c3
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/auth/LoginPage.ets
arkts
initUserSession
初始化用户会话
private async initUserSession() { try { this.isLoading = true; // 使用await确保初始化完成 await this.userSession.init(); // 初始化完成后,再次检查是否已登录 if (this.userSession.isLoggedIn()) { console.info('初始化完成,用户已登录,跳转到首页'); this.navigateToHome(); return; } ...
AST#method_declaration#Left private async initUserSession 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#assignment_expression#Left AST#membe...
private async initUserSession() { try { this.isLoading = true; await this.userSession.init(); if (this.userSession.isLoggedIn()) { console.info('初始化完成,用户已登录,跳转到首页'); this.navigateToHome(); return; } console.info('初始化完成,用户未登录,显示登录页面');...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/auth/LoginPage.ets#L44-L72
787b361e597c2cb36891c09c209caea3370b82fa
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/model/SwiperData.ets
arkts
轮播项信息 @param imageSrc: 图片路径(必传参数) @param name: 轮播图标题名称 @param appUri: 功能模块地址 @param param: 跳转参数
export class SwiperData { imageSrc: ResourceStr; name: ResourceStr; appUri: string; param: string; constructor(imageSrc: ResourceStr, name?: ResourceStr, appUri?: string, param?: string) { this.imageSrc = imageSrc; this.name = name === undefined ? '' : name; this.appUri = appUri === undefined ? '...
AST#export_declaration#Left export AST#class_declaration#Left class SwiperData AST#class_body#Left { AST#property_declaration#Left imageSrc : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left name : ...
export class SwiperData { imageSrc: ResourceStr; name: ResourceStr; appUri: string; param: string; constructor(imageSrc: ResourceStr, name?: ResourceStr, appUri?: string, param?: string) { this.imageSrc = imageSrc; this.name = name === undefined ? '' : name; this.appUri = appUri === undefined ? '...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/swipercomponent/src/main/ets/components/model/SwiperData.ets#L23-L35
05c1e8b269faebca776d1915358c215117381c01
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
generateKeyPair
生成非对称密钥KeyPair,异步 @param algName 待生成对称密钥生成器的算法名称(SM2_256、RSA1024|PRIMES_2、RSA2048|PRIMES_2、ECC256、等)。 @returns
static async generateKeyPair(algName: string): Promise<cryptoFramework.KeyPair> { let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); //非对称密钥生成器的对象。 let keyPair = await asyKeyGenerator.generateKeyPair() //获取该非对称密钥生成器随机生成的密钥 return keyPair; }
AST#method_declaration#Left static async generateKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : 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...
static async generateKeyPair(algName: string): Promise<cryptoFramework.KeyPair> { let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); let keyPair = await asyKeyGenerator.generateKeyPair() return keyPair; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L156-L160
64b1afafd18cb4d4d2023dacbd10a7f5d4fe99ba
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/GlobalContext.ets
arkts
remove
移除缓存
public remove(key: string) { this._objects.delete(key); }
AST#method_declaration#Left public remove AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression...
public remove(key: string) { this._objects.delete(key); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/GlobalContext.ets#L68-L70
8b1efaa30c0da290d46da052bfcd1de4d471b029
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
init
初始化,非必要不要初始化该方法 @param name Preferences实例的名称。
static init(preferenceName: string) { if (!PreferencesUtil.preferences || preferenceName !== PreferencesUtil.defaultPreferenceName) { PreferencesUtil.defaultPreferenceName = preferenceName; PreferencesUtil.preferences = dataPreferences.getPreferencesSync(AppUtil.getContext(), { name: preferenceName }); ...
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left preferenceName : 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_...
static init(preferenceName: string) { if (!PreferencesUtil.preferences || preferenceName !== PreferencesUtil.defaultPreferenceName) { PreferencesUtil.defaultPreferenceName = preferenceName; PreferencesUtil.preferences = dataPreferences.getPreferencesSync(AppUtil.getContext(), { name: preferenceName }); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L37-L42
c5ba1fd005832c2f61ded7adc781680ff7540b1e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/CalendarApiService.ets
arkts
getCompleteCalendarInfo
获取完整的日期信息(农历+节日+节气)
async getCompleteCalendarInfo(date: Date): Promise<CalendarInfo> { try { // 并行获取农历和节假日信息 const lunarInfoPromise = this.getLunarInfoFromApi(date); const holidayInfoPromise = this.getHolidayInfo(date); const lunarInfo = await lunarInfoPromise; const holidayInfo = await holidayInfoPromis...
AST#method_declaration#Left async getCompleteCalendarInfo AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_t...
async getCompleteCalendarInfo(date: Date): Promise<CalendarInfo> { try { const lunarInfoPromise = this.getLunarInfoFromApi(date); const holidayInfoPromise = this.getHolidayInfo(date); const lunarInfo = await lunarInfoPromise; const holidayInfo = await holidayInfoPromise; const...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/CalendarApiService.ets#L60-L100
6f65a813888960f73e37e1492aabfa88a3701733
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
Q1/TodoList/entry/src/main/ets/view/TodoItem.ets
arkts
TodoItem_img
图片样式函数
@Extend(Image) function TodoItem_img() { .width(30) .height(30) .objectFit(ImageFit.Contain) .margin(20) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function TodoItem_img AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . width ( AST#expression#Left 30 AST#ex...
@Extend(Image) function TodoItem_img() { .width(30) .height(30) .objectFit(ImageFit.Contain) .margin(20) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/Q1/TodoList/entry/src/main/ets/view/TodoItem.ets#L25-L30
dbaebe44deb5c0162eb8307cec0ab05b9f1894e4
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/social/SocialShareService.ets
arkts
分享模板接口
export interface ShareTemplate { id: string; name: string; platform: SharePlatform; contentType: ShareContentType; template: string; description: string; preview?: string; tags: string[]; usageCount: number; rating: number; createdAt: string; updatedAt: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ShareTemplate AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left A...
export interface ShareTemplate { id: string; name: string; platform: SharePlatform; contentType: ShareContentType; template: string; description: string; preview?: string; tags: string[]; usageCount: number; rating: number; createdAt: string; updatedAt: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/social/SocialShareService.ets#L67-L80
bcb14379ee33a8c715e35c75694666f396155079
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildIntegrationsUpdate.ets
arkts
应用约束61: 使用export default代替module.exports
export default GuildIntegrationsHandler;
AST#export_declaration#Left export default AST#expression#Left GuildIntegrationsHandler AST#expression#Right ; AST#export_declaration#Right
export default GuildIntegrationsHandler;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildIntegrationsUpdate.ets#L25-L25
adb11c2e4bf5f7e4be5456df1dcc9e6ef3b9541a
github