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
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets
arkts
getPersonInfo
获取个人信息 @returns {Promise<NetworkResponse<User>>} 个人信息
async getPersonInfo(): Promise<NetworkResponse<User>> { const resp: AxiosResponse<NetworkResponse<User>> = await NetworkClient.http.get("user/info/person"); return resp.data; }
AST#method_declaration#Left async getPersonInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST...
async getPersonInfo(): Promise<NetworkResponse<User>> { const resp: AxiosResponse<NetworkResponse<User>> = await NetworkClient.http.get("user/info/person"); return resp.data; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets#L15-L19
3fedfbf3adb782ce07edde2aa03c417cc49053a9
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
arkts
handoverChangeListen
[End network_weak] [Start handover_change_listen]
handoverChangeListen() { try { netHandover.on('handoverChange', (info: netHandover.HandoverInfo) => { if (info.handoverStart) { // Connection migration start callback. The application adjusts the data transmission policy based on the suggestions of HandoverStart. hilog.info(0x0000,...
AST#method_declaration#Left handoverChangeListen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#...
handoverChangeListen() { try { netHandover.on('handoverChange', (info: netHandover.HandoverInfo) => { if (info.handoverStart) { hilog.info(0x0000, 'Sample', 'handover start'); } else if (info.handoverComplete) { hilog.info(0x0000, 'Sample', 'handover c...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L233-L248
23f58b9c024dffbc0f2b90a1a6f0d932802904cc
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/service/DownloadService.ets
arkts
resumeDownload
恢复下载
async resumeDownload(episodeId: string): Promise<void> { try { const task = this.downloadTasks.get(episodeId); if (task) { await task.downloadTask.restore(); task.isPaused = false; } } catch (error) { console.error('Failed to resume download:', error); } }
AST#method_declaration#Left async resumeDownload AST#parameter_list#Left ( AST#parameter#Left episodeId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async resumeDownload(episodeId: string): Promise<void> { try { const task = this.downloadTasks.get(episodeId); if (task) { await task.downloadTask.restore(); task.isPaused = false; } } catch (error) { console.error('Failed to resume download:', error); } }
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/DownloadService.ets#L206-L216
cb63865d666cef44762229b49db40b2987f45bf2
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets
arkts
readFileToText
读取文本文件
readFileToText(path: string): string { try { if (!fs.accessSync(path)) { return '' } let stat = fs.statSync(path); let text = fs.readTextSync(path, { offset: 0, length: stat.size }); return text; } catch (e) { DMPLogger.e('e=' + e.toString()) return '' } }
AST#method_declaration#Left readFileToText AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
readFileToText(path: string): string { try { if (!fs.accessSync(path)) { return '' } let stat = fs.statSync(path); let text = fs.readTextSync(path, { offset: 0, length: stat.size }); return text; } catch (e) { DMPLogger.e('e=' + e.toString()) return '' } }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Util/DMPFileManager.ets#L250-L262
11dabd78f0bbe08fcf6037fdf24214fc3af61a15
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/NetworkListDemoPage.ets
arkts
NetworkListDemoItem
渲染列表项 @param {Goods} item - 列表项数据 @returns {void} 无返回值
@Builder private NetworkListDemoItem(item: Goods) { IBestCard({ shadowRadius: 0 }) { IBestCell({ title: item.title, label: item.subTitle ?? "", isLink: false, hasBorder: false, leftContentWidth: P100 }); } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private NetworkListDemoItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Goods AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_fu...
@Builder private NetworkListDemoItem(item: Goods) { IBestCard({ shadowRadius: 0 }) { IBestCell({ title: item.title, label: item.subTitle ?? "", isLink: false, hasBorder: false, leftContentWidth: P100 }); } }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NetworkListDemoPage.ets#L70-L81
de66ebbac4d5e1db4b9355128629136263a8bbb9
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
afterDays
创建日期之后n天的日期
static afterDays(days: number): CustomDate { const newDate = new CustomDate(); const tempDate = new Date(); tempDate.setDate(tempDate.getDate() + days); newDate.date.year = tempDate.getFullYear(); newDate.date.month = tempDate.getMonth() + 1; newDate.date.day = tempDate.getDate(); return new...
AST#method_declaration#Left static afterDays AST#parameter_list#Left ( AST#parameter#Left days : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CustomDate AST#primary_t...
static afterDays(days: number): CustomDate { const newDate = new CustomDate(); const tempDate = new Date(); tempDate.setDate(tempDate.getDate() + days); newDate.date.year = tempDate.getFullYear(); newDate.date.month = tempDate.getMonth() + 1; newDate.date.day = tempDate.getDate(); return new...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L190-L198
6ec7c119fb6f99365cea15f5ac7541ae1474eb56
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
stopAllNetObserve
停止所有网络监听
public stopAllNetObserve() { emitter.off(this.getEmitterEvent().eventId); this.connectionMap.forEach((netConnection: connection.NetConnection, netType: connection.NetBearType) => { netConnection.unregister(() => { logger.info("Success unregister:" + netType.toString()); }); }) }
AST#method_declaration#Left public stopAllNetObserve AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left emitter AST#expression#Right . off AST#...
public stopAllNetObserve() { emitter.off(this.getEmitterEvent().eventId); this.connectionMap.forEach((netConnection: connection.NetConnection, netType: connection.NetBearType) => { netConnection.unregister(() => { logger.info("Success unregister:" + netType.toString()); }); }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L119-L126
3beeb78085d883e64c6d807970f7d97bd8649586
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentinstancesharedinpages/src/main/ets/pages/MainPage.ets
arkts
MainPageComponent
整个页面使用Scroll作为容器,实现页面内容滑动,Scroll中第一个组件设置为透明,并设置页面的事件穿透,用于显示和操作下层地图组件
@Component @Preview export struct MainPageComponent { @State transParentInitHeight: number = 0; @State pageHeight: number = 0; @Consume pageStackForComponentSharedPages: NavPathStack; // 用于调整下层地图组件和上层内容的手势响应区域,跟scroll的currentOffset相关 @Consume mapResponseRegionHeight: number; private scrollCurOffset: number ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right AST#decorator#Left @ Preview AST#decorator#Right export struct MainPageComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right transParentInitHeight : AST#type_annotation#Lef...
@Component @Preview export struct MainPageComponent { @State transParentInitHeight: number = 0; @State pageHeight: number = 0; @Consume pageStackForComponentSharedPages: NavPathStack; @Consume mapResponseRegionHeight: number; private scrollCurOffset: number = 0; private scroller: Scroller = new Scroller(...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentinstancesharedinpages/src/main/ets/pages/MainPage.ets#L21-L105
ce55c5e365c2f6d95d2fb84fafd20db3419af89c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringDealUtility.ets
arkts
removedDuplications
/ 去重(默认分隔符)
public static removedDuplications(srcStr: string): string | null { return StringDealUtility.removedDuplicationsBySep( srcStr, Constants.TitleTextJp.wordsSperator, Constants.TitleTextJp.wordsSubSperator ); }
AST#method_declaration#Left public static removedDuplications AST#parameter_list#Left ( AST#parameter#Left srcStr : 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#union_type#Left AST#pri...
public static removedDuplications(srcStr: string): string | null { return StringDealUtility.removedDuplicationsBySep( srcStr, Constants.TitleTextJp.wordsSperator, Constants.TitleTextJp.wordsSubSperator ); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringDealUtility.ets#L56-L62
c5341bfc2e00a2d2012d93588439b065d1928f1a
github
kaikaiGit/chatAI.git
2a9244d932d3463125dc9f83bf424a1e1153cb2c
entry/src/main/models/XunFeiAI.ets
arkts
AI对话API的响应体类型
export interface XunFeiResponse { code: number, message: string, sid: string, choices: Array<ResponseChoices>, usage: TokenUsage, }
AST#export_declaration#Left export AST#interface_declaration#Left interface XunFeiResponse AST#object_type#Left { AST#type_member#Left code : 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 message : AST#type_annotation#...
export interface XunFeiResponse { code: number, message: string, sid: string, choices: Array<ResponseChoices>, usage: TokenUsage, }
https://github.com/kaikaiGit/chatAI.git/blob/2a9244d932d3463125dc9f83bf424a1e1153cb2c/entry/src/main/models/XunFeiAI.ets#L10-L16
faa53c1776381981f0e7ca70850732404c82aa87
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets
arkts
this
设置不绘制柱状图的柱体阴影背景
this.model.setDrawBarShadow(false);
AST#method_declaration#Left this AST#ERROR#Left . model . setDrawBarShadow AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right
this.model.setDrawBarShadow(false);
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L135-L135
03ee8a93d1dd51344d380052aef3e7b9ffe9e9fb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIService.ets
arkts
setModelConfig
设置模型配置
async setModelConfig(config: AIModelConfig): Promise<void> { const index = this.modelConfigs.findIndex(c => c.id === config.id); if (index >= 0) { this.modelConfigs[index] = { ...config, updatedAt: new Date().toISOString() }; } else { this.modelConfigs.push(config); } if (config.isDefau...
AST#method_declaration#Left async setModelConfig AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left AIModelConfig 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...
async setModelConfig(config: AIModelConfig): Promise<void> { const index = this.modelConfigs.findIndex(c => c.id === config.id); if (index >= 0) { this.modelConfigs[index] = { ...config, updatedAt: new Date().toISOString() }; } else { this.modelConfigs.push(config); } if (config.isDefau...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIService.ets#L110-L129
0eb179388da3f2ec7cfeba140ede957ed1ac3128
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/an0n-chat-lib/0.1.5/package/build/service/leveldb.ets
arkts
显式初始化属性 (约束18)
constructor(name: string, directory: string) { super(name, directory); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left directory : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
constructor(name: string, directory: string) { super(name, directory); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/service/leveldb.ets#L20-L22
3d553c89d1265372bf5f90c25fb7c1afef459d0e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/AIAssistantService.ets
arkts
消息类型枚举
export enum MessageType { TEXT = 'text', IMAGE = 'image', AUDIO = 'audio', VIDEO = 'video', CARD = 'card', ACTION = 'action', SUGGESTION = 'suggestion', GREETING = 'greeting', REMINDER = 'reminder' }
AST#export_declaration#Left export AST#enum_declaration#Left enum MessageType AST#enum_body#Left { AST#enum_member#Left TEXT = AST#expression#Left 'text' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left IMAGE = AST#expression#Left 'image' AST#expression#Right AST#enum_member#Right , AST#enum_member#Lef...
export enum MessageType { TEXT = 'text', IMAGE = 'image', AUDIO = 'audio', VIDEO = 'video', CARD = 'card', ACTION = 'action', SUGGESTION = 'suggestion', GREETING = 'greeting', REMINDER = 'reminder' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L33-L43
acaa9694f9818c4852246d9e171d9238d255a244
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
manualCompression
手动压缩
manualCompression() { // TODO 知识点:手动压缩图片。先获取从图库选择的图片uris,然后将图片数据读取到buffer。通过createImageSource(buffer)创建图片源实例,设置解码参数DecodingOptions,传入createPixelMap创建PixelMap图片对象originalPixelMap。使用scale进行图片尺寸压缩,使用packing进行图片质量压缩。 const ALBUM_PATH: string = this.uris[0]; const file = fs.openSync(ALBUM_PATH, fs.OpenMode.READ_...
AST#method_declaration#Left manualCompression AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // TODO 知识点:手动压缩图片。先获取从图库选择的图片uris,然后将图片数据读取到buffer。通过createImageSource(buffer)创建图片源实例,设置解码参数DecodingOptions,传入createPixelMap创建PixelMap图片对象originalPixelMap。使用scale进行图片尺寸压缩,使用packing进行图片质量压缩。 AST...
manualCompression() { const ALBUM_PATH: string = this.uris[0]; const file = fs.openSync(ALBUM_PATH, fs.OpenMode.READ_ONLY); let buffer = new ArrayBuffer(fs.statSync(file.fd).size); fs.readSync(file.fd, buffer); fs.closeSync(file); const decodingOptions: image.DecodingOptions = { editable: t...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L198-L228
c2262bd87f646710a69baf6a4ec328583fedb6c7
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/style/IDialogStyle.ets
arkts
弹窗基础样式
export interface IDialogStyle { /** * 设置弹窗的内边距 * @default 0 */ padding?: Padding | Length // themeColorMode: ThemeColorMode /** * 设置弹窗的高度; * 大部分弹框都是自适应高度,无需设置该值。 */ height?: Dimension | Length; /** * 设置弹窗的宽度 * 弹窗宽度默认值:'calc(100% - 32vp)'、100%。 */ width?: Dimension | Length; ...
AST#export_declaration#Left export AST#interface_declaration#Left interface IDialogStyle AST#object_type#Left { /** * 设置弹窗的内边距 * @default 0 */ AST#type_member#Left padding ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Padding AST#primary_type#Right | AST#primary_type#Left Length AST#pr...
export interface IDialogStyle { padding?: Padding | Length height?: Dimension | Length; width?: Dimension | Length; maxHeight?: Dimension | Length; maxWidth?: Length; backgroundColor?: ResourceColor; backgroundBlurStyle?: BlurStyle; borderRadius?: Length | BorderRadiuses...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/IDialogStyle.ets#L6-L65
7b725c949bb1c772715d193dc7dbfd5f95b10684
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/MePage.ets
arkts
buildMenuGroup
构建菜单分组 @param {MeMenuItem[]} menus - 菜单列表 @returns {void} 无返回值
@Builder private buildMenuGroup(menus: MeMenuItem[]): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { ForEach(menus, (item: MeMenuItem): void => { IBestCell({ leftIcon: item.icon, leftIconColor: item.iconColor,...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildMenuGroup AST#parameter_list#Left ( AST#parameter#Left menus : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MeMenuItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#R...
@Builder private buildMenuGroup(menus: MeMenuItem[]): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { ForEach(menus, (item: MeMenuItem): void => { IBestCell({ leftIcon: item.icon, leftIconColor: item.iconColor,...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/MePage.ets#L462-L482
11f8df6e9d160ecb13e416fdb91fe35dd53cc8ee
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/ContactsPage.ets
arkts
aboutToAppear
页面生命周期 - 即将出现
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage aboutToAppear'); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `DatabaseService instance initialized`); this.loadContacts(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hilog AST#expression#Right . info AST#member_expre...
aboutToAppear() { hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'ContactsPage aboutToAppear'); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `DatabaseService instance initialized`); this.loadContacts(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ContactsPage.ets#L38-L42
bfdef494149ae09330be27b4c8576f3cdffc6cc1
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/component/OrderButtons.ets
arkts
OrderButtons
@file 订单操作按钮组件 @author Joker.X
@ComponentV2 export struct OrderButtons { /** * 订单数据 */ @Param order: Order = new Order(); /** * 取消订单按钮点击回调 */ @Param onCancelClick: () => void = () => { }; /** * 去支付按钮点击回调 */ @Param onPayClick: () => void = () => { }; /** * 退款/售后按钮点击回调 */ @Param onRefundClick: () => ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderButtons AST#component_body#Left { /** * 订单数据 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#R...
@ComponentV2 export struct OrderButtons { @Param order: Order = new Order(); @Param onCancelClick: () => void = () => { }; @Param onPayClick: () => void = () => { }; @Param onRefundClick: () => void = () => { }; @Param onConfirmClick: () => void = () => { }; @Param onLo...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/component/OrderButtons.ets#L9-L121
734cf4f393f6ec3132efc5927425dff7775b767e
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/AppState.ets
arkts
initStorage
初始化存储
private async initStorage() { try { const context = getContext() as Context; // 修正:创建完整文件路径 const filePath = `${context.filesDir}/userData.json`; // 使用文件路径而非目录 this.storage = await dataStorage.getStorage(filePath); await this.loadFromStorage(); // 设置存储就绪标志 this.isSt...
AST#method_declaration#Left private async initStorage 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#variable_declaration#Left const AST#variable_declarator#Left context = AST#expression#Left...
private async initStorage() { try { const context = getContext() as Context; const filePath = `${context.filesDir}/userData.json`; this.storage = await dataStorage.getStorage(filePath); await this.loadFromStorage(); this.isStorageReady = true; } catch (error)...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/AppState.ets#L37-L53
e50bcf9536bad422571cd87f20e5311292ec1849
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
common font weight
export const COMMON_FONT_WEIGHT: number = 500;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMON_FONT_WEIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 500 AST#expression#Right AST#variable_declarator#Right ; AST#variable_decl...
export const COMMON_FONT_WEIGHT: number = 500;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L64-L64
8de711cad46de16b134a2da730b42920065225e0
gitee
YShelter/Accouting_ArkTS.git
8c663c85f2c11738d4eabf269c23dc1ec84eb013
entry/src/main/ets/view/HomeComponent.ets
arkts
HomeIndex
主页界面设置
@Component export default struct HomeIndex { @State naviAlpha: number = 0; // @Link homeStore: HomeStore; @StorageLink('homeStore') homeStore: HomeStore = new HomeStore(new Date()); @Link addAccountingInfo: AccountingInfo; @Link @Watch('accountingAdded') editAccountingID: string; private scroller: Scroller ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct HomeIndex AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right naviAlpha : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#typ...
@Component export default struct HomeIndex { @State naviAlpha: number = 0; @StorageLink('homeStore') homeStore: HomeStore = new HomeStore(new Date()); @Link addAccountingInfo: AccountingInfo; @Link @Watch('accountingAdded') editAccountingID: string; private scroller: Scroller = new Scroller(); private yO...
https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/HomeComponent.ets#L38-L163
a06c2b3d28cfd9667fd388c96443d17a40a4f5cd
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/ShareUtils.ets
arkts
systemShare
启动系统分享面板 @param data
private static systemShare(data: systemShare.SharedData): Promise<boolean> { return new Promise<boolean>((resolve) => { let controller: systemShare.ShareController = new systemShare.ShareController(data) let context: common.UIAbilityContext = getContext() as common.UIAbilityContext let callback ...
AST#method_declaration#Left private static systemShare AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left systemShare . SharedData AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri...
private static systemShare(data: systemShare.SharedData): Promise<boolean> { return new Promise<boolean>((resolve) => { let controller: systemShare.ShareController = new systemShare.ShareController(data) let context: common.UIAbilityContext = getContext() as common.UIAbilityContext let callback ...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/ShareUtils.ets#L67-L84
eca15f86ffb21fbb12b568d0b1a4e8baf6de4ef5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
truncateSync
截断文件,以同步方法。 @param file string|number 文件的应用沙箱路径或已打开的文件描述符fd。 @param len number 文件截断后的长度,以字节为单位。默认为0。 @returns
static truncateSync(file: string | number, len: number = 0) { fs.truncateSync(file, len) }
AST#method_declaration#Left static truncateSync AST#parameter_list#Left ( AST#parameter#Left file : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , ...
static truncateSync(file: string | number, len: number = 0) { fs.truncateSync(file, len) }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L707-L709
32298920aa2a32d577a0fe23326fd2ffad63a71b
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/common/GlobalThemeState.ets
arkts
全局主题状态观察者
export class GlobalThemeState { private static instance: GlobalThemeState; private themeVersion: number = 0; private listeners: Array<(version: number) => void> = []; private constructor() { // 注册全局主题变化监听 console.log('GlobalThemeState: 注册全局主题变化监听'); AppThemeManager.addGlobalThemeChangeCallback(() =...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalThemeState AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left GlobalThemeState AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#propert...
export class GlobalThemeState { private static instance: GlobalThemeState; private themeVersion: number = 0; private listeners: Array<(version: number) => void> = []; private constructor() { console.log('GlobalThemeState: 注册全局主题变化监听'); AppThemeManager.addGlobalThemeChangeCallback(() => { con...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/GlobalThemeState.ets#L5-L62
6038e296b0187e16027d93ae426b3a68d5993ea7
github
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets
arkts
onSelect
图片/视频被选中的回调,返回的url只有只读权限,不能用url直接去打开
private onSelect(uri: string): void { if (uri) { this.selectedUris.push(uri) } // 将uri保存起来,并保证切换不同的宫格页组件时保持选中项一致 this.pickerOptions.preselectedUris = [...this.selectedUris]; this.selectedMediaCount = this.selectedUris.length; console.info('onSelect' + JSON.stringify(this.selectedUris)); ...
AST#method_declaration#Left private onSelect AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
private onSelect(uri: string): void { if (uri) { this.selectedUris.push(uri) } this.pickerOptions.preselectedUris = [...this.selectedUris]; this.selectedMediaCount = this.selectedUris.length; console.info('onSelect' + JSON.stringify(this.selectedUris)); }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets#L144-L152
180ee06d886bbff73dd590ea069fd72b044fc895
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
createNodeByNodeParam
TreeViewNodeItemFactory create node by node parameter @param nodeParam node parameter @returns NodeItemView
public createNodeByNodeParam(nodeParam: NodeParam): NodeItemView { let nodeItemView: NodeItemView = this.createNode(); if (nodeParam.icon) { nodeItemView.imageNode = new ImageNode( nodeParam.icon, nodeParam.symbolIconStyle, $r('sys.float.ohos_id_alpha_content_fourth'), IMAG...
AST#method_declaration#Left public createNodeByNodeParam AST#parameter_list#Left ( AST#parameter#Left nodeParam : AST#type_annotation#Left AST#primary_type#Left NodeParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Node...
public createNodeByNodeParam(nodeParam: NodeParam): NodeItemView { let nodeItemView: NodeItemView = this.createNode(); if (nodeParam.icon) { nodeItemView.imageNode = new ImageNode( nodeParam.icon, nodeParam.symbolIconStyle, $r('sys.float.ohos_id_alpha_content_fourth'), IMAG...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L320-L339
178198e4a8d1e8d9899ad2c2de0c4e85809c26e2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
disableBluetooth
关闭蓝牙功能
disableBluetooth() { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
AST#method_declaration#Left disableBluetooth 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 Log AST#expression#Right . showInf...
disableBluetooth() { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L69-L77
d236e827aa9db2a6cab29d4ee2d13c1b1c965626
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/NotificationUtils.ets
arkts
publishMultiLine
发布多文本通知 @param options 通知实体 @returns
static async publishMultiLine(options: NotificationMultiLineOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtils.generateNotificationId(); //通知ID。 const multiLineContent: notificationManager.NotificationMultiLineContent = { title: options.title, text: options.te...
AST#method_declaration#Left static async publishMultiLine AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left NotificationMultiLineOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
static async publishMultiLine(options: NotificationMultiLineOptions): Promise<number> { const notificationId: number = options.id ?? NotificationUtils.generateNotificationId(); const multiLineContent: notificationManager.NotificationMultiLineContent = { title: options.title, text: options.text, ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/NotificationUtils.ets#L196-L219
3679986be712598541eb74f48877065428b8717f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/GreetingHistoryDAO.ets
arkts
祝福历史数据访问对象 负责祝福历史表的所有CRUD操作
export class GreetingHistoryDAO { private dbManager: DatabaseManager; constructor() { this.dbManager = DatabaseManager.getInstance(); } /** * 插入新祝福记录 * @param greetingHistory 祝福历史实体 * @returns 插入的记录ID */ async insertGreetingHistory(greetingHistory: GreetingHistoryEntity): Promise<number> { ...
AST#export_declaration#Left export AST#class_declaration#Left class GreetingHistoryDAO AST#class_body#Left { AST#property_declaration#Left private dbManager : AST#type_annotation#Left AST#primary_type#Left DatabaseManager AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#constructor_...
export class GreetingHistoryDAO { private dbManager: DatabaseManager; constructor() { this.dbManager = DatabaseManager.getInstance(); } async insertGreetingHistory(greetingHistory: GreetingHistoryEntity): Promise<number> { const rdbStore = this.dbManager.getRdbStore(); if (!rdbStore) { th...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/GreetingHistoryDAO.ets#L51-L148
1dc2e7d352d0349c786cf3cbb3be13579dc5fabd
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildRolesPositionUpdate.ets
arkts
应用约束60: 使用export default代替module.exports
export default GuildRolesPositionUpdate;
AST#export_declaration#Left export default AST#expression#Left GuildRolesPositionUpdate AST#expression#Right ; AST#export_declaration#Right
export default GuildRolesPositionUpdate;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildRolesPositionUpdate.ets#L23-L23
fe076eb785c4e46a20c53e52d1dc58372df32275
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/live/LiveManager.ets
arkts
toggleMute
静音/取消静音
toggleMute(): void { this.liveStatus.isMuted = !this.liveStatus.isMuted; EventBus.emit('LIVE_MUTE_CHANGED', { muted: this.liveStatus.isMuted }); Logger.info('LiveManager', `Mute toggled: ${this.liveStatus.isMuted}`); }
AST#method_declaration#Left toggleMute 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#Left AST#member_...
toggleMute(): void { this.liveStatus.isMuted = !this.liveStatus.isMuted; EventBus.emit('LIVE_MUTE_CHANGED', { muted: this.liveStatus.isMuted }); Logger.info('LiveManager', `Mute toggled: ${this.liveStatus.isMuted}`); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L132-L136
50f429368bfb59901a88bd8f9c22ad4ea0aed088
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
TODO 键值型数据库工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class KvUtil { private static kvStore: distributedKVStore.SingleKVStore; //KVStore数据库实例 /** * 获取KVStore数据库 * @returns */ private static async getKvStore(): Promise<distributedKVStore.SingleKVStore> { if (!KvUtil.kvStore) { const kvManager = distributedKVStore.createKVManager({ ...
AST#export_declaration#Left export AST#class_declaration#Left class KvUtil AST#class_body#Left { AST#property_declaration#Left private static kvStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left distributedKVStore . SingleKVStore AST#qualified_type#Right AST#primary_type#Right AST#type_annot...
export class KvUtil { private static kvStore: distributedKVStore.SingleKVStore; private static async getKvStore(): Promise<distributedKVStore.SingleKVStore> { if (!KvUtil.kvStore) { const kvManager = distributedKVStore.createKVManager({ context: AppUtil.getContext(), bundleName: App...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L26-L221
ceb5ebadfc66d96925842343b907057709bca39a
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Async.ets
arkts
decryptMessagePromise
解密消息
async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('RSA1024|PKCS1'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); let decryptData = await decoder.doFinal(cipherText); return...
AST#function_declaration#Left async function decryptMessagePromise AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . PriKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST...
async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { let decoder = cryptoFramework.createCipher('RSA1024|PKCS1'); await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); let decryptData = await decoder.doFinal(cipherText); return...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1/RSAPKCS1Async.ets#L28-L33
83a28bfb33526071921d960f6b04bff336a10823
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LLMConfigPage.ets
arkts
loadCurrentConfig
加载当前配置
private loadCurrentConfig(): void { const currentConfig = this.llmService.getConfig(); if (currentConfig) { this.selectedProvider = currentConfig.provider; this.apiKey = currentConfig.apiKey; this.baseUrl = currentConfig.baseUrl || ''; this.model = currentConfig.model || ''; this.m...
AST#method_declaration#Left private loadCurrentConfig 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...
private loadCurrentConfig(): void { const currentConfig = this.llmService.getConfig(); if (currentConfig) { this.selectedProvider = currentConfig.provider; this.apiKey = currentConfig.apiKey; this.baseUrl = currentConfig.baseUrl || ''; this.model = currentConfig.model || ''; this.m...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LLMConfigPage.ets#L50-L60
d85b6b9ac8adea42ca08dd70740cccc57a53a118
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets
arkts
getDLPFile
获取dlp文件的uri和访问时间
async getDLPFile(): Promise<void> { try { let info: Array<dlpPermission.AccessedDLPFileInfo> = await dlpPermission.getDLPFileAccessRecords(); // 获取DLP访问列表 promptAction.showToast({ message: "getDLPFile:" + decodeURIComponent(JSON.stringify(info)), duration: 2000 }); Logger.info(TAG, 'getDLPFile:', ...
AST#method_declaration#Left async getDLPFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
async getDLPFile(): Promise<void> { try { let info: Array<dlpPermission.AccessedDLPFileInfo> = await dlpPermission.getDLPFileAccessRecords(); promptAction.showToast({ message: "getDLPFile:" + decodeURIComponent(JSON.stringify(info)), duration: 2000 }); Logger.info(TAG, 'getDLPFile:', JSON.stringi...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/pages/Index.ets#L219-L227
a2adf1b4b61b6098244a4cb98a5b92c40ae6fcfd
gitee
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_RouteManagement/ace_ets_module_RouteManagement_api11/entry/src/main/ets/MainAbility/pages/Router/pageC.ets
arkts
@State page:RouterState = {index:1}
build() { Row() { Column() { Text('我是C') .fontSize(20) .fontWeight(FontWeight.Bold) Text('' + router.getState()['name']).id('name_C') Text('' + router.getLength()).id('length_C') } .width('100%') } .height('100%') }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Row() { Column() { Text('我是C') .fontSize(20) .fontWeight(FontWeight.Bold) Text('' + router.getState()['name']).id('name_C') Text('' + router.getLength()).id('length_C') } .width('100%') } .height('100%') }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_RouteManagement/ace_ets_module_RouteManagement_api11/entry/src/main/ets/MainAbility/pages/Router/pageC.ets#L21-L34
c396f3749a5dc61131bdc81c6e54520be422ddbd
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/view/AvatarComponent.ets
arkts
schedulePoseChange
随机换姿势 - 让猫咪"自己生活",像真猫一样偶尔动一下
private schedulePoseChange() { clearTimeout(this.poseTimer); // 随机 15-40 秒换一次姿势(像真猫一样,大部分时间是静止的) const nextChange = Math.floor(Math.random() * 25000) + 15000; this.poseTimer = setTimeout(() => { this.changePoseWithTransition(); this.schedulePoseChange(); }, nextChange); }
AST#method_declaration#Left private schedulePoseChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left clearTimeout ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . poseTimer AST#member_expressio...
private schedulePoseChange() { clearTimeout(this.poseTimer); const nextChange = Math.floor(Math.random() * 25000) + 15000; this.poseTimer = setTimeout(() => { this.changePoseWithTransition(); this.schedulePoseChange(); }, nextChange); }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/view/AvatarComponent.ets#L269-L277
f9b12c2f98430dafaa2f711f1088546d77869df9
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/an0n-chat-lib/0.1.5/package/build/service/leveldb.ets
arkts
extractTokens
添加extractTokens方法声明
private extractTokens(content: string): string[] { // 实现令牌提取逻辑 return []; }
AST#method_declaration#Left private extractTokens AST#parameter_list#Left ( AST#parameter#Left content : 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#array_type#L...
private extractTokens(content: string): string[] { return []; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/service/leveldb.ets#L58-L61
03248aa9898be311841d8aba1d97f372b462943e
github
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/SessionModel.ets
arkts
用于初始化SessionData的数组
export function getSessionDatas(): Array<SessionData> { let sessionsDataArray: Array<SessionData> = [] SessionsComposition.forEach(item => { sessionsDataArray.push(new SessionData(item.wid , item.headImg , item.name , item.lastMsg , item.unReadmsg)) }) sessionsDataArray.forEach(item =>{ console.log( ...
AST#export_declaration#Left export AST#function_declaration#Left function getSessionDatas AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left SessionData AST#primary_typ...
export function getSessionDatas(): Array<SessionData> { let sessionsDataArray: Array<SessionData> = [] SessionsComposition.forEach(item => { sessionsDataArray.push(new SessionData(item.wid , item.headImg , item.name , item.lastMsg , item.unReadmsg)) }) sessionsDataArray.forEach(item =>{ console.log( ...
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/SessionModel.ets#L11-L25
f7f5d0362b6bb8c53d2af5ced2571bc6ac0d0191
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/arkui/component/gesture.d.ets
arkts
Defines SwipeGesture. @extends Gesture @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 20
export declare class SwipeGesture extends Gesture { /** * Set the value. * * @param { function } factory * @param { SwipeGestureHandlerOptions } value * @returns { SwipeGesture } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * * @sin...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class SwipeGesture extends AST#type_annotation#Left AST#primary_type#Left Gesture AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /** * Set the value. * * @param { function } factor...
export declare class SwipeGesture extends Gesture { static $_instantiate(factory: () => SwipeGesture, value?: SwipeGestureHandlerOptions): SwipeGesture; onAction(event: Callback<GestureEvent>): SwipeGesture; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L541-L567
d01c42bf7104ede9bde65a0d7a0b47477788b4a5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets
arkts
addNode
添加节点
addNode(node: RenderNode): void { if (this.rootNode === null) { return; } if (this.rootRenderNode !== null) { this.rootRenderNode.appendChild(node); } }
AST#method_declaration#Left addNode AST#parameter_list#Left ( AST#parameter#Left node : AST#type_annotation#Left AST#primary_type#Left RenderNode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right A...
addNode(node: RenderNode): void { if (this.rootNode === null) { return; } if (this.rootRenderNode !== null) { this.rootRenderNode.appendChild(node); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/palette/src/main/ets/model/RenderNodeModel.ets#L89-L96
d9e11a5e46f10c0960f650583bd9e5f0ad39be10
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildDialogTodos
待办事项
@Builder buildDialogTodos() { if (this.selectedDateDetail?.todos && this.selectedDateDetail.todos.length > 0) { Column({ space: 8 }) { Text('待办事项') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDialogTodos AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_express...
@Builder buildDialogTodos() { if (this.selectedDateDetail?.todos && this.selectedDateDetail.todos.length > 0) { Column({ space: 8 }) { Text('待办事项') .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) .alignSelf(ItemAlign.Start) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4665-L4696
30976fc0f5d5139bb3730426813ac2859481deac
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/SmartHomeCenter/entry/src/main/ets/MainAbility/pages/common/HomeDetails.ets
arkts
HomeDetails
Copyright (c) 2021 JianGuo 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, sof...
@Entry @Component export struct HomeDetails { @State private image: string = "common/images/home_out.png" @State private selectColor: Color = Color.Red @State private isSelected: boolean = true; build() { Column() { Image(this.image) .objectFit(ImageFit.Contain) .width(80) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct HomeDetails AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private image : AST#type_annotation#Left AST#primary_ty...
@Entry @Component export struct HomeDetails { @State private image: string = "common/images/home_out.png" @State private selectColor: Color = Color.Red @State private isSelected: boolean = true; build() { Column() { Image(this.image) .objectFit(ImageFit.Contain) .width(80) ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/SmartHomeCenter/entry/src/main/ets/MainAbility/pages/common/HomeDetails.ets#L16-L50
3b0c33e882934c6c8b091bc789333c165475c04c
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets
arkts
getMirrorBol
镜像持久化,再次进入,确定开关是否开启
getMirrorBol(bol: boolean): void { let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig; cameraConfig.mirrorBol = bol; GlobalContext.get().setObject('cameraConfig', cameraConfig); }
AST#method_declaration#Left getMirrorBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ...
getMirrorBol(bol: boolean): void { let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig; cameraConfig.mirrorBol = bol; GlobalContext.get().setObject('cameraConfig', cameraConfig); }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets#L36-L40
5b7faf6dd0b0ed0e80ecc874f8feadff2f024046
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/InteractiveGameService.ets
arkts
问答题目接口
export interface QuizQuestion { id: string; question: string; options: string[]; correctAnswer: number; explanation: string; difficulty: GameDifficulty; category: string; points: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface QuizQuestion 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 question : AST#type_annotation#Lef...
export interface QuizQuestion { id: string; question: string; options: string[]; correctAnswer: number; explanation: string; difficulty: GameDifficulty; category: string; points: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/InteractiveGameService.ets#L148-L157
9ce2e8552a0832721be6e7decd5f8d79d8ebd5f3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LogUtil.ets
arkts
error
打印ERROR级别日志 @param args
static error(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.ERROR); }
AST#method_declaration#Left static error AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left AST#array_type#Left object [ ] AST#array_type#Right AST#p...
static error(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.ERROR); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L110-L112
1228195653369f33097ff4e65d0803c5099f3b5b
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
arkts
releaseAudioPlayer
Release audio resources
public releaseAudioPlayer(): Promise<void> { return new Promise((resolve, reject) => { resolve(); }); }
AST#method_declaration#Left public releaseAudioPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#t...
public releaseAudioPlayer(): Promise<void> { return new Promise((resolve, reject) => { resolve(); }); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets#L49-L53
c755f7b929a187d76cb17e399bb49511d29c2035
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/SameCityListView.ets
arkts
热搜榜描述
build() { Row() { Column() { Text(this.number) .fontSize($r('app.integer.layout_size_16')) .fontWeight(FontWeight.Medium) .fontColor('#CD5555') .fontStyle(FontStyle.Italic) .margin({ left: $r('app.integer.layout_size_20') }) } .margin({ ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Row() { Column() { Text(this.number) .fontSize($r('app.integer.layout_size_16')) .fontWeight(FontWeight.Medium) .fontColor('#CD5555') .fontStyle(FontStyle.Italic) .margin({ left: $r('app.integer.layout_size_20') }) } .margin({ ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/SameCityListView.ets#L262-L295
0658b269ba3271f96411df953447f724e6be4657
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
saveImageToAlbum
保存图片到图库 @returns
async saveImageToAlbum(): Promise<void> { // TODO 知识点:压缩后的图片数据保存到相册。通过photoAccessHelper.getPhotoAccessHelper获取相册管理模块的实例,使用createAsset创建图片资源,然后使用createImagePacker创建ImagePacker实例。最后调用imagePacker.packToFile传入压缩后的PixelMap图片源,对应的图片格式和质量参数packOpts,编码后打包进图片文件,图片将自动保存到相册。需要说明packToFile内部会进行packing操作,所以传入packToFile的PixelMap...
AST#method_declaration#Left async saveImageToAlbum AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type...
async saveImageToAlbum(): Promise<void> { const HELPER = photoAccessHelper.getPhotoAccessHelper(this.context); const URI = await HELPER.createAsset(photoAccessHelper.PhotoType.IMAGE, this.afterCompressFmt); let file = await fs.open(URI, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let im...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecompression/src/main/ets/view/ImageCompression.ets#L436-L460
19147e5c964df972c5f4deac8d83d4f8ed8a9bff
gitee
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/30.泛型.ets
arkts
getPop
练习2, 定义函数,参数是数组类型不定,返回数组最后一项
function getPop<T>(arr: T[]): T { return arr[arr.length - 1] }
AST#function_declaration#Left function getPop AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left T [ ] AST#array_type#Right AST#primary_type#Right ...
function getPop<T>(arr: T[]): T { return arr[arr.length - 1] }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/30.泛型.ets#L22-L24
3b48e6148a6a220c73ed75b3d49a765b8a7d7f98
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/GoodsCommentsCard.ets
arkts
构建商品评论卡片 @returns {void} 无返回值
build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), } }) { Card({ widthValue: P100, radiusValue: $r("app.float.radius_medium") }) { Col...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#component_parameter#Left width...
build(): void { ColumnStart({ widthValue: P100, paddingValue: { left: $r("app.float.space_horizontal_medium"), right: $r("app.float.space_horizontal_medium"), } }) { Card({ widthValue: P100, radiusValue: $r("app.float.radius_medium") }) { Col...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsCommentsCard.ets#L28-L66
42519fdbaa62034b21b1dfa889717af27ee4e466
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
contains
检查是否包含键
contains(key: K): boolean { return this.get(key) !== null; }
AST#method_declaration#Left contains AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left K AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#typ...
contains(key: K): boolean { return this.get(key) !== null; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L117-L119
4f736261e2013d31e673ac86a5d52e2de6827fa1
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_advanced_ui_component/ace_ets_module_atomicservicecomponent_api18/entry/src/main/ets/constants/Constants.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly EVENT_ID_CHANGE_DATA = 101 }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly EVENT_ID_CHANGE_DATA = AST#expression#Left 101 AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#...
export class Constants { static readonly EVENT_ID_CHANGE_DATA = 101 }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_advanced_ui_component/ace_ets_module_atomicservicecomponent_api18/entry/src/main/ets/constants/Constants.ets#L16-L18
c9d6d6e83c3358429a8315f28933b7e6ad922465
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
get_all_is_loading
Gets a list of all tabs' loading statuses. @returns A boolean[] array, the statuses are either true or false.
get_all_is_loading() { let is_loading: boolean[] = []; for (let index = 0; index < this.Tabs.length; index++) { is_loading.push(this.Tabs[index].is_loading); } return is_loading; }
AST#method_declaration#Left get_all_is_loading AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left is_loading : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left boolean [ ] AST#array_type#Righ...
get_all_is_loading() { let is_loading: boolean[] = []; for (let index = 0; index < this.Tabs.length; index++) { is_loading.push(this.Tabs[index].is_loading); } return is_loading; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L545-L552
31fe88b9c18f99fe1a667e69172e31f0879aca80
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/HomeConstants.ets
arkts
Home constants for all features.
export class HomeConstants { /** * Constants on the tab page of the main interface. */ static readonly HOME_TAB = { CURRENT_INDEX: 0, TAB_BAR_FIRST: 0, TAB_BAR_SECOND: 1, BAR_WIDTH: 360, BAR_HEIGHT: 60, FONT_WEIGHT_SELECT: 500, FONT_WEIGHT_UNSELECT: 400, LINE_HEIGHT: 22, MA...
AST#export_declaration#Left export AST#class_declaration#Left class HomeConstants AST#class_body#Left { /** * Constants on the tab page of the main interface. */ AST#property_declaration#Left static readonly HOME_TAB = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Le...
export class HomeConstants { static readonly HOME_TAB = { CURRENT_INDEX: 0, TAB_BAR_FIRST: 0, TAB_BAR_SECOND: 1, BAR_WIDTH: 360, BAR_HEIGHT: 60, FONT_WEIGHT_SELECT: 500, FONT_WEIGHT_UNSELECT: 400, LINE_HEIGHT: 22, MARGIN_TOP_TWO: 17, MARGIN_BOTTOM: 7, STROKE_WIDTH: 2 }...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSVideoPlayer/entry/src/main/ets/common/constants/HomeConstants.ets#L5-L69
a70160cceec54c0118c3d9184052d6e4d6ec342b
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/accuracy/flow_sensitive/loop_stmt/for_003_T.ets
arkts
Introduction 循环结构-for
export function for_003_T(taint_src : string) { let res = "" let i = 0 for (res = taint_src; i < 1; i++) { taint.Sink(res) } }
AST#export_declaration#Left export AST#function_declaration#Left function for_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AS...
export function for_003_T(taint_src : string) { let res = "" let i = 0 for (res = taint_src; i < 1; i++) { taint.Sink(res) } }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/loop_stmt/for_003_T.ets#L6-L12
9c0c2744245372e4bd84a5418bf59638bfb70c14
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/navigation/GoodsCommentNav.ets
arkts
GoodsCommentNav
@file 商品评论页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function GoodsCommentNav(): void { GoodsCommentPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function GoodsCommentNav 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_custo...
@Builder export function GoodsCommentNav(): void { GoodsCommentPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/navigation/GoodsCommentNav.ets#L8-L11
39ad31b950da08112fb1acfe5cbaf631a676d292
github
rbjzbx/HarmonyOS_ArkTs.git
2a5efd108392f7d4453894f644d573deaa2d2913
entry/src/main/ets/pages/Index.ets
arkts
navigateToDetail
跳转到详情页面
private navigateToDetail(item: StudyDirection): void { const params: PageParams = { directionId: item.id, directionTitle: item.title, directionDescription: item.description, directionColor: item.color }; console.info(`跳转到学习方向: ${item.title}`); // 使用router跳转到详情页面 router.push...
AST#method_declaration#Left private navigateToDetail AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left StudyDirection AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST...
private navigateToDetail(item: StudyDirection): void { const params: PageParams = { directionId: item.id, directionTitle: item.title, directionDescription: item.description, directionColor: item.color }; console.info(`跳转到学习方向: ${item.title}`); router.pushUrl({ url: '...
https://github.com/rbjzbx/HarmonyOS_ArkTs.git/blob/2a5efd108392f7d4453894f644d573deaa2d2913/entry/src/main/ets/pages/Index.ets#L139-L158
fd6089ce16e6ddda7b5ff0a3b8341598040287c8
github
from-north-to-north/OpenHarmony_p7885
f6ea526c039db535a7c958fa154ccfcb3668b37c
hap/easy_demo/float_windows/float_windows_3.5.14.43/entry/src/main/ets/controller/FloatWindowController.ets
arkts
悬浮窗控制类
export default class FloatWindowController { // 创建单例模式 private static mInstance: FloatWindowController | null = null; public static getInstance(): FloatWindowController { if (FloatWindowController.mInstance == null) { FloatWindowController.mInstance = new FloatWindowController(); } return Floa...
AST#export_declaration#Left export default AST#class_declaration#Left class FloatWindowController AST#class_body#Left { // 创建单例模式 AST#property_declaration#Left private static mInstance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left FloatWindowController AST#primary_type#Right | AST#primary_type#Le...
export default class FloatWindowController { private static mInstance: FloatWindowController | null = null; public static getInstance(): FloatWindowController { if (FloatWindowController.mInstance == null) { FloatWindowController.mInstance = new FloatWindowController(); } return FloatWindowCo...
https://github.com/from-north-to-north/OpenHarmony_p7885/blob/f6ea526c039db535a7c958fa154ccfcb3668b37c/hap/easy_demo/float_windows/float_windows_3.5.14.43/entry/src/main/ets/controller/FloatWindowController.ets#L12-L90
6be67a5c6af4c0705f5a8283f56f2395ba2fc124
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets
arkts
getInstance
Get the singleton of LRUCacheUtil
public static getInstance(): LRUCacheUtil { if (!LRUCacheUtil.instance) { LRUCacheUtil.instance = new LRUCacheUtil(); } return LRUCacheUtil.instance; }
AST#method_declaration#Left public static getInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LRUCacheUtil 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(): LRUCacheUtil { if (!LRUCacheUtil.instance) { LRUCacheUtil.instance = new LRUCacheUtil(); } return LRUCacheUtil.instance; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets#L13-L18
78726ded3ee9d26277b83b1a2cd85e728597739e
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/LunarSolarMappingService.ets
arkts
年度映射数据
export interface YearMappingData { year: number; mappings: Map<string, LunarSolarMapping>; // key: "M-D" 格式 solarToLunar: Map<string, LunarSolarMapping>; // key: "M-D" 格式 }
AST#export_declaration#Left export AST#interface_declaration#Left interface YearMappingData AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left mappings : AST#type_annotatio...
export interface YearMappingData { year: number; mappings: Map<string, LunarSolarMapping>; solarToLunar: Map<string, LunarSolarMapping>; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L30-L34
a3cfe85d936d20834ac394ed3723484a74481d72
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets
arkts
@file @kit ArkUI Enum for DownloadIconStyle @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare enum DownloadIconStyle { /** * FULL_FILLED type. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ FULL_FILLED = 1, /** * LINES type. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatf...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DownloadIconStyle AST#enum_body#Left { /** * FULL_FILLED type. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#enum_member#Left F...
export declare enum DownloadIconStyle { FULL_FILLED = 1, LINES = 2 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L28-L47
b5bec6aef2b113e1962cdf8a59b7a8470ba6e354
github
fengcreate/harmony-document
798534b0f76399dc84e7940f5b14b3ae4e53c6a9
BackupRestore/entry/src/main/ets/restore/sp/SpTransferManager.ets
arkts
getSourceXmlStr
Read the text content of the XML file. @param context context. @return Text content of XML file.
private getSourceXmlStr(context: common.Context): string { let xmlContent: string = ''; try { let sourceSpFilePath: string = `${context.preferencesDir}/source_sp.xml`; let fileStream = fileIo.createStreamSync(sourceSpFilePath, 'r'); if (!fileStream) { hilog.error(0x0000, 'BackupRestore...
AST#method_declaration#Left private getSourceXmlStr AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AS...
private getSourceXmlStr(context: common.Context): string { let xmlContent: string = ''; try { let sourceSpFilePath: string = `${context.preferencesDir}/source_sp.xml`; let fileStream = fileIo.createStreamSync(sourceSpFilePath, 'r'); if (!fileStream) { hilog.error(0x0000, 'BackupRestore...
https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/sp/SpTransferManager.ets#L117-L161
d737aa86058eb9a093d0c21dcc7e166af04f1cca
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ImageComponent/entry/src/main/ets/pages/LoadImageResources.ets
arkts
getAllImg
获取照片url集
getAllImg() { try { let photoSelectOptions:photoAccessHelper.PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 5; let photoPicker:photoAccessHelper.PhotoViewPic...
AST#method_declaration#Left getAllImg 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#variable_declaration#Left let AST#variable_declarator#Left photoSelectOptions : AST#type_annotation#Left A...
getAllImg() { try { let photoSelectOptions:photoAccessHelper.PhotoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 5; let photoPicker:photoAccessHelper.PhotoViewPic...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ImageComponent/entry/src/main/ets/pages/LoadImageResources.ets#L24-L43
c4982ad1dc55146d9a98a912290a6f0d3209573a
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/Index.ets
arkts
downloadFile
下载到文件
async downloadFile() { //如果文件大小为0,就获取文件大小 if (this.downloadFileInfo.totalSize == 0) { this.downloadFileInfo.totalSize = await this.getDownloadFileSize() if (this.downloadFileInfo.totalSize == 0) { this.msgHistory += "获取文件大小失败\r\n" return } } this.isRunning = true t...
AST#method_declaration#Left async downloadFile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { //如果文件大小为0,就获取文件大小 AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left...
async downloadFile() { if (this.downloadFileInfo.totalSize == 0) { this.downloadFileInfo.totalSize = await this.getDownloadFileSize() if (this.downloadFileInfo.totalSize == 0) { this.msgHistory += "获取文件大小失败\r\n" return } } this.isRunning = true this.downloadFileIn...
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/Index.ets#L172-L210
d680d2bccb1d846cf6e6fdc7456aafbe49eecf2e
gitee
PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git
3b5fa45c650dcae2773a19f122161935e0c0e2bc
entry/src/main/ets/pages/customScan/pages/ScanPage.ets
arkts
this
Window size listener.
this.windowSizeSubscribe();
AST#method_declaration#Left this AST#ERROR#Left . w in dowSizeSubscribe AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
this.windowSizeSubscribe();
https://github.com/PureHarmonyProject/ScanKit_SampleCode_Clientdemo_ArkTS.git/blob/3b5fa45c650dcae2773a19f122161935e0c0e2bc/entry/src/main/ets/pages/customScan/pages/ScanPage.ets#L143-L143
12a66688791a2c069e9f9be032876d979e355503
github
yangsongming/ArkTs-HuXiHelper.git
ed148299fc6dcf351bcc0f2863a5aee4885fbaf5
ets/common/utils/Geography.ets
arkts
Geographical coordinate conversion tool.
export class Geography { /** * The Mercator projection calculates the pixel coordinate system, which may have stretching errors. * * @param Latitude * @param Longitude * @returns pixelCoordinates. */ public static toPixelCoordinates(latitude: number, longitude: number): PixelCoordinates { // ...
AST#export_declaration#Left export AST#class_declaration#Left class Geography AST#class_body#Left { /** * The Mercator projection calculates the pixel coordinate system, which may have stretching errors. * * @param Latitude * @param Longitude * @returns pixelCoordinates. */ AST#method_declaration#Left...
export class Geography { public static toPixelCoordinates(latitude: number, longitude: number): PixelCoordinates { const yMin = Geography.MercatorY(Const.SOUTH_LATITUDE); const yMax = Geography.MercatorY(Const.NORTH_LATITUDE); const xFactor = Const.MAP_WIDTH / (Const.EAST_LONGITUDE - Const.W...
https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/common/utils/Geography.ets#L7-L41
3038213cce307b0a87cbcbec94ef128b4144c2e6
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/view/RegisterPage.ets
arkts
RegisterPage
@file 注册页面视图 @author Joker.X
@ComponentV2 export struct RegisterPage { /** * 注册页面 ViewModel */ @Local private vm: RegisterViewModel = new RegisterViewModel(); /** * 手机号输入 */ @Local private phone: string = ""; /** * 验证码输入 */ @Local private verificationCode: string = ""; /** * 密码输入 */ @Local private pa...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RegisterPage AST#component_body#Left { /** * 注册页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left RegisterV...
@ComponentV2 export struct RegisterPage { @Local private vm: RegisterViewModel = new RegisterViewModel(); @Local private phone: string = ""; @Local private verificationCode: string = ""; @Local private password: string = ""; @Local private confirmPassword: string = ""; build(): ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/RegisterPage.ets#L17-L142
29c265cc5fef7d0b4dbcfb29b8e4c0cd93a727b9
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
返回上一个页面
export function NavPop(animated?: boolean) { NavPathManager.shared.popBack(animated) }
AST#export_declaration#Left export AST#function_declaration#Left function NavPop AST#parameter_list#Left ( AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST...
export function NavPop(animated?: boolean) { NavPathManager.shared.popBack(animated) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L95-L97
6011510965fb103848d82ecdf64e9878433da2ec
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets
arkts
check
弹窗底部check复选按钮 @param bottomCheck 复选配置 @returns
check(bottomCheck: ICheckboxOptions) { this.builderOptions.bottomCheck = bottomCheck return this; }
AST#method_declaration#Left check AST#parameter_list#Left ( AST#parameter#Left bottomCheck : AST#type_annotation#Left AST#primary_type#Left ICheckboxOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statem...
check(bottomCheck: ICheckboxOptions) { this.builderOptions.bottomCheck = bottomCheck return this; }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/BasePickerBuilderProxy.ets#L29-L32
89fb0347f3935c851542f0acdc9faf596e415ddf
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/ComponentBase.ets
arkts
getTextColor
Returns the text color that is set for the labels. @return
public getTextColor(): string | number | CanvasGradient | CanvasPattern { return this.mTextColor; }
AST#method_declaration#Left public getTextColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left CanvasGradient AST#primary_type#Right | AS...
public getTextColor(): string | number | CanvasGradient | CanvasPattern { return this.mTextColor; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/ComponentBase.ets#L159-L161
4310789192b9158fc3cf86ee922682758f15f8d3
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets
arkts
StatusBarAnimationComponent
功能描述: 本案例展示了状态栏的动态交互效果。通过监听页面滚动事件 onDidScroll,随着页面的上下滚动,实现状态栏颜色的变化。搜索框会在滚动时流畅地展开或收起,并伴有自然的透明度过渡效果。 推荐场景: 页面滚动时状态栏和搜索框需要流畅过渡动效的场景 核心组件: 1. WindowModel 实现步骤: 1. 初始化和状态设置。在 aboutToAppear() 方法中,初始化了窗口模型 windowModel。启用沉浸式(设置全屏显示和状态栏为白色),获取状态栏高度存储在 statusBarHeight 变量中,从预定义的数据源 LIST_DATA 加载数据到 dataSource中。 2. 界面布局构造。使用Stac...
@Component export struct StatusBarAnimationComponent { @State statusBarHeight: number = 0; // 顶部状态栏高度 @State navigateBarOpacity: number = 0; // 顶部状态栏透明度 @State isWhiteColor: boolean = true; // 状态栏是否为白色 @State isFlow: boolean = false; // 搜索框是否收起 @State negativeOffsetY: number = 0; // List向下拉到顶后继续上拉为负数的偏移量 @S...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct StatusBarAnimationComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right statusBarHeight : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty...
@Component export struct StatusBarAnimationComponent { @State statusBarHeight: number = 0; @State navigateBarOpacity: number = 0; @State isWhiteColor: boolean = true; @State isFlow: boolean = false; @State negativeOffsetY: number = 0; @State isTop: boolean = false; @State dataSource: LazyDataSource<...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/view/StatusBarAnimation.ets#L42-L437
bcd64f73a04eff54b3808f552877db3be0f49c5f
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ClickResponseOptimization/entry/src/main/ets/pages/CityListPage.ets
arkts
onPageShow
[StartExclude onpage_show]
onPageShow() { hiTraceMeter.finishTrace("clickCity", 1); }
AST#method_declaration#Left onPageShow AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left hiTraceMeter AST#expression#Right . finishTrace AST#m...
onPageShow() { hiTraceMeter.finishTrace("clickCity", 1); }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ClickResponseOptimization/entry/src/main/ets/pages/CityListPage.ets#L70-L72
1b476f5489f3c1434d5b1c0b8d624cbc483e7ca9
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets
arkts
setupDefaultFormatter
Calculates the required number of digits for the values that might be drawn in the chart (if enabled), and creates the default-value-formatter
protected setupDefaultFormatter(min: number, max: number) { let reference: number = 0; // @ts-ignore 缺失方法 if (this.mData == null || this.mData.getEntryCount() < 2) { reference = Math.max(Math.abs(min), Math.abs(max)); } else { reference = Math.abs(max - min); } var digits: number =...
AST#method_declaration#Left protected setupDefaultFormatter AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#p...
protected setupDefaultFormatter(min: number, max: number) { let reference: number = 0; if (this.mData == null || this.mData.getEntryCount() < 2) { reference = Math.max(Math.abs(min), Math.abs(max)); } else { reference = Math.abs(max - min); } var digits: number = Utils.getDecimals...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets#L301-L315
33410b008fa25267d59f75b266fc10ff69c01804
gitee
kumaleap/ArkSwipeDeck.git
5afa77b9b2a2a531595d31f895c54a3371e4249a
library/src/main/ets/types/SwipeCardTypes.ets
arkts
卡片栈为空回调函数类型
export type OnStackEmptyCallback = () => void;
AST#export_declaration#Left export AST#type_declaration#Left type OnStackEmptyCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Right AS...
export type OnStackEmptyCallback = () => void;
https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/types/SwipeCardTypes.ets#L68-L68
b13c4340e2fd7d5ce48e31290b294d16b62ef65a
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets
arkts
Basic implementation of IDataSource to handle data listener @class @implements {IDataSource}
export class MonthDataSource implements IDataSource<Month> { private listeners: DataChangeListener[] = []; public dataArray: Month[] = new Array<Month>(); /** * 获取数组长度。 * @returns {number} 返回数组长度。 */ public totalCount(): number { return this.dataArray.length; } /** * 获取指定索引数据。 * @param ...
AST#export_declaration#Left export AST#class_declaration#Left class MonthDataSource AST#implements_clause#Left implements AST#generic_type#Left IDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Month AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#Right AST#gener...
export class MonthDataSource implements IDataSource<Month> { private listeners: DataChangeListener[] = []; public dataArray: Month[] = new Array<Month>(); public totalCount(): number { return this.dataArray.length; } public getData(index: number): Month { return this.dataArray[index]; } p...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example4/MonthDataSource.ets#L67-L178
55cd5e716f39d984e659cfa238f0c91d56eb6733
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
返回到首页(栈顶)
export function NavPopTop(animated?: boolean) { NavPathManager.shared.popTop(animated) }
AST#export_declaration#Left export AST#function_declaration#Left function NavPopTop AST#parameter_list#Left ( AST#parameter#Left animated ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { ...
export function NavPopTop(animated?: boolean) { NavPathManager.shared.popTop(animated) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L100-L102
018078401167d978088a065883652e54cad91a63
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
common/component/src/main/ets/default/entryComponent.ets
arkts
EntryComponent
item custom component
@Component export default struct EntryComponent { @State isShow: Boolean = true; @State settingIcon: string = ""; @State endTextIsShow: Boolean = true; @State settingSummary: string = ''; @State settingValue: string = ""; @State settingArrow: string = ''; @State settingArrowStyle: string = ""; @State ti...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct EntryComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isShow : AST#type_annotation#Left AST#primary_type#Left Boolean AST#primary_type#Right AST#...
@Component export default struct EntryComponent { @State isShow: Boolean = true; @State settingIcon: string = ""; @State endTextIsShow: Boolean = true; @State settingSummary: string = ''; @State settingValue: string = ""; @State settingArrow: string = ''; @State settingArrowStyle: string = ""; @State ti...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/entryComponent.ets#L22-L145
fb3146e7801b5d8893507099dd94f858d31b0e84
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pipwindow/src/main/ets/components/XComponentView.ets
arkts
在线视频路径
build() { Column() { XComponent({ type: XComponentType.SURFACE, controller: PipManager.getInstance().getXComponentController() }) .onLoad(() => { // 将surfaceId设置给媒体源 PipManager.getInstance() .getXComponentController() .onSurfaceCreated(...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left XComponent ( AST#component_parameters#Left { AST#compon...
build() { Column() { XComponent({ type: XComponentType.SURFACE, controller: PipManager.getInstance().getXComponentController() }) .onLoad(() => { PipManager.getInstance() .getXComponentController() .onSurfaceCreated(PipManager.getInsta...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/components/XComponentView.ets#L36-L52
3752a1caa5e1f477f48f71b5ec793fa40595611d
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets
arkts
updateData
更新数据函数 @param index @param data
public updateData(index: number, data: IChatMessage): void { if (this.originDataArray.length <= index) { this.originDataArray.push(data); } else { this.originDataArray[index].roleType = data.roleType; this.originDataArray[index].name = data.name; this.originDataArray[index].content =...
AST#method_declaration#Left public updateData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left IChatMessage AST#primar...
public updateData(index: number, data: IChatMessage): void { if (this.originDataArray.length <= index) { this.originDataArray.push(data); } else { this.originDataArray[index].roleType = data.roleType; this.originDataArray[index].name = data.name; this.originDataArray[index].content =...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L47-L58
9744298102883632660780fa3eeb22f2ff2aca6f
gitee
openharmony-tpc-incubate/photo-deal-demo
01382ce30b1785f8fc8bc14f6b94f0a670a5b50b
library/src/main/ets/controller/EditController.ets
arkts
操作记录
export interface OperateRecord { /** * 组件节点,用于画笔、马赛克、文本节点回退使用 */ node?: FrameNode; /** * 记录操作关联的额外数据 */ data?: OperateData; /** * 功能类型 */ type: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface OperateRecord AST#object_type#Left { /** * 组件节点,用于画笔、马赛克、文本节点回退使用 */ AST#type_member#Left node ? : AST#type_annotation#Left AST#primary_type#Left FrameNode AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; /** * ...
export interface OperateRecord { node?: FrameNode; data?: OperateData; type: string; }
https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/controller/EditController.ets#L30-L45
173ed97be72856f60c41deca94f94bf215697b85
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/RegexUtils.ets
arkts
isMatch
给定内容是否匹配正则(配合RegexUtils里的正则常量一起使用) @param content 内容 @param regex 正则
static isMatch(content: string, regex: RegExp | string): boolean { if (content === undefined || content === null) { return false; } else { if (typeof regex === 'string') { return new RegExp(regex).test(content); } else { return regex.test(content); } } }
AST#method_declaration#Left static isMatch AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left regex : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Reg...
static isMatch(content: string, regex: RegExp | string): boolean { if (content === undefined || content === null) { return false; } else { if (typeof regex === 'string') { return new RegExp(regex).test(content); } else { return regex.test(content); } } }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/RegexUtils.ets#L181-L191
15e860dbad1b63529ad0c7c9350ee282963d8217
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment8.ets
arkts
getUserData
[Start Case5] Getting user information in a business class
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { //1.Separate storage of user collection information data in AppStorage AppStorage.setOrCreate('collectedIds', data.collectedIds); AppStorage.setOrCreate('userData', data); }) }
AST#method_declaration#Left getUserData 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#expression#L...
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { AppStorage.setOrCreate('collectedIds', data.collectedIds); AppStorage.setOrCreate('userData', data); }) }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment8.ets#L61-L67
4e1f52941b2b097bad87313286c0ef9a6b77ee1b
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets
arkts
@file 通用基础接口数据源实现 @author Joker.X
export class CommonNetworkDataSourceImpl implements CommonNetworkDataSource { /** * 获取系统参数 * @param {string} key - 参数键 * @returns {Promise<NetworkResponse<string>>} 参数值 */ async getParam(key: string): Promise<NetworkResponse<string>> { const resp: AxiosResponse<NetworkResponse<string>> = await...
AST#export_declaration#Left export AST#class_declaration#Left class CommonNetworkDataSourceImpl AST#implements_clause#Left implements CommonNetworkDataSource AST#implements_clause#Right AST#class_body#Left { /** * 获取系统参数 * @param {string} key - 参数键 * @returns {Promise<NetworkResponse<string>>} 参数值 */ AST#me...
export class CommonNetworkDataSourceImpl implements CommonNetworkDataSource { async getParam(key: string): Promise<NetworkResponse<string>> { const resp: AxiosResponse<NetworkResponse<string>> = await NetworkClient.http.get("base/comm/param", { params: { key } }); return resp.data; } async ge...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/common/CommonNetworkDataSourceImpl.ets#L10-L42
d65b252ff6a773e980d9e306be6d324223df2e39
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/authorizedControl/SaveControl.ets
arkts
saveVideo
点击保存视频
saveVideo() { try { context.resourceManager.getRawFd(this.mediaUri, async (error, value) => { if (error) { Logger.error(`error is ${JSON.stringify(error)}`); } else { let mediaFd = value.fd; let buffer = new ArrayBuffer(value.length); let options: Option...
AST#method_declaration#Left saveVideo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expr...
saveVideo() { try { context.resourceManager.getRawFd(this.mediaUri, async (error, value) => { if (error) { Logger.error(`error is ${JSON.stringify(error)}`); } else { let mediaFd = value.fd; let buffer = new ArrayBuffer(value.length); let options: Option...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/authorizedControl/SaveControl.ets#L59-L84
178e031284b0086e5729be4a7646e0d7c84d69bd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NetworkUtil.ets
arkts
hasNetEthernet
判断当前网络是否是以太网网络。
static hasNetEthernet(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_ETHERNET); }
AST#method_declaration#Left static hasNetEthernet AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_exp...
static hasNetEthernet(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_ETHERNET); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NetworkUtil.ets#L146-L148
fa10ecd0ef8e638846421d7abac0b719a785bbc5
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/entity/NotificationOptions.ets
arkts
描述长文本通知
export interface NotificationLongTextOptions extends NotificationBasicOptions { briefText: string; //通知概要内容,是对通知内容的总结(不可为空字符串)。 longText: string; //通知的长文本(不可为空字符串)。 expandedTitle: string; //通知展开时的标题(不可为空字符串) }
AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationLongTextOptions AST#extends_clause#Left extends NotificationBasicOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left briefText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right A...
export interface NotificationLongTextOptions extends NotificationBasicOptions { briefText: string; longText: string; expandedTitle: string; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/NotificationOptions.ets#L67-L71
1ba9ca8120da2bec21bd31e30f51b709fb0c3db0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
buildStatsCard
构建统计卡片
@Builder buildStatsCard(title: string, items: Array<{label: string, value: string, icon: Resource, highlight?: boolean}>) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text(title) .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fon...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildStatsCard AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left items : AST#type_annotation#Lef...
@Builder buildStatsCard(title: string, items: Array<{label: string, value: string, icon: Resource, highlight?: boolean}>) { Card() { Column({ space: UIConstants.DEFAULT_PADDING }) { Text(title) .fontSize(UIConstants.FONT_SIZE_HEADING) .fontWeight(FontWeight.Medium) .fon...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/analytics/AnalyticsPage.ets#L577-L620
0a66ad008fc816c964542e495e3b128b1761cde6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getStartOfMonth
获取本月开始日期 @param date 基准日期,默认为今天 @returns 本月开始日期
static getStartOfMonth(date: Date = new Date()): Date { return new Date(date.getFullYear(), date.getMonth(), 1); }
AST#method_declaration#Left static getStartOfMonth 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#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left D...
static getStartOfMonth(date: Date = new Date()): Date { return new Date(date.getFullYear(), date.getMonth(), 1); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L162-L164
7b7badba3d132e9198c5c46b19ee494dac814583
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieEntry.ets
arkts
setX
@Deprecated @Override
public setX(x: number): void { super.setX(x); // Log.i("DEPRECATED", "Pie entries do not have x values"); }
AST#method_declaration#Left public setX AST#parameter_list#Left ( AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#...
public setX(x: number): void { super.setX(x); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieEntry.ets#L47-L50
637c8c1052b9c37bf9cff80a85903fa27f46a0a7
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
步骤动作接口
export interface StepAction { id: string; type: ActionType; parameters: Record<string, any>; condition?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StepAction 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 type : AST#type_annotation#Left AST#...
export interface StepAction { id: string; type: ActionType; parameters: Record<string, any>; condition?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L95-L100
d99b4c40b4119862f0f3c8615d18c2a6f31dcdfd
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard4x4.ets
arkts
buildHeader
构建头部
@Builder buildHeader() { Row() { Image($r('app.media.ic_birthday_cake')) .width('24vp') .height('24vp') .fillColor($r('app.color.primary')) Text('AI生日提醒') .fontSize(18) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .lay...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element...
@Builder buildHeader() { Row() { Image($r('app.media.ic_birthday_cake')) .width('24vp') .height('24vp') .fillColor($r('app.color.primary')) Text('AI生日提醒') .fontSize(18) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .lay...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard4x4.ets#L52-L73
4120285468c9fa07da978e895cd1ef86cd5fe4bf
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets
arkts
setSourceInfo
视频信息上报函数
async setSourceInfo(): Promise<void> { // 时间上报函数 this.avPlayer.on('timeUpdate', (time: number) => { logger.info('timeUpdate called: time is :' + time); logger.info('timeUpdate called: currentTime is :' + this.avPlayer.currentTime); this.callbackTimeUpdate(time); }); // 音量变化回调函数 thi...
AST#method_declaration#Left async setSourceInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async setSourceInfo(): Promise<void> { this.avPlayer.on('timeUpdate', (time: number) => { logger.info('timeUpdate called: time is :' + time); logger.info('timeUpdate called: currentTime is :' + this.avPlayer.currentTime); this.callbackTimeUpdate(time); }); this.avPlayer.on('volum...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videoscreendirectionswitching/src/main/ets/component/VideoComponent.ets#L189-L247
d1e8cbb8c05a5bfebf215bfcf7783c56b00773cd
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets
arkts
setScatterShapeSize
Sets the size in density pixels the drawn scattershape will have. This only applies for non custom shapes. @param size
public setScatterShapeSize(size: number): void { this.mShapeSize = size; }
AST#method_declaration#Left public setScatterShapeSize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#prima...
public setScatterShapeSize(size: number): void { this.mShapeSize = size; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets#L74-L76
12085064c89b59cbe087b36a8b32723974af2c9a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
toggleGreetingSelection
切换祝福语选择状态
private toggleGreetingSelection(greetingId: string): void { if (this.selectedGreetings.has(greetingId)) { this.selectedGreetings.delete(greetingId); } else { this.selectedGreetings.add(greetingId); } // 触发状态更新 this.selectedGreetings = new Set(this.selectedGreetings); }
AST#method_declaration#Left private toggleGreetingSelection AST#parameter_list#Left ( AST#parameter#Left greetingId : 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 voi...
private toggleGreetingSelection(greetingId: string): void { if (this.selectedGreetings.has(greetingId)) { this.selectedGreetings.delete(greetingId); } else { this.selectedGreetings.add(greetingId); } this.selectedGreetings = new Set(this.selectedGreetings); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L129-L137
00c39c543615aaa23bc3ba516da40dfb2578dbe3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/utils/MathUtils.ets
arkts
getRandomFloat
生成指定范围内的随机小数 @param min @param max @param precision
static getRandomFloat(min: number, max: number, precision: number = DEFAULT_PRECISION): number { let random = Math.random() * (max - min) + min; return parseFloat(random.toFixed(precision)); }
AST#method_declaration#Left static getRandomFloat AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#primary_typ...
static getRandomFloat(min: number, max: number, precision: number = DEFAULT_PRECISION): number { let random = Math.random() * (max - min) + min; return parseFloat(random.toFixed(precision)); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/utils/MathUtils.ets#L34-L37
cb349462f16f4d9635dd102cad7bfb4bf99490c0
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/view/UserBaseInfo.ets
arkts
UserBaseInfo
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
@Component export struct UserBaseInfo { @Prop nickname: string = ''; @Prop signature: string = ''; build() { Column() { // userIcon Image($r('app.media.ic_user')) .objectFit(ImageFit.Contain) .height($r('app.float.default_66')) .width($r('app.float.default_66')) .m...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UserBaseInfo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right nickname : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annot...
@Component export struct UserBaseInfo { @Prop nickname: string = ''; @Prop signature: string = ''; build() { Column() { Image($r('app.media.ic_user')) .objectFit(ImageFit.Contain) .height($r('app.float.default_66')) .width($r('app.float.default_66')) .margin({ top...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/view/UserBaseInfo.ets#L16-L57
03ffb55d295ca2ee897a0a902d009565f757872e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/SwiperView.ets
arkts
SwiperNode
[Start swiper_view] Need to add the @ Reusable decorator and implement the aboutToReuse interface for refreshing data during component reuse
@Reusable @Component export struct SwiperNode { // [StartExclude swiper_view] @State type: string = ''; @State images:Resource[]=[]; @State builder: WrappedBuilder<ESObject> | null = null; private nodeItem: NodeItem = new NodeItem(); aboutToAppear(): void { this.nodeItem = NodePool.getInstance().getNod...
AST#decorated_export_declaration#Left AST#decorator#Left @ Reusable AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct SwiperNode AST#component_body#Left { // [StartExclude swiper_view] AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right type : AST#type_annotat...
@Reusable @Component export struct SwiperNode { @State type: string = ''; @State images:Resource[]=[]; @State builder: WrappedBuilder<ESObject> | null = null; private nodeItem: NodeItem = new NodeItem(); aboutToAppear(): void { this.nodeItem = NodePool.getInstance().getNode(this.type, this.images, 0, ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/view/SwiperView.ets#L26-L53
408c525e54caa97d45e39b81471be22dc73e8829
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets
arkts
CardTitle
卡片标题样式 @param {Resource | string} title - 标题文本 @returns {void} 无返回值
@Builder private CardTitle(title: Resource | string): void { Text(title) .fontSize($r("app.float.body_large")) .fontColor($r("app.color.text_primary")); }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private CardTitle AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Righ...
@Builder private CardTitle(title: Resource | string): void { Text(title) .fontSize($r("app.float.body_large")) .fontColor($r("app.color.text_primary")); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L277-L282
3f8e1e51f2a7fa06c1a4e5d666425b9fcbd7fc29
github