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
hefengbao/jingmo-for-HarmonyOS.git
a208f3fdc95c0914749072e811301b9dfd6678d6
commons/utils/src/main/ets/data/DbUtil.ets
arkts
官方文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/data-persistence-by-rdb-store
export class DbUtil { objectiveRDB?: relationalStore.RdbStore; private logger: Logger = new Logger('RDBStoreUtil') init(context: Context) { this.getObjectiveRDB(context).then((rdbStore: relationalStore.RdbStore) => { let storeVersion: number = rdbStore.version; this.logger.info(`dbStore.version ...
AST#export_declaration#Left export AST#class_declaration#Left class DbUtil AST#class_body#Left { AST#property_declaration#Left objectiveRDB ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbStore AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ; AS...
export class DbUtil { objectiveRDB?: relationalStore.RdbStore; private logger: Logger = new Logger('RDBStoreUtil') init(context: Context) { this.getObjectiveRDB(context).then((rdbStore: relationalStore.RdbStore) => { let storeVersion: number = rdbStore.version; this.logger.info(`dbStore.version ...
https://github.com/hefengbao/jingmo-for-HarmonyOS.git/blob/a208f3fdc95c0914749072e811301b9dfd6678d6/commons/utils/src/main/ets/data/DbUtil.ets#L10-L38
9052429244469152a8715b170ce4c9aec9f23679
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/main/sub/list/SubListView.ets
arkts
get
debounce 定时器
get wordsList(): SectionDatas<string, WordUser>[]{ return [ this.wordsAbc, this.wordsCategory, this.wordsFavorite, this.wordsWrang, this.wordsStill ] }
AST#method_declaration#Left get AST#ERROR#Left words List AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#ERROR#Left AST#primary_type#Left AST#generic_type#Left SectionDatas AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat...
get wordsList(): SectionDatas<string, WordUser>[]{ return [ this.wordsAbc, this.wordsCategory, this.wordsFavorite, this.wordsWrang, this.wordsStill ] }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/main/sub/list/SubListView.ets#L34-L42
26d4941a8ac769a4c9d53ffb4af49494263a6923
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/model/ConstData.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export const DATA_CONFIG: Record<string, number> = { 'NUMBER_LEN': 7, // 数字个数 'DURATION_TIME': 200, // 动画时长 'MILLENNIAL_LEN': 3 // 千分位长度 }
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATA_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ,...
export const DATA_CONFIG: Record<string, number> = { 'NUMBER_LEN': 7, 'DURATION_TIME': 200, 'MILLENNIAL_LEN': 3 }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/digitalscrollanimation/src/main/ets/model/ConstData.ets#L16-L20
d12b79569057e16cdb720916b5d219a1cba81d74
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
AppColdStart/library/Index.ets
arkts
MainPage
[Start not_recommend_demo]
export { MainPage } from './src/main/ets/components/mainpage/MainPage';
AST#export_declaration#Left export { MainPage } from './src/main/ets/components/mainpage/MainPage' ; AST#export_declaration#Right
export { MainPage } from './src/main/ets/components/mainpage/MainPage';
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/library/Index.ets#L17-L17
9888464b7eeade08c4df67983fa9330ec60bcaf4
gitee
HarmonyCandies/image_editor.git
16924481f667efa4bdd1a0b39e6f5a80c43e5ff4
image_editor/src/main/ets/components/option/DrawOption.ets
arkts
kind: number;
constructor(control1: Offset, control2: Offset | null, target: Offset) { super(); this.control1 = control1; this.control2 = control2; this.target = target; //this.kind = kind; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left control1 : AST#type_annotation#Left AST#primary_type#Left Offset AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left control2 : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Le...
constructor(control1: Offset, control2: Offset | null, target: Offset) { super(); this.control1 = control1; this.control2 = control2; this.target = target; }
https://github.com/HarmonyCandies/image_editor.git/blob/16924481f667efa4bdd1a0b39e6f5a80c43e5ff4/image_editor/src/main/ets/components/option/DrawOption.ets#L360-L366
95110f8b97b6ed37476145fc88c16dd822e7eca8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets
arkts
closeBindSheet
关闭bindSheetContent对应的半模态页面 @param dialogId
closeBindSheet(dialogId: string) { try { const promptActionArg = this.getArgById(dialogId); if (promptActionArg && promptActionArg.uiContext && promptActionArg.componentContent) { promptActionArg.uiContext.closeBindSheet(promptActionArg.componentContent).then(() => { promptActionArg.co...
AST#method_declaration#Left closeBindSheet AST#parameter_list#Left ( AST#parameter#Left dialogId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left tr...
closeBindSheet(dialogId: string) { try { const promptActionArg = this.getArgById(dialogId); if (promptActionArg && promptActionArg.uiContext && promptActionArg.componentContent) { promptActionArg.uiContext.closeBindSheet(promptActionArg.componentContent).then(() => { promptActionArg.co...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionBaseCore.ets#L120-L132
7bf478b29897b7cc39f329ba6eee37881fb97c4f
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets
arkts
buildTabContent
构建标签内容
@Builder buildTabContent() { switch (this.selectedTab) { case 0: this.buildVisualTab(); break; case 1: this.buildAudioTab();
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildTabContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left switch AST#expression#Right AST#ERROR#Left ( AST#expression#Left AST#member_expression#L...
@Builder buildTabContent() { switch (this.selectedTab) { case 0: this.buildVisualTab(); break; case 1: this.buildAudioTab();
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/accessibility/AccessibilitySettingsPage.ets#L342-L349
1ec2829fc013dd6084636eb707864a337e675a60
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/08.内外边距.ets
arkts
@State message: string = 'Hello World123';
build() { // build里面只能有一个容器组件 // 使用space控制组件间的距离 Column({ space: 20 }) { Row({ space: 5}) { Image($r('app.media.ic_gallery_create')) .width(20) // 用于修改svg图标的颜色 .fillColor(Color.Gray) Text('开灯') .fontColor(Color.Gray) } .border({ ...
AST#build_method#Left build ( ) AST#build_body#Left { // build里面只能有一个容器组件 // 使用space控制组件间的距离 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 20 AST#expression#Right AST#component_paramete...
build() { Column({ space: 20 }) { Row({ space: 5}) { Image($r('app.media.ic_gallery_create')) .width(20) .fillColor(Color.Gray) Text('开灯') .fontColor(Color.Gray) } .border({ color: Color.Gray }) } .padding({...
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/08.内外边距.ets#L8-L32
c00bcd8e87ced5ecc17272b712904767e8fdbcf9
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets
arkts
musicColumn
自定义音乐专栏
@Builder musicColumn(columnName: Resource) { Row() { Text(columnName) .fontSize($r('app.float.mini_player_animation_music_column_font_size')) .fontWeight(FontWeight.Bold) Blank() Text($r('app.string.mini_player_animation_music_column_more')) .fontSize($r('app.float.mini_p...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right musicColumn AST#parameter_list#Left ( AST#parameter#Left columnName : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_...
@Builder musicColumn(columnName: Resource) { Row() { Text(columnName) .fontSize($r('app.float.mini_player_animation_music_column_font_size')) .fontWeight(FontWeight.Bold) Blank() Text($r('app.string.mini_player_animation_music_column_more')) .fontSize($r('app.float.mini_p...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L242-L286
8bce838267a9aae578e295c4bb752bdf3e7961df
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/data/Repository.ets
arkts
getLibraryMediaList
获取指定媒体库中的媒体列表 @param id 媒体库id @param types 媒体类型 @param recursive 是否递归 @returns
public getLibraryMediaList(id: string, types: Array<FinItemType>, recursive: boolean, index?: number): Promise<FinPage> { return this.requireApi().getItemList(id, types, recursive, index) }
AST#method_declaration#Left public getLibraryMediaList AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left types : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
public getLibraryMediaList(id: string, types: Array<FinItemType>, recursive: boolean, index?: number): Promise<FinPage> { return this.requireApi().getItemList(id, types, recursive, index) }
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/data/Repository.ets#L70-L72
f7fbe7b108dacdc1d940bbdef49c1aa94ecd49e7
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
arkts
networkListen
[End net_con_unregister] [Start function_network_listen]
networkListen() { this.netCon = connection.createNetConnection(); this.netCon.register((error: BusinessError) => { if (error) { hilog.error(0x0000, 'Sample', 'networkListen fail: %{public}s', JSON.stringify(error)); return; } }); this.netCon.on('netAvailable', (data: connect...
AST#method_declaration#Left networkListen AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . netCon AST#member_expression#Right =...
networkListen() { this.netCon = connection.createNetConnection(); this.netCon.register((error: BusinessError) => { if (error) { hilog.error(0x0000, 'Sample', 'networkListen fail: %{public}s', JSON.stringify(error)); return; } }); this.netCon.on('netAvailable', (data: connect...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L59-L98
b299daaa315782595d0547d93f2340e3206a83bc
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/common/AccountData.ets
arkts
generateId
生成唯一ID
static generateId(): string { return Date.now().toString() + Math.random().toString(36).substring(2, 9); }
AST#method_declaration#Left static generateId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expressi...
static generateId(): string { return Date.now().toString() + Math.random().toString(36).substring(2, 9); }
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/common/AccountData.ets#L39-L41
2733ab9fa054ab5167bd301c0bae9104769a5a46
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WebApplicationJump/entry/src/main/ets/pages/Navigation2.ets
arkts
Navigation3
[End link1]
@Component export struct Navigation3 { @Consume('navPathStack') navPathStack: NavPathStack; private controller: WebviewController = new webview.WebviewController; private context = this.getUIContext().getHostContext() as common.UIAbilityContext; build() { // [Start link3] Navigation(this.navPathStack) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct Navigation3 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'navPathStack' AST#expression#Right ) AST#decorator#Right navPathStack : AST#type_annotation#Left ...
@Component export struct Navigation3 { @Consume('navPathStack') navPathStack: NavPathStack; private controller: WebviewController = new webview.WebviewController; private context = this.getUIContext().getHostContext() as common.UIAbilityContext; build() { Navigation(this.navPathStack) { Column()...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WebApplicationJump/entry/src/main/ets/pages/Navigation2.ets#L13-L57
269f19ec6e6b552b493203e85c6ead08e20c123a
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
Offer状态枚举
export enum OfferStatus { NO_OFFER = 'no_offer', // 无offer PENDING = 'pending', // offer待定 RECEIVED = 'received', // 已收到offer ACCEPTED = 'accepted', // 已接受offer REJECTED = 'rejected' // 已拒绝offer }
AST#export_declaration#Left export AST#enum_declaration#Left enum OfferStatus AST#enum_body#Left { AST#enum_member#Left NO_OFFER = AST#expression#Left 'no_offer' AST#expression#Right AST#enum_member#Right , // 无offer AST#enum_member#Left PENDING = AST#expression#Left 'pending' AST#expression#Right AST#enum_member#Right...
export enum OfferStatus { NO_OFFER = 'no_offer', PENDING = 'pending', RECEIVED = 'received', ACCEPTED = 'accepted', REJECTED = 'rejected' }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L35-L41
9111e320608cc05b6db655090a9ea378a0c6ca8f
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
The number of margin ,font size or space
export const enum MARGIN_FONT_SIZE_SPACE { COMMON_PADDING = 4, COMMON_MARGIN = 8, FIRST_MARGIN = 10, SECOND_MARGIN = 12, THIRD_MARGIN = 14, FOURTH_MARGIN = 16, FIFTH_MARGIN = 18, SIXTH_MARGIN = 20, SEVENTH_MARGIN = 24, EIGHTH_MARGIN = 28, NINTH_MARGIN = 32, LAST_MARGIN = ...
AST#export_declaration#Left export AST#enum_declaration#Left const enum MARGIN_FONT_SIZE_SPACE AST#enum_body#Left { AST#enum_member#Left COMMON_PADDING = AST#expression#Left 4 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left COMMON_MARGIN = AST#expression#Left 8 AST#expression#Right AST#enum_member#Rig...
export const enum MARGIN_FONT_SIZE_SPACE { COMMON_PADDING = 4, COMMON_MARGIN = 8, FIRST_MARGIN = 10, SECOND_MARGIN = 12, THIRD_MARGIN = 14, FOURTH_MARGIN = 16, FIFTH_MARGIN = 18, SIXTH_MARGIN = 20, SEVENTH_MARGIN = 24, EIGHTH_MARGIN = 28, NINTH_MARGIN = 32, LAST_MARGIN = ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L136-L149
3a3f087446ee594d9e61f92794ab7a7ae756ac6a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index_backup.ets
arkts
buildNotificationCard
构建通知提醒设置卡片
@Builder buildNotificationCard() { Column({ space: 16 }) { // 卡片标题 Row() { Text('🔔') .fontSize(20) Text('通知提醒 - 新版本') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') Blank() Text('修改') .fontSize(14) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildNotificationCard 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 Column ( AST#component_parameters#Left { AST#compone...
@Builder buildNotificationCard() { Column({ space: 16 }) { Row() { Text('🔔') .fontSize(20) Text('通知提醒 - 新版本') .fontSize(18) .fontWeight(FontWeight.Bold) .fontColor('#333333') Blank() Text('修改') .fontSize(14) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index_backup.ets#L783-L843
a87522f16e5481e513b897b817aeca22be186eb6
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/view/Marquee.ets
arkts
marqueeTextBuilder
跑马灯文本Builder,开发者可以自定义文本属性如(字体大小、字体粗细、字体样式等文本属性) @param marqueeText - 文本内容
@Builder marqueeTextBuilder(marqueeText: ResourceStr) { Text(marqueeText) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right marqueeTextBuilder AST#parameter_list#Left ( AST#parameter#Left marqueeText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builde...
@Builder marqueeTextBuilder(marqueeText: ResourceStr) { Text(marqueeText) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/view/Marquee.ets#L238-L241
76bda32157f2ee2c09d705b7aa109cfcb0d20814
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets
arkts
showInfo
/ 警告弹框
public static showInfo(loadingText: ResourceStr) { JhProgressHUD._showToast(loadingText, _ToastType.info) }
AST#method_declaration#Left public static showInfo AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme...
public static showInfo(loadingText: ResourceStr) { JhProgressHUD._showToast(loadingText, _ToastType.info) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L64-L66
a7bf4b31413c2e6cae95f3a7e0323c2b69dce874
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/settings/SettingsService.ets
arkts
upgradeSettings
升级设置 @returns 升级后的设置
async upgradeSettings(): Promise<AppSettings> { try { const currentSettings = await this.getSettings(); const upgradedSettings = this.migrateSettings(currentSettings); await this.saveSettings(upgradedSettings); this.settings = upgradedSettings; hilog.info(LogConstants.DOMAIN_AP...
AST#method_declaration#Left async upgradeSettings 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 AppSettings AST#primary_type#Right AST#type_annotation#Right > AS...
async upgradeSettings(): Promise<AppSettings> { try { const currentSettings = await this.getSettings(); const upgradedSettings = this.migrateSettings(currentSettings); await this.saveSettings(upgradedSettings); this.settings = upgradedSettings; hilog.info(LogConstants.DOMAIN_AP...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/settings/SettingsService.ets#L447-L462
b54ced98cb3b28ced8efafcdcea3870fee06936d
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/DynamicUtil.ets
arkts
@Author csx @DateTime 2024/3/20 21:19 @TODO DynamicUtil 动态协商工具类
export class DynamicUtil { /** * 动态协商密钥 * @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流 * @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流 * @param symAlgName 秘钥规格 * @returns 共享密钥 */ static async dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string, keyName: num...
AST#export_declaration#Left export AST#class_declaration#Left class DynamicUtil AST#class_body#Left { /** * 动态协商密钥 * @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流 * @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流 * @param symAlgName 秘钥规格 * @returns 共享密钥 */ AST#method_declaration#Left static async dynami...
export class DynamicUtil { static async dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string, keyName: number): Promise<OutDTO<string>> { let pubKeyArray: Uint8Array = new Uint8Array(); let priKeyArray: Uint8Array = new Uint8Array(); if (typeof pubK...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/DynamicUtil.ets#L29-L100
137ce294c7582636f93f0a35f498d4ad5d342643
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/init_process.ets
arkts
load_homepage_background
Read and set image for homepage from disk, using a worker. @param storage The LocalStorage.
function load_homepage_background(filesDir: string, storage: LocalStorage) { let workerInstance = new worker.ThreadWorker("home/ets/workers/Homepage_background_loader.ets"); workerInstance.onmessage = (e: MessageEvents): void => { // Coming back with the pixelMap let pm = e.data as sendableImage.PixelMap; ...
AST#function_declaration#Left function load_homepage_background AST#parameter_list#Left ( AST#parameter#Left filesDir : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storage : AST#type_annotation#Left AST#primary_type#Left...
function load_homepage_background(filesDir: string, storage: LocalStorage) { let workerInstance = new worker.ThreadWorker("home/ets/workers/Homepage_background_loader.ets"); workerInstance.onmessage = (e: MessageEvents): void => { let pm = e.data as sendableImage.PixelMap; try { AppStorage.setOrC...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/init_process.ets#L211-L228
fe3d1dce7b806f9719e8f9f524ced982e3167b53
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/constants/AppConstants.ets
arkts
存储相关常量
export class StorageConstants { // 首选项存储键名 static readonly PREFERENCES_NAME = 'birthday_reminder_prefs'; // 存储键 static readonly THEME_MODE = 'theme_mode'; static readonly LANGUAGE = 'language'; static readonly NOTIFICATION_ENABLED = 'notification_enabled'; static readonly REMINDER_TIME = 'reminder_time...
AST#export_declaration#Left export AST#class_declaration#Left class StorageConstants AST#class_body#Left { // 首选项存储键名 AST#property_declaration#Left static readonly PREFERENCES_NAME = AST#expression#Left 'birthday_reminder_prefs' AST#expression#Right ; AST#property_declaration#Right // 存储键 AST#property_declaration#Left ...
export class StorageConstants { static readonly PREFERENCES_NAME = 'birthday_reminder_prefs'; static readonly THEME_MODE = 'theme_mode'; static readonly LANGUAGE = 'language'; static readonly NOTIFICATION_ENABLED = 'notification_enabled'; static readonly REMINDER_TIME = 'reminder_time'; static read...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L22-L100
4f23baf746d3254e368106a125c9e80c0bc31a5e
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/LLMConfigManager.ets
arkts
saveConfigs
保存配置
private async saveConfigs(): Promise<void> { try { await StorageUtils.putObject(this.STORAGE_KEY, this.configs); hilog.info(0x0000, 'LLMConfigManager', 'Configs saved successfully'); } catch (error) { hilog.error(0x0000, 'LLMConfigManager', 'Failed to save configs: %{public}s', (error as Error...
AST#method_declaration#Left private async saveConfigs 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...
private async saveConfigs(): Promise<void> { try { await StorageUtils.putObject(this.STORAGE_KEY, this.configs); hilog.info(0x0000, 'LLMConfigManager', 'Configs saved successfully'); } catch (error) { hilog.error(0x0000, 'LLMConfigManager', 'Failed to save configs: %{public}s', (error as Error...
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/LLMConfigManager.ets#L89-L96
aaf01e1f6f225c29f026ede0e379104824af53bb
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
refreshBirthdayInfo
刷新生日信息(用于定期更新年龄和倒计时)
refreshBirthdayInfo(): Contact { const birthday = this.contact.birthday; const refreshedInfo = ContactModel.createBirthdayInfo({ date: birthday.date, isLunar: birthday.isLunar, year: birthday.year, month: birthday.month, day: birthday.day, age: birthday.age, lunarDate: ...
AST#method_declaration#Left refreshBirthdayInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left bi...
refreshBirthdayInfo(): Contact { const birthday = this.contact.birthday; const refreshedInfo = ContactModel.createBirthdayInfo({ date: birthday.date, isLunar: birthday.isLunar, year: birthday.year, month: birthday.month, day: birthday.day, age: birthday.age, lunarDate: ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L275-L290
41b7da653950038949a842719acf942069410ce3
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets
arkts
netQualityListen
[End toggle_low_definition] [Start net_quality_listen]
netQualityListen() { try { netQuality.on('netQosChange', (list: Array<netQuality.NetworkQos>) => { if (list.length > 0) { list.forEach((qos) => { // Callback information processing hilog.info(0x0000, 'Sample', 'Succeeded receive netQosChange info: %{public}s', JSON.st...
AST#method_declaration#Left netQualityListen 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#memb...
netQualityListen() { try { netQuality.on('netQosChange', (list: Array<netQuality.NetworkQos>) => { if (list.length > 0) { list.forEach((qos) => { hilog.info(0x0000, 'Sample', 'Succeeded receive netQosChange info: %{public}s', JSON.stringify(qos)); let low...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/ListeningNetworkStatus.ets#L132-L152
72010e21327f10afa98292f0c6fa242b4b43fae4
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/Index.ets
arkts
WebPageSnapshotComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export {WebPageSnapshotComponent}from './src/main/ets/components/mainpage/MainPage';
AST#export_declaration#Left export { WebPageSnapshotComponent } from './src/main/ets/components/mainpage/MainPage' ; AST#export_declaration#Right
export {WebPageSnapshotComponent}from './src/main/ets/components/mainpage/MainPage';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/Index.ets#L15-L15
5bde2344a72da31b79d98f434f03304f893d2693
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/AccountStoreRepository.ets
arkts
@file 账号密码本地存储仓库,封装存取逻辑 @author Joker.X
export class AccountStoreRepository { /** * 本地数据源实例 */ private dataSource: AccountStoreDataSource; /** * 构造函数 * @param {common.Context} context UIAbility 上下文 * @param {AccountStoreDataSource} [dataSource] 可选自定义数据源 */ constructor(context: common.Context, dataSource?: AccountStoreDataSource) { ...
AST#export_declaration#Left export AST#class_declaration#Left class AccountStoreRepository AST#class_body#Left { /** * 本地数据源实例 */ AST#property_declaration#Left private dataSource : AST#type_annotation#Left AST#primary_type#Left AccountStoreDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property...
export class AccountStoreRepository { private dataSource: AccountStoreDataSource; constructor(context: common.Context, dataSource?: AccountStoreDataSource) { this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context); } saveAccount(account: string): Promise<void> { return this.da...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AccountStoreRepository.ets#L8-L56
b1b9e14643f5a8868e9159dfba268ce0f0cd601a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
entry/src/main/ets/pages/scrollingCharts/data/Nlogn.ets
arkts
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export default class Nlogn { public data: number[] = [ 0.0, //#0 -0.14978661516463596, //#1 -0.2302585112404076, //#2 -0.28456800308013386, //#3 -0.32188758430308656, //#4 -0.34657359027997264, //#5 -0.36119184372932583, //#6 -0.36743774476238833, //#7 -0.3665162897559837, //#8 ...
AST#export_declaration#Left export default AST#class_declaration#Left class Nlogn AST#class_body#Left { AST#property_declaration#Left public data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AS...
export default class Nlogn { public data: number[] = [ 0.0, -0.14978661516463596, -0.2302585112404076, -0.28456800308013386, -0.32188758430308656, -0.34657359027997264, -0.36119184372932583, -0.36743774476238833, -0.3665162897559837, -0.359328453690093, -0.3465735...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/data/Nlogn.ets#L16-L119
f401c99653f84bfdf284de49c544b00c325e2748
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets
arkts
addScheduleInfo
新建日程页面
@Builder addScheduleInfo() { Column({ space: COLUMN_SPACE }) { Row() { Text($r('app.string.calendar_switch_cancel')) .fontSize($r('app.integer.calendar_switch_size_eighteen')) .fontColor(Color.Red) .onClick(() => { this.isShow = false; }) T...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right addScheduleInfo 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 Column ( AST#component_parameters#Left { AST#component_par...
@Builder addScheduleInfo() { Column({ space: COLUMN_SPACE }) { Row() { Text($r('app.string.calendar_switch_cancel')) .fontSize($r('app.integer.calendar_switch_size_eighteen')) .fontColor(Color.Red) .onClick(() => { this.isShow = false; }) T...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets#L248-L472
574eee53dab26c30015fd2ada655fa3f63513066
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/services/MockDataService.ets
arkts
Mock数据服务 提供Demo所需的示例数据 商品数据模型
export interface Product { id: string; name: string; price: number; originalPrice?: number; image: string; description: string; stock: number; category: string; rating: number; sales: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface Product AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AST#pri...
export interface Product { id: string; name: string; price: number; originalPrice?: number; image: string; description: string; stock: number; category: string; rating: number; sales: number; }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/services/MockDataService.ets#L7-L18
63a4be876781401ec027b6abadbe66c7e1bf89f5
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
unitArray2String
将字节流以16进制字符串输出 @param arr Uint8Array数组 @param isC1C3C2 是否需要输出为C1C3C2格式的字符串,true需要 @returns 字符串
static unitArray2String(arr: Uint8Array, isC1C3C2?: boolean): string { //转换成可以读懂的字符串 let asn1Str = buffer.from(arr).toString('hex'); if (isC1C3C2) { asn1Str = new SM2Convert().d2i(asn1Str); } return asn1Str; }
AST#method_declaration#Left static unitArray2String AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isC1C3C2 ? : AST#type_annotation#Left AST#primary_type#Left boolean A...
static unitArray2String(arr: Uint8Array, isC1C3C2?: boolean): string { let asn1Str = buffer.from(arr).toString('hex'); if (isC1C3C2) { asn1Str = new SM2Convert().d2i(asn1Str); } return asn1Str; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/StrAndUintUtil.ets#L46-L53
f135b68ce279b583f3d75724e93ded1492a756d9
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/media/MediaManager.ets
arkts
stop
停止播放
stop(): void { this.playerState.isPlaying = false; this.playerState.currentTime = 0; Logger.info('MediaManager', 'Playback stopped'); }
AST#method_declaration#Left stop 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_expres...
stop(): void { this.playerState.isPlaying = false; this.playerState.currentTime = 0; Logger.info('MediaManager', 'Playback stopped'); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/media/MediaManager.ets#L60-L64
1aa5a804214a11597ec1acdadcc9c23cff1a7236
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets
arkts
setColorSpaceBeforeCommitConfig
设置色彩空间。
function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: number): void { let colorSpace: colorSpaceManager.ColorSpace = isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT; let colorSpaces: colorSpaceManager.ColorSpace[] = getSupportedColorSpaces...
AST#function_declaration#Left function setColorSpaceBeforeCommitConfig AST#parameter_list#Left ( AST#parameter#Left session : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . VideoSession AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p...
function setColorSpaceBeforeCommitConfig(session: camera.VideoSession, isHdr: number): void { let colorSpace: colorSpaceManager.ColorSpace = isHdr ? colorSpaceManager.ColorSpace.BT2020_HLG_LIMIT : colorSpaceManager.ColorSpace.BT709_LIMIT; let colorSpaces: colorSpaceManager.ColorSpace[] = getSupportedColorSpaces...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/AVCodec/entry/src/main/ets/recorder/Recorder.ets#L116-L129
d15b03fa0e1648852e50af3cdda5894fa9e414ac
gitee
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
product/phone/src/main/ets/pages/passwordSetting.ets
arkts
showClosePasswordDialog
------------------------------ Dialog --------------------------- Close password dialog @param item password setting item
showClosePasswordDialog(delItem: PasswordSettingItem) { AlertDialog.show({ title: $r("app.string.password_disable_password"), message: $r("app.string.password_disable_prompt"), primaryButton: { value: $r('app.string.cancel'), action: () => { LogUtil.info(this.TAG_PAGE + ...
AST#method_declaration#Left showClosePasswordDialog AST#parameter_list#Left ( AST#parameter#Left delItem : AST#type_annotation#Left AST#primary_type#Left PasswordSettingItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_st...
showClosePasswordDialog(delItem: PasswordSettingItem) { AlertDialog.show({ title: $r("app.string.password_disable_password"), message: $r("app.string.password_disable_prompt"), primaryButton: { value: $r('app.string.cancel'), action: () => { LogUtil.info(this.TAG_PAGE + ...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/passwordSetting.ets#L271-L296
4e993654a7fdaf4f92dad961f45d18c0bfa4ece8
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/AboutSample/entry/src/main/ets/view/LogoAndVersionComponent.ets
arkts
LogoAndVersionComponent
Logo and version component on top page.
@Component export struct LogoAndVersionComponent { build() { Column() { Image($r("app.media.ic_logo")) .height($r('app.float.image_height')) .width($r('app.float.image_width')) .borderRadius($r('app.float.icon_radius')) Text($r('app.string.icon_name')) .fontSize($r('app...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct LogoAndVersionComponent AST#component_body#Left { 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_conte...
@Component export struct LogoAndVersionComponent { build() { Column() { Image($r("app.media.ic_logo")) .height($r('app.float.image_height')) .width($r('app.float.image_width')) .borderRadius($r('app.float.icon_radius')) Text($r('app.string.icon_name')) .fontSize($r('app...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/AboutSample/entry/src/main/ets/view/LogoAndVersionComponent.ets#L6-L30
83b1eef079fde33078000a4f39a5eac699fe102f
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/view/GoodsSearchPage.ets
arkts
GoodsSearchPage
@file 商品搜索页面视图 @author Joker.X
@ComponentV2 export struct GoodsSearchPage { /** * 商品搜索页面 ViewModel */ @Local private vm: GoodsSearchViewModel = new GoodsSearchViewModel(); /** * 构建商品搜索页面 * @returns {void} 无返回值 */ build() { AppNavDestination({ title: "商品搜索", viewModel: this.vm }) { this.GoodsSearchC...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsSearchPage 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 Good...
@ComponentV2 export struct GoodsSearchPage { @Local private vm: GoodsSearchViewModel = new GoodsSearchViewModel(); build() { AppNavDestination({ title: "商品搜索", viewModel: this.vm }) { this.GoodsSearchContent(); } } @Builder private GoodsSearchContent() { Text("商品...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsSearchPage.ets#L8-L37
49c30428f587d85425d6b15c24ff8892c945f748
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/utils/CalculatePixelUtils.ets
arkts
Copyright (C) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export namespace CalculatePixelUtils { export function createInt2DArray(first_len: number, second_len: number): Array<Array<number>> { let array = new Array<Array<number>>(); for (let f = 0; f < first_len; f++) { let s1 = new Array<number>(); for (let s = 0; s < second_len; s++) { s1.push...
AST#export_declaration#Left export AST#ERROR#Left namespace CalculatePixelUtils { export AST#ERROR#Right AST#function_declaration#Left function createInt2DArray AST#parameter_list#Left ( AST#parameter#Left first_len : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right...
export namespace CalculatePixelUtils { export function createInt2DArray(first_len: number, second_len: number): Array<Array<number>> { let array = new Array<Array<number>>(); for (let f = 0; f < first_len; f++) { let s1 = new Array<number>(); for (let s = 0; s < second_len; s++) { s1.push...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/utils/CalculatePixelUtils.ets#L17-L29
cabd39d9fbc653351d02c92d614246c9dd746975
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
resetIsDefault
重置默认地址
resetIsDefault() { const addressList: Address[] = []; this.myAddressList.forEach((address: Address) => { if (address.defaultFlag) { address.defaultFlag = false; } addressList.push(address); }); this.myAddressList = addressList; }
AST#method_declaration#Left resetIsDefault AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left addressList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Address [ ] AST#array_type#Right...
resetIsDefault() { const addressList: Address[] = []; this.myAddressList.forEach((address: Address) => { if (address.defaultFlag) { address.defaultFlag = false; } addressList.push(address); }); this.myAddressList = addressList; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets#L121-L130
9fa61360d4ed5392523eb44224f1ee9712caf8b1
gitee
PlushTz/ArkTS-Sample.git
dc02b37a00af35f368099052e7bc7898d6c176a7
entry/src/main/ets/pages/PersonPage.ets
arkts
PersonPage
Desc: @author lijt Created on 2024/3/5 Email: lijt@eetrust.com
@Component export struct PersonPage { build() { Column() { Toolbar({ title: '个人中心', titleColor: $r('app.color.white'), titleMode: NavigationTitleMode.Mini }).height(50).backgroundColor($r('app.color.black')) }.width('100%') .height('100%') } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PersonPage AST#component_body#Left { 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 ...
@Component export struct PersonPage { build() { Column() { Toolbar({ title: '个人中心', titleColor: $r('app.color.white'), titleMode: NavigationTitleMode.Mini }).height(50).backgroundColor($r('app.color.black')) }.width('100%') .height('100%') } }
https://github.com/PlushTz/ArkTS-Sample.git/blob/dc02b37a00af35f368099052e7bc7898d6c176a7/entry/src/main/ets/pages/PersonPage.ets#L8-L21
d4fccfb10b857b8be107a4f00781845f23e6f042
github
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/api/TargetInfoApi.type.ets
arkts
分页响应参数
export interface PageVo<T> { current: number, size: number, total: number, records: Array<T> }
AST#export_declaration#Left export AST#interface_declaration#Left interface PageVo AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#object_type#Left { AST#type_member#Left current : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right ...
export interface PageVo<T> { current: number, size: number, total: number, records: Array<T> }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/TargetInfoApi.type.ets#L122-L127
21933cd15c381116ca3a03dbe702c493b346f5ff
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
triggerVibration
触发震动
private async triggerVibration(): Promise<void> { try { if (!this.settings.vibrationEnabled) { return; } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Triggering vibration...'); // 简化的震动实现 promptAction.showToast({ message: '📳 震动提醒',...
AST#method_declaration#Left private async triggerVibration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > ...
private async triggerVibration(): Promise<void> { try { if (!this.settings.vibrationEnabled) { return; } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Triggering vibration...'); promptAction.showToast({ message: '📳 震动提醒', d...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L431-L448
e72fa67c859669ab98a8d349cc76d823c55284a8
github
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/FlawService.ets
arkts
故障管理服务类 提供故障的增删改查、确认等功能
export class FlawService { /** * 获取故障列表 * @param params 分页和筛选参数 * @returns 故障列表数据 */ static async listFlaw(params: FlawPageParam): Promise<TableDataInfo<AgvFlaw>> { try { console.info('[FlawService] 🔍 获取故障列表,参数:', JSON.stringify(params)); let queryString = `pageNum=${params.pa...
AST#export_declaration#Left export AST#class_declaration#Left class FlawService AST#class_body#Left { /** * 获取故障列表 * @param params 分页和筛选参数 * @returns 故障列表数据 */ AST#method_declaration#Left static async listFlaw AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Le...
export class FlawService { static async listFlaw(params: FlawPageParam): Promise<TableDataInfo<AgvFlaw>> { try { console.info('[FlawService] 🔍 获取故障列表,参数:', JSON.stringify(params)); let queryString = `pageNum=${params.pageNum}&pageSize=${params.pageSize}`; if (params.taskId) ...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/FlawService.ets#L57-L276
7240bccc3d8c0d49af22a9a4556f9a932d6c784c
github
yongoe1024/RdbPlus.git
4a3fc04ba5903bc1c1b194efbc557017976909dc
rdbplus/example/EmpMapper.ets
arkts
createTable
创建表 修改表结构需要控制版本 修改后数据库版本增加,且无法降低版本
static async createTable() { let db: Connection | undefined = undefined try { db = await EmpMapper.getInstance().getConnection() console.log('createTable 首次打开 版本 0'); // 初始默认 0 if (db.version === 0) { await db.execDML( `create table if not exists "t_emp" ( ...
AST#method_declaration#Left static async createTable AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left db : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Connection AST#primary_type#Right...
static async createTable() { let db: Connection | undefined = undefined try { db = await EmpMapper.getInstance().getConnection() console.log('createTable 首次打开 版本 0'); if (db.version === 0) { await db.execDML( `create table if not exists "t_emp" ( id integ...
https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/example/EmpMapper.ets#L27-L57
c8a8f9c93a6da4d37c40d0d7fc4c24df665dd568
github
EL233/WeChat-HarmonyOS.git
b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e
entry/src/main/ets/http/Api.ets
arkts
打卡接口
export function createPost(post: CreatePostData) { return instance.post('/word/post/create', post); }
AST#export_declaration#Left export AST#function_declaration#Left function createPost AST#parameter_list#Left ( AST#parameter#Left post : AST#type_annotation#Left AST#primary_type#Left CreatePostData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left ...
export function createPost(post: CreatePostData) { return instance.post('/word/post/create', post); }
https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/http/Api.ets#L27-L29
a8071bbb8c7d7c1ad4fc24b248088c3bb1fa119e
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/special_expression/not_null_001_T.ets
arkts
Introduction 非空断言操作符
export function not_null_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a!.data); }
AST#export_declaration#Left export AST#function_declaration#Left function not_null_001_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left...
export function not_null_001_T(taint_src : string) { let a = new A(taint_src); taint.Sink(a!.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/special_expression/not_null_001_T.ets#L6-L9
e38adf663bdadc1c7ad552f72dc7c3410dfecf75
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
signSegmentSync
对数据进行分段签名,同步 @param data 待签名数据 @param priKey 私钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。 @param len 自定义的数据拆分长度。 @returns
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): cryptoFramework.DataBlob { let signer = cryptoFramework.createSign(algName); signer.initSync(priKey); for (let i = 0; i < data.length; i += len) { let updateData = data.subarray(i, i + len); l...
AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified...
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string, len: number): cryptoFramework.DataBlob { let signer = cryptoFramework.createSign(algName); signer.initSync(priKey); for (let i = 0; i < data.length; i += len) { let updateData = data.subarray(i, i + len); l...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L374-L385
6bcd68be31d0025409ad7217aff96381492ffc61
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
decodeAsym
非对称解密 @param str 待解密的字符串 @param priKey 给定秘钥规格私钥 @param symAlgName 秘钥规格 @param symEncryptName 加密规格 @param keyName 密钥长度 @param keyCoding 密钥编码方式(utf8/hex/base64) @param dataCoding 入参字符串编码方式(hex/base64) @param isPem 是否为pem格式的key
static decodeAsym(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding, isPem: boolean): OutDTO<string> { //将私钥转换 let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) : ...
AST#method_declaration#Left static decodeAsym AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static decodeAsym(str: string, priKey: string, symAlgName: string, symEncryptName: string, keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding, isPem: boolean): OutDTO<string> { let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) : Crypt...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L394-L410
39e860b7d1e72cfe5cef32b72138579618d19116
gitee
Active-hue/ArkTS-Accounting.git
c432916d305b407557f08e35017c3fd70668e441
entry/src/main/ets/pages/AboutUs.ets
arkts
ContactItem
联系项组件
@Builder ContactItem(icon: string, label: string, value: string) { Row() { Text(icon) .fontSize(20) .width(36) .margin({ right: 12 }) Column() { Text(label) .fontSize(13) .fontColor('#999999') .margin({ bottom: 4 }) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right ContactItem AST#parameter_list#Left ( AST#parameter#Left icon : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left label : AST#type_annotation#Left AS...
@Builder ContactItem(icon: string, label: string, value: string) { Row() { Text(icon) .fontSize(20) .width(36) .margin({ right: 12 }) Column() { Text(label) .fontSize(13) .fontColor('#999999') .margin({ bottom: 4 }) ...
https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/AboutUs.ets#L248-L271
12619701e5b295bd49628e21b7069fcf5d7b354d
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LogUtil.ets
arkts
init
true-hilog、false-console 初始化日志参数(该方法建议在Ability里调用) @param domain @param tag @param showLog
static init(domain: number = LogUtil.domain, tag: string = LogUtil.tag, showLog: boolean = true, isHilog: boolean = true) { LogUtil.domain = domain; LogUtil.tag = tag; LogUtil.showLog = showLog; LogUtil.isHilog = isHilog; }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left LogUtil AST#expression#Right . domain AST#member_expre...
static init(domain: number = LogUtil.domain, tag: string = LogUtil.tag, showLog: boolean = true, isHilog: boolean = true) { LogUtil.domain = domain; LogUtil.tag = tag; LogUtil.showLog = showLog; LogUtil.isHilog = isHilog; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LogUtil.ets#L42-L47
52e2c83ac7d7354f59e45b0511aed491bc0a5fa9
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets
arkts
用于控制和反馈对应的NodeContainer上的节点的行为,需要与NodeContainer一起使用
export class NWebNodeController extends NodeController { private rootNode: BuilderNode<Data[]> | null = null; /** * 必须要重写的方法,用于构建节点数、返回节点挂载在对应NodeContainer中 * 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新 */ makeNode(uiContext: UIContext): FrameNode | null { if (this.rootNode) { return this.rootNo...
AST#export_declaration#Left export AST#class_declaration#Left class NWebNodeController extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private rootNode : AST#type_annotation#Left AST#union_type#Lef...
export class NWebNodeController extends NodeController { private rootNode: BuilderNode<Data[]> | null = null; makeNode(uiContext: UIContext): FrameNode | null { if (this.rootNode) { return this.rootNode.getFrameNode(); } return null; } initWeb(url: string, uiContext: UIContext, contro...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/utils/src/main/ets/utils/NWebUtils.ets#L54-L80
ccf2b049f17d1f4c04e4459777e2bfa61863c8cd
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets
arkts
@Author csx @DateTime 2024/3/18 10:33:03 @TODO SM2
export class SM2 { /** * 生成SM2的非对称密钥 * @returns SM2密钥{publicKey:公钥,privateKey:私钥} */ static async generateSM2Key(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('SM2_256'); } /** * 加密 * @param encodeStr 待加密的字符串 * @param pubKey SM2公钥 */ static async encode(str: string, ...
AST#export_declaration#Left export AST#class_declaration#Left class SM2 AST#class_body#Left { /** * 生成SM2的非对称密钥 * @returns SM2密钥{publicKey:公钥,privateKey:私钥} */ AST#method_declaration#Left static async generateSM2Key AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_typ...
export class SM2 { static async generateSM2Key(): Promise<CryptoKey> { return CryptoUtil.generateCryptoKey('SM2_256'); } static async encode(str: string, pubKey: string): Promise<string> { return CryptoUtil.encodeAsym(str, pubKey, 'SM2_256', 'SM2_256|SM3', 256); } static async decode(str: ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2.ets#L26-L131
162f8a38363ad1b0b4557e4f7fe589e4725868b9
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/YAxisRenderer.ets
arkts
linePath
Calculates the path for a grid line. @param p @param i @param positions @return
protected linePath(p: string, i: number, positions: number[]): string { p = 'M' + Utils.convertDpToPixel((this.mAxisLinePaint as LinePaint).startPoint[0]) + ' ' + Utils.convertDpToPixel(positions[i + 1]) + ' L' + Utils.convertDpToPixel(this.mViewPortHandler.contentRight()) + ' ' + Ut...
AST#method_declaration#Left protected linePath AST#parameter_list#Left ( AST#parameter#Left p : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left i : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
protected linePath(p: string, i: number, positions: number[]): string { p = 'M' + Utils.convertDpToPixel((this.mAxisLinePaint as LinePaint).startPoint[0]) + ' ' + Utils.convertDpToPixel(positions[i + 1]) + ' L' + Utils.convertDpToPixel(this.mViewPortHandler.contentRight()) + ' ' + Ut...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/YAxisRenderer.ets#L265-L277
ebfbae3e0f94aa50f079270a4737dc36c48b2543
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/DistributeDraw/entry/src/main/ets/view/CustomDialogComponent.ets
arkts
getDeviceTypeIcon
Obtains the device type icon. @param deviceType Device type. @returns Icon resource.
getDeviceTypeIcon(deviceType: deviceManager.DeviceType): Resource { if ((deviceType === deviceManager.DeviceType.PHONE) || (deviceType === deviceManager.DeviceType.UNKNOWN_TYPE)) { return $r('app.media.ic_public_devices_phone'); } else if (deviceType === deviceManager.DeviceType.TV) { return $r('app...
AST#method_declaration#Left getDeviceTypeIcon AST#parameter_list#Left ( AST#parameter#Left deviceType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left deviceManager . DeviceType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig...
getDeviceTypeIcon(deviceType: deviceManager.DeviceType): Resource { if ((deviceType === deviceManager.DeviceType.PHONE) || (deviceType === deviceManager.DeviceType.UNKNOWN_TYPE)) { return $r('app.media.ic_public_devices_phone'); } else if (deviceType === deviceManager.DeviceType.TV) { return $r('app...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/view/CustomDialogComponent.ets#L179-L187
ba8bd5dcd0902b15708e47ae80b0d6335eed0a3c
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinQ.ets
arkts
SpinQ
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinQ { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.15 @Local scale1: number = 0; @Local scale2: number = 0; @Local scale3: number = 0; @Local scale4: number = 0; @Local scale5: number = 0; @Local...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinQ AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinQ { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local round1: number = this.spinSize * 0.15 @Local scale1: number = 0; @Local scale2: number = 0; @Local scale3: number = 0; @Local scale4: number = 0; @Local scale5: number = 0; @Local...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinQ.ets#L26-L443
76183e81f725eb885911896934e235a26c304f3b
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/QuestionnaireBuilder.ets
arkts
formatDate
进行日期的转换
formatDate(dateStr: string): string { // 正则匹配日期时间结构,捕获月日和时分部分 const regex = /\d{4}-(\d{2}-\d{2}) (\d{2}:\d{2})(:\d{2})?/; const match = dateStr.match(regex); if (match && match[1] && match[2]) { // 拼接月日和时分 return `${match[1]} ${match[2]}`; } // 格式不匹配时返回原字符串 return dateStr; }
AST#method_declaration#Left formatDate AST#parameter_list#Left ( AST#parameter#Left dateStr : 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#Rig...
formatDate(dateStr: string): string { const regex = /\d{4}-(\d{2}-\d{2}) (\d{2}:\d{2})(:\d{2})?/; const match = dateStr.match(regex); if (match && match[1] && match[2]) { return `${match[1]} ${match[2]}`; } return dateStr; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/QuestionnaireBuilder.ets#L45-L55
254eae513486eef57b6c728eb22e0914345677c1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/DateUtils.ets
arkts
getDaysBetween
获取两个日期之间的天数差(兼容性方法) @param startDate 开始日期 @param endDate 结束日期 @returns 天数差
static getDaysBetween(startDate: Date, endDate: Date): number { return DateUtils.daysBetween(startDate, endDate); }
AST#method_declaration#Left static getDaysBetween AST#parameter_list#Left ( AST#parameter#Left startDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left endDate : AST#type_annotation#Left AST#primary_type#Left Date AST#prima...
static getDaysBetween(startDate: Date, endDate: Date): number { return DateUtils.daysBetween(startDate, endDate); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L317-L319
aa1b273a4f4a2a0f884ad2de38c26816d9172321
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonTipsDialog.ets
arkts
openPermissionsInSystemSettings
拉起设置指定应用页面弹窗
openPermissionsInSystemSettings(): void { logger.info('Start to open permissions in system settings.'); let context = getContext(this) as common.UIAbilityContext; let wantInfo: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'appli...
AST#method_declaration#Left openPermissionsInSystemSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call...
openPermissionsInSystemSettings(): void { logger.info('Start to open permissions in system settings.'); let context = getContext(this) as common.UIAbilityContext; let wantInfo: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'appli...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/components/CommonTipsDialog.ets#L63-L84
62150e6ca2b4798a7c025d022afcbe202886987e
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history_index.ets
arkts
add_index_key_string
Pushes a timestamp to the end of values of str (keys). @param key the SINGLE, SPECIFIC key. @param timestamp the timestamp. @param check_month set true to check if this action fits in the currently opened month in bunch_of_history_index_lite.
static add_index_key_string(key: string, timestamp: number, check_month: boolean) { if (check_month) { const current_year: number = new Date(timestamp).getUTCFullYear(); const current_month: number = new Date(timestamp).getUTCMonth() + 1; if (index_file_name_of_month(current_year, current_month) !...
AST#method_declaration#Left static add_index_key_string AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timestamp : AST#type_annotation#Left AST#primary_type#Left number AST...
static add_index_key_string(key: string, timestamp: number, check_month: boolean) { if (check_month) { const current_year: number = new Date(timestamp).getUTCFullYear(); const current_month: number = new Date(timestamp).getUTCMonth() + 1; if (index_file_name_of_month(current_year, current_month) !...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history_index.ets#L106-L131
75fe6ad9619afb980ed837311c27c64101c05074
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/entity/Order.ets
arkts
@file 订单信息 @author Joker.X
export class Order { /** * ID */ id: number = 0; /** * 用户ID */ userId: number = 0; /** * 标题 */ title?: string | null = null; /** * 支付方式 0-待支付 1-微信 2-支付宝 */ payType: number = 0; /** * 支付时间 */ payTime?: string | null = null; /** * 订单号 */ orderNum: string = ""; ...
AST#export_declaration#Left export AST#class_declaration#Left class Order AST#class_body#Left { /** * ID */ AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declarat...
export class Order { id: number = 0; userId: number = 0; title?: string | null = null; payType: number = 0; payTime?: string | null = null; orderNum: string = ""; status: number = 0; price: number = 0; discountPrice: number = 0; realPrice: number = 0; discountSourc...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/entity/Order.ets#L9-L131
db04bc129d6e336edcfc0ad34d5101f41c68d8ab
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoThumbListView.ets
arkts
VideoThumbListView
视频帧图片列表预览组件
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; scroller: Scroller = new Scroller(); build() { Column() { List({ space: 0, initialIndex: 0, scroller: this.scroller }) { // TODO: 性能知识点:使用ForEach组件循环渲染数据 ForEach(this.mVideoThumbOption.videoThumbs, ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoThumbListView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mVideoThumbOption : AST#type_annotation#Left AST#primary_type#Left VideoThumbOption AST#primary_...
@Component export struct VideoThumbListView { @Link mVideoThumbOption: VideoThumbOption; scroller: Scroller = new Scroller(); build() { Column() { List({ space: 0, initialIndex: 0, scroller: this.scroller }) { ForEach(this.mVideoThumbOption.videoThumbs, (item: ThumbContent, index?: num...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoThumbListView.ets#L20-L48
bbaf3bb2179860c6c577b869e79af1816500cc6c
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets
arkts
startPlay
开始播放录音 @param text - 要播放的录音关联文本
async startPlay(text?: string): Promise<void> { if (!text) return; this.soundName = text; await this.startPlaying(); }
AST#method_declaration#Left async startPlay AST#parameter_list#Left ( AST#parameter#Left text ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left P...
async startPlay(text?: string): Promise<void> { if (!text) return; this.soundName = text; await this.startPlaying(); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordManager.ets#L75-L79
5669d6736c5889fa6ebd9624631993cee3fdb5b1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/backgroundblur/src/main/ets/pages/TabsSample.ets
arkts
myContent
功能介绍:在一些主页的场景中,为了实现更好的视觉体验,会给TabBar加上透明的背景模糊效果。 推荐场景:为了体验需要实现模糊效果的场景,例如购物商场的主页下方的TabBar效果。 核心组件:CustomTabsComponent.ets 实现步骤: 1.使用backgroundBrightness和backgroundBlurStyleTabBar属性实现TabBar背景模糊效果: 在自定义的TabBar实现中,添加backgroundBrightness和backgroundBlurStyleTabBar属性,实现透明模糊效果。其中backgroundBrightness 属性可以控制背景的亮度等效果,background...
@Builder function myContent(info: string) { Text(info) .fontSize(24) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function myContent AST#parameter_list#Left ( AST#parameter#Left info : 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#builde...
@Builder function myContent(info: string) { Text(info) .fontSize(24) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/backgroundblur/src/main/ets/pages/TabsSample.ets#L37-L41
01aef3da4850d4d9881d95a0788150da53592285
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
product/oh/base/src/main/ets/pages/index.ets
arkts
checkNewVersionIfNeed
执行搜包
private async checkNewVersionIfNeed(): Promise<void> { this.log('checkNewVersionIfNeed.'); this.uiCheckLoop(true); this.checkLoopTimes = 0; this.notifyNewVersionStatus(NewVersionStatus.CHECKING); let upgradeData: UpgradeData<OtaStatus> = await OtaUpdateManager.getInstance().getOtaStatus(); let o...
AST#method_declaration#Left private async checkNewVersionIfNeed 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#Rig...
private async checkNewVersionIfNeed(): Promise<void> { this.log('checkNewVersionIfNeed.'); this.uiCheckLoop(true); this.checkLoopTimes = 0; this.notifyNewVersionStatus(NewVersionStatus.CHECKING); let upgradeData: UpgradeData<OtaStatus> = await OtaUpdateManager.getInstance().getOtaStatus(); let o...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/product/oh/base/src/main/ets/pages/index.ets#L116-L139
a959079dfa8401d12dcc34cf40b86545bfbb654b
gitee
Autumnker/ArkTS_FreeKnowledgeChat.git
cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7
entry/src/main/ets/model/userModel.ets
arkts
注册函数
export function register(user: User): boolean { const existingUser = users.find(u => u.username === user.username); if (existingUser) { return false; // 用户已存在 } users.push(user); return true; }
AST#export_declaration#Left export AST#function_declaration#Left function register AST#parameter_list#Left ( AST#parameter#Left user : AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primar...
export function register(user: User): boolean { const existingUser = users.find(u => u.username === user.username); if (existingUser) { return false; } users.push(user); return true; }
https://github.com/Autumnker/ArkTS_FreeKnowledgeChat.git/blob/cfbe354ba6ac3bc03f23484aa102dfc41c8b64e7/entry/src/main/ets/model/userModel.ets#L11-L18
2c0d3660f6a22f3f75fff0fbd5f947f152381f18
github
wuyuanwuhui99/harmony-arkts-music-app-ui.git
fc75b993b76293666f9122f527ea3bc6caf7f75c
entry/src/main/ets/components/CommentComponent.ets
arkts
openInputDialog
@author: wuwenqiang @description: 打开评论框弹窗 @date: 2024-05-26 14:26
openInputDialog(): void { if (!this.dialogController) { this.dialogController = new CustomDialogController({ customStyle: true, builder: BottomDialogComponent({ dialogHeight: 'auto', builder: this.buildCommentInput.bind(this) }), alignment: DialogAlignment.B...
AST#method_declaration#Left openInputDialog AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#member_e...
openInputDialog(): void { if (!this.dialogController) { this.dialogController = new CustomDialogController({ customStyle: true, builder: BottomDialogComponent({ dialogHeight: 'auto', builder: this.buildCommentInput.bind(this) }), alignment: DialogAlignment.B...
https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/CommentComponent.ets#L56-L68
d7889ec6fd382be7e8cb4301d6dee090ee7ea371
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/StateManagement/entry/src/main/ets/segment/segment5.ets
arkts
appendMsg
Define methods for changing state variables (intermediate variables are manipulated during method execution, state variables are modified only once)
appendMsg(newMsg: string) { let message = this.message; message += newMsg; message += ';'; message += '<br/>'; this.message = message; }
AST#method_declaration#Left appendMsg AST#parameter_list#Left ( AST#parameter#Left newMsg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left le...
appendMsg(newMsg: string) { let message = this.message; message += newMsg; message += ';'; message += '<br/>'; this.message = message; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment5.ets#L27-L33
76bfb11753dff2990127a3c2b47a6ed169e80468
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/UserDbSuperAccess.ets
arkts
MARK: - WordUser 数据库访问类
export abstract class UserDbSuperAccess { protected db: DBAccessor | null = null; abstract createDbIfNeeds() constructor() { this.refreshDb() } getDbFolder(): string { return BookManager.getCurrentDirectoryOfUserData() } getDbPath(): string { return BookManager.getCurrentPathOfUserData()...
AST#export_declaration#Left export AST#class_declaration#Left abstract class UserDbSuperAccess AST#class_body#Left { AST#property_declaration#Left protected db : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DBAccessor AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#u...
export abstract class UserDbSuperAccess { protected db: DBAccessor | null = null; abstract createDbIfNeeds() constructor() { this.refreshDb() } getDbFolder(): string { return BookManager.getCurrentDirectoryOfUserData() } getDbPath(): string { return BookManager.getCurrentPathOfUserData()...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/UserDbSuperAccess.ets#L6-L28
914994fb68dbede429e0a882b85893031edf8cda
github
njkndxz/learn-ArkTs.git
70fabab8ee28e3637329d53a4ec93afc72a001c2
entry/src/main/ets/pages/学习/30.泛型.ets
arkts
getLens
练习1, 定义函数,参数是数组类型不定,返回数组长度
function getLens<T>(arr: T[]): number { return arr.length }
AST#function_declaration#Left function getLens 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 getLens<T>(arr: T[]): number { return arr.length }
https://github.com/njkndxz/learn-ArkTs.git/blob/70fabab8ee28e3637329d53a4ec93afc72a001c2/entry/src/main/ets/pages/学习/30.泛型.ets#L16-L18
bce29a284db4861d9de58bad36623d1a48fc286c
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/TabsView.ets
arkts
TabsView
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct TabsView { @State fontColor: string = '#182431' @State selectedFontColor: string = '#007DFF' @State currentIndex: number = 0 private controller: TabsController = new TabsController() @Link _position: Position; private componentKey: string; @Builder TabBuilder(index: number, name:...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabsView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right fontColor : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat...
@Component export struct TabsView { @State fontColor: string = '#182431' @State selectedFontColor: string = '#007DFF' @State currentIndex: number = 0 private controller: TabsController = new TabsController() @Link _position: Position; private componentKey: string; @Builder TabBuilder(index: number, name:...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_seven/ace_ets_component_common_seven_attrs_brightness/entry/src/main/ets/MainAbility/view/position/TabsView.ets#L16-L72
f94f443ff9735f820579e1fa2b877d2bee46ded8
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/component/OrderCard.ets
arkts
buildActionBar
构建底部操作栏 @returns {void} 无返回值
@Builder private buildActionBar(): void { RowEndCenter({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium") }) { OrderButtons({ order: this.order, onCancelClick: this.onCancelClick, onPayClick: this.toPay, onRefundClick: this.toRefund, ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private buildActionBar 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#arkts_ui_element#Left AST#u...
@Builder private buildActionBar(): void { RowEndCenter({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium") }) { OrderButtons({ order: this.order, onCancelClick: this.onCancelClick, onPayClick: this.toPay, onRefundClick: this.toRefund, ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/component/OrderCard.ets#L155-L172
e9062aab841ea9604136ea46850a593b43326e29
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
eventbus/src/main/ets/EventBusCore.ets
arkts
removeSticky
移除粘性事件 @param eventName
removeSticky(eventName: string): void { if (EventBusCore.stickyData.get(eventName)) { EventBusCore.stickyData.delete(eventName); } }
AST#method_declaration#Left removeSticky AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R...
removeSticky(eventName: string): void { if (EventBusCore.stickyData.get(eventName)) { EventBusCore.stickyData.delete(eventName); } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L144-L148
eb3dcf732c9966def6086d8f61f351ff3802f627
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets
arkts
initWeb
此函数为自定义函数,可作为初始化函数使用 通过UIContext初始化BuilderNode,再通过BuilderNode中的build接口初始化@Builder中的内容
initWeb(url:ResourceStr, uiContext:UIContext, control:WebviewController) { if (this.rootnode != null) { return; } // 创建节点,需要uiContext this.rootnode = new BuilderNode(uiContext); // 创建动态Web组件 this.rootnode.build(wrap, { url:url, controller:control }); }
AST#method_declaration#Left initWeb AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_typ...
initWeb(url:ResourceStr, uiContext:UIContext, control:WebviewController) { if (this.rootnode != null) { return; } this.rootnode = new BuilderNode(uiContext); this.rootnode.build(wrap, { url:url, controller:control }); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets#L72-L80
0904593f7f9926387b22408ca11bc32ae673674a
gitee
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
entry/src/main/ets/common/widget/LoadingDialog.ets
arkts
LoadingDialog
加载弹窗
@CustomDialog export struct LoadingDialog { @Prop loadingTips: string @State rotateAngle: number = 0 // 弹窗控制器 controller: CustomDialogController aboutToAppear() { setTimeout(() => { this.rotateAngle = 360 }, 200) }
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct LoadingDialog AST#ERROR#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right loadingTips : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotat...
@CustomDialog export struct LoadingDialog { @Prop loadingTips: string @State rotateAngle: number = 0 controller: CustomDialogController aboutToAppear() { setTimeout(() => { this.rotateAngle = 360 }, 200) }
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/widget/LoadingDialog.ets#L4-L15
87734c596f2cb14e1671058f4836e06b5fcec809
github
Million-mo/tree-sitter-arkts.git
2fd0ad75e2d848709edcf4be038f27b178114ef6
examples/custom_builders.ets
arkts
cardStyles
全局Styles函数
@Styles function cardStyles() { .backgroundColor(Color.White) .borderRadius(12) .padding(16) .margin(8) .shadow({ radius: 8, color: '#20000000', offsetX: 0, offsetY: 2 }) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right function cardStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . backgroundColor ( AST#expression#Left AST#member_expression#Left AST#expression#Left Color...
@Styles function cardStyles() { .backgroundColor(Color.White) .borderRadius(12) .padding(16) .margin(8) .shadow({ radius: 8, color: '#20000000', offsetX: 0, offsetY: 2 }) }
https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/custom_builders.ets#L28-L40
e7bcdfe73ab55f12a06d5e52f2c4d0bc0fbbd7eb
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/OrderCacheStoreRepository.ets
arkts
clearAll
清除所有订单缓存(carts 和 selectedGoodsList) @returns {Promise<void>} Promise<void>
clearAll(): Promise<void> { return this.dataSource.clearAll(); }
AST#method_declaration#Left clearAll 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_arguments#Rig...
clearAll(): Promise<void> { return this.dataSource.clearAll(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/OrderCacheStoreRepository.ets#L64-L66
ee92bac3a70a72fc3ff3c1a687056e0ce19cca15
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/DeviceHelper.ets
arkts
isPhone
whether the device type is phone @returns true if is phone
static isPhone(): boolean { return (DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_PHONE || DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_DEFAULT); }
AST#method_declaration#Left static isPhone 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#parenthesized_e...
static isPhone(): boolean { return (DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_PHONE || DeviceHelper.DEVICE_TYPE === DeviceHelper.TYPE_DEFAULT); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_navigation/ace_ets_module_navigation_api12/entry/src/main/ets/MainAbility/pages/MultiNavigation/mainpage/DeviceHelper.ets#L38-L40
f3c1896ea961164f635126c258a33022644f102f
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
learnedWordsWhenNew
MARK: - learned words of plan /获取某天的已经学习新字
learnedWordsWhenNew(dayOf: DayOf): WordUser[] { return this.learnedWordsFor(dayOf, [BoxType.New]); }
AST#method_declaration#Left learnedWordsWhenNew AST#parameter_list#Left ( AST#parameter#Left dayOf : AST#type_annotation#Left AST#primary_type#Left DayOf 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#Left W...
learnedWordsWhenNew(dayOf: DayOf): WordUser[] { return this.learnedWordsFor(dayOf, [BoxType.New]); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L363-L365
e68e8dbc6a4f103aaee34b552a255caf59d4677c
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/model/database/PreferencesHandler.ets
arkts
set
在用户首选项中设置键值对数据。 @param key 键名 @param value 值
public async set(key: string, value: string) { if (this.preferences != null) { await this.preferences.put(key, value); await this.preferences.flush(); } }
AST#method_declaration#Left public async set AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
public async set(key: string, value: string) { if (this.preferences != null) { await this.preferences.put(key, value); await this.preferences.flush(); } }
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/model/database/PreferencesHandler.ets#L39-L44
a61e8c84b4b4184ce9a63c95ee6571d423a6d0fd
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/FileUtil.ets
arkts
getParentPath
通过URI或路径获取对应文件父目录的路径名。 @param uriOrPath URI或路径
static getParentPath(uriOrPath: string): string { let parentUri = FileUtil.getParentUri(uriOrPath); return FileUtil.getFilePath(parentUri) }
AST#method_declaration#Left static getParentPath AST#parameter_list#Left ( AST#parameter#Left uriOrPath : 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#prim...
static getParentPath(uriOrPath: string): string { let parentUri = FileUtil.getParentUri(uriOrPath); return FileUtil.getFilePath(parentUri) }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L148-L151
23dfa5c9a109e445be0ccd6540c95f994bd3d996
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets
arkts
/ 数据存储(不使用AES加密)
export class JhPreferencesUtils { /// 存 String public static saveString(key: string, value: string) { PreferencesUtil.putSync(key, value) } /// 取 String public static getString(key: string): string | null { return PreferencesUtil.getStringSync(key) } /// 存 boolean public static saveBool(key: s...
AST#export_declaration#Left export AST#class_declaration#Left class JhPreferencesUtils AST#class_body#Left { /// 存 String AST#method_declaration#Left public static saveString AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
export class JhPreferencesUtils { public static saveString(key: string, value: string) { PreferencesUtil.putSync(key, value) } public static getString(key: string): string | null { return PreferencesUtil.getStringSync(key) } public static saveBool(key: string, value: boolean) { const ne...
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/utils/JhPreferencesUtils.ets#L81-L143
70f8b8e04debcd594b0c4dc538d0adf01e072e3d
github
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Selects.ets
arkts
aboutToAppear
toggle.button按钮value 生命周期函数,创建组件实例后,执行build渲染函数之前
aboutToAppear() {}
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right
aboutToAppear() {}
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Selects.ets#L27-L27
805cf0f22260537269d2a8f7f568b70be38d20f3
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/CandleStickChartModel.ets
arkts
getCandleData
@Override
public getCandleData(): CandleData | null { return this.mData; }
AST#method_declaration#Left public getCandleData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left CandleData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statem...
public getCandleData(): CandleData | null { return this.mData; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CandleStickChartModel.ets#L68-L70
46aebb5e62c5b0c9f642561160f873be5c04123f
gitee
yiyefangzhou24/hmwechat
27d11056003843c7e331e683478720d8efa49d17
entry/src/main/ets/default/model/MessageModel.ets
arkts
用于初始化MessageData的数组
export function getMessagesDatas(): Array<MessageData> { let msgsDataArray: Array<MessageData> = [] MessagesComposition.forEach(item => { msgsDataArray.push(new MessageData(item.mid , item.wid , item.io , item.context , item.type , item.time)) }) msgsDataArray.forEach(item => { console.log('mid:'+item.m...
AST#export_declaration#Left export AST#function_declaration#Left function getMessagesDatas 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 MessageData AST#primary_ty...
export function getMessagesDatas(): Array<MessageData> { let msgsDataArray: Array<MessageData> = [] MessagesComposition.forEach(item => { msgsDataArray.push(new MessageData(item.mid , item.wid , item.io , item.context , item.type , item.time)) }) msgsDataArray.forEach(item => { console.log('mid:'+item.m...
https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/model/MessageModel.ets#L11-L25
7cd812fff61de0cf4975e755812de566b44a05b3
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
getStringSync
获取指定资源对应的字符串 @param resId 资源ID值
static getStringSync(resId: number): string { return ArkWebHelper.getContext().resourceManager.getStringSync(resId); }
AST#method_declaration#Left static getStringSync AST#parameter_list#Left ( AST#parameter#Left resId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
static getStringSync(resId: number): string { return ArkWebHelper.getContext().resourceManager.getStringSync(resId); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L21-L23
8d6ba20e8838cf5726452b2a88f3c98a39ae6fd7
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
BptaUseResources/entry/src/main/ets/pages/Gps.ets
arkts
[EndExclude gps_resources]
export default class EntryAbility extends UIAbility { // ... onForeground(): void { // Create a location request based on service requirements at the foreground let requestInfo: geoLocationManager.LocationRequest = { 'priority': geoLocationManager.LocationRequestPriority.ACCURACY, 'timeInterval'...
AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // ... AST#method_declaration#Left onForeground AST#parameter_list#Left ( ) AST#parameter_list#...
export default class EntryAbility extends UIAbility { onForeground(): void { let requestInfo: geoLocationManager.LocationRequest = { 'priority': geoLocationManager.LocationRequestPriority.ACCURACY, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0 }; let locationCh...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/Gps.ets#L18-L49
30265b55b23550b87d9e1d19f0fe2fb235464d1b
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/model/NavItemModel.ets
arkts
tabId
export enum TabId { HOME, ACHIEVEMENT, MINE }
AST#export_declaration#Left export AST#enum_declaration#Left enum TabId AST#enum_body#Left { AST#enum_member#Left HOME AST#enum_member#Right , AST#enum_member#Left ACHIEVEMENT AST#enum_member#Right , AST#enum_member#Left MINE AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declaration#...
export enum TabId { HOME, ACHIEVEMENT, MINE }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/model/NavItemModel.ets#L24-L28
c53b18111cab7cbf3a3caf8af3d389266c80d34f
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/ImageUtil.ets
arkts
arrayBuffer2PixelMap
buffer转PixelMap @param buffer @returns
static async arrayBuffer2PixelMap(buffer: ArrayBuffer): Promise<OutDTO<image.PixelMap>> { let imageSource: image.ImageSource = image.createImageSource(buffer); let res = await imageSource.createPixelMap({ editable: false }); return OutDTO.OKByDataRow<image.PixelMap>('buffer转PixelMap成功~', res); }
AST#method_declaration#Left static async arrayBuffer2PixelMap AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ...
static async arrayBuffer2PixelMap(buffer: ArrayBuffer): Promise<OutDTO<image.PixelMap>> { let imageSource: image.ImageSource = image.createImageSource(buffer); let res = await imageSource.createPixelMap({ editable: false }); return OutDTO.OKByDataRow<image.PixelMap>('buffer转PixelMap成功~', res); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImageUtil.ets#L115-L121
f6538b5aca2d606ccc2ad18bc276aa34e5d38405
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/common/ErrorHandler.ets
arkts
showErrorToast
显示错误Toast
private async showErrorToast(message: string): Promise<void> { promptAction.showToast({ message, duration: 2500 }); }
AST#method_declaration#Left private async showErrorToast AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener...
private async showErrorToast(message: string): Promise<void> { promptAction.showToast({ message, duration: 2500 }); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/common/ErrorHandler.ets#L145-L150
9003b681da0acc50fad54a24e72d886ac09a79f5
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/VoiceChannel.ets
arkts
setup
应用约束10: 显式参数和返回类型
setup(data: VoiceChannelData): void { super.setup(data); this.bitrate = data.bitrate * 0.001; this.userLimit = data.user_limit; }
AST#method_declaration#Left setup AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left VoiceChannelData 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...
setup(data: VoiceChannelData): void { super.setup(data); this.bitrate = data.bitrate * 0.001; this.userLimit = data.user_limit; }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/VoiceChannel.ets#L32-L36
7c37b78f3977824bd9f1f55339b9ecb2af1eb67d
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/template/TemplateMgr.ets
arkts
@author: HZWei @date: 2024/12/7 @desc: NavDest模版管理类
export class TemplateMgr { private _templateMap: Map<string, ILifecycleRegistry | undefined> = new Map() private _observers: Map<string, LifecycleObserver[]> = new Map() private static _instance: TemplateMgr; private constructor() { } public static getInstance(): TemplateMgr { if (!TemplateMgr._insta...
AST#export_declaration#Left export AST#class_declaration#Left class TemplateMgr AST#class_body#Left { AST#property_declaration#Left private _templateMap : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Map AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
export class TemplateMgr { private _templateMap: Map<string, ILifecycleRegistry | undefined> = new Map() private _observers: Map<string, LifecycleObserver[]> = new Map() private static _instance: TemplateMgr; private constructor() { } public static getInstance(): TemplateMgr { if (!TemplateMgr._insta...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/template/TemplateMgr.ets#L12-L106
b0dc23ed402b94f5a8090e5b34eefe2cb5741f0e
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/utils/DateHelper.ets
arkts
getDateByStr
将年月日时分秒字符串转为Date @param date @returns
static getDateByStr(containYear: boolean, containMonth: boolean, containDay: boolean, containHour: boolean, containMinute: boolean, containSecond: boolean, year: string, month: string, day: string, hour: string, minute: string, second: string,): Date { let dateStr = ''; let currentDate = new Date(); ...
AST#method_declaration#Left static getDateByStr AST#parameter_list#Left ( AST#parameter#Left containYear : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left containMonth : AST#type_annotation#Left AST#primary_type#Left boolea...
static getDateByStr(containYear: boolean, containMonth: boolean, containDay: boolean, containHour: boolean, containMinute: boolean, containSecond: boolean, year: string, month: string, day: string, hour: string, minute: string, second: string,): Date { let dateStr = ''; let currentDate = new Date(); ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/DateHelper.ets#L307-L360
5a2aba692cf90e560cda0686a2c72e332269ebb0
gitee
Vinson0709/arkdemo.git
793491fe04b387f55dadfef86b30e28d0535d994
entry/src/main/ets/pages/Buttons.ets
arkts
bodyBuilder
内容展示(自定义builder渲染)
@Builder bodyBuilder() { Column(){ // Button 类型 Text('Button 类型') .fontSize(14) .margin({ top:20, bottom: 12}) // 普通按钮 Normal Button('普通按钮 Normal', { type: ButtonType.Normal}) .fontSize(14) .buttonStyle() // Capsule Button('胶囊按钮 Capsule', { type: B...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder 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 Column ( ) AST#container_content_body#Left { // Button 类型 AST#...
@Builder bodyBuilder() { Column(){ Text('Button 类型') .fontSize(14) .margin({ top:20, bottom: 12}) Button('普通按钮 Normal', { type: ButtonType.Normal}) .fontSize(14) .buttonStyle() Button('胶囊按钮 Capsule', { type: ButtonType.Capsule}) .fontSiz...
https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Buttons.ets#L50-L160
03361f6e36d41bfceed58ef3abd21f74d9277631
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setSpaceTop
Sets the top axis space in percent of the full range. Default 10f @param percent
public setSpaceTop(percent: number): void { this.mSpacePercentTop = percent; }
AST#method_declaration#Left public setSpaceTop AST#parameter_list#Left ( AST#parameter#Left percent : 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_ty...
public setSpaceTop(percent: number): void { this.mSpacePercentTop = percent; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L335-L337
615f2f1dd5da870150c3bfb106e4760c9056ba90
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
buildGreetingsList
构建祝福语列表
@Builder buildGreetingsList() { if (this.filteredGreetings.length === 0) { if (this.searchKeyword.trim()) { SearchEmptyView({ searchKeyword: this.searchKeyword }) } else { GreetingsEmptyView({ onCreateGreeting: () => { appRouter.push(RoutePaths.GREETING_SEND); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildGreetingsList 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_expre...
@Builder buildGreetingsList() { if (this.filteredGreetings.length === 0) { if (this.searchKeyword.trim()) { SearchEmptyView({ searchKeyword: this.searchKeyword }) } else { GreetingsEmptyView({ onCreateGreeting: () => { appRouter.push(RoutePaths.GREETING_SEND); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L325-L364
48a00a94c90ee5f4bd86ae8e2844bd913a9cd816
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/CalendarApiService.ets
arkts
getFallbackCalendarInfo
获取备用日历信息
private getFallbackCalendarInfo(date: Date): CalendarInfo { const lunar = this.calculateLunarLocally(date); const festivals = this.getTraditionalFestivals(date, lunar); const solarTerm = this.getSolarTermForDate(date); // 简单判断是否节假日 const isWeekend = date.getDay() === 0 || date.getDay() === 6; c...
AST#method_declaration#Left private getFallbackCalendarInfo AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CalendarInf...
private getFallbackCalendarInfo(date: Date): CalendarInfo { const lunar = this.calculateLunarLocally(date); const festivals = this.getTraditionalFestivals(date, lunar); const solarTerm = this.getSolarTermForDate(date); const isWeekend = date.getDay() === 0 || date.getDay() === 6; const hasLega...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/CalendarApiService.ets#L456-L467
97085900497bb38716161f9974313d173076f0e8
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/utils/FileUtil.ets
arkts
TODO 文件操作相关工具类 author: 桃花镇童长老ᥫ᭡ since: 2024/05/01
export class FileUtil { static readonly separator: string = '/'; /** * 获取文件目录下的文件夹路径或文件路径。 * @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 * @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 * @param blHap true:HAP级别文件路径、 false:App级别文件路径 * @returns */ static getFilesDir...
AST#export_declaration#Left export AST#class_declaration#Left class FileUtil AST#class_body#Left { AST#property_declaration#Left static readonly separator : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '/' AST#expression#Right ; AST#propert...
export class FileUtil { static readonly separator: string = '/'; static getFilesDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { let filePath = blHap ? getContext().filesDir : getContext().getApplicationContext().filesDir; if (StrUtil.isNotEmpty(dirPath)) { i...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/FileUtil.ets#L26-L932
f8280f72df1852d8eb8c313c00ccdacb721b91f4
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/model/style/PickerSpecifyOptions.ets
arkts
picker 特殊配置
export class PickerSpecifyOptions { /** * 设置是否可循环滚动 * @default true */ canLoop: boolean = true /** * 设置Picker样式 */ style: PickerStyle = new PickerStyle() }
AST#export_declaration#Left export AST#class_declaration#Left class PickerSpecifyOptions AST#class_body#Left { /** * 设置是否可循环滚动 * @default true */ AST#property_declaration#Left canLoop AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#...
export class PickerSpecifyOptions { canLoop: boolean = true style: PickerStyle = new PickerStyle() }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/PickerSpecifyOptions.ets#L6-L16
1746f687e74f247672a86b47950a666453729250
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mock/ListCommentData.ets
arkts
模拟List组件评论数据
export function mockData(): CommentDataSource { const commentData: CommentDataSource = new CommentDataSource(); for (let j = 0; j < 18; j++) { commentData.pushData({ id: j + "", avatar:$r("app.media.list_image_a"), name: "圣火喵喵叫" + j, commentContent: "喵喵我吗?我没有看到后续,但总有人会看到" + j, time...
AST#export_declaration#Left export AST#function_declaration#Left function mockData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CommentDataSource AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declarati...
export function mockData(): CommentDataSource { const commentData: CommentDataSource = new CommentDataSource(); for (let j = 0; j < 18; j++) { commentData.pushData({ id: j + "", avatar:$r("app.media.list_image_a"), name: "圣火喵喵叫" + j, commentContent: "喵喵我吗?我没有看到后续,但总有人会看到" + j, time...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/webpagesnapshot/src/main/ets/components/mock/ListCommentData.ets#L18-L32
5390fb64b1701a186edaa2a380918eaf6d62ba7e
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets
arkts
setAVMetadata
[Start meta_data]
public async setAVMetadata(curSource: VideoData, duration: number): Promise<void> { // [StartExclude meta_data] if (curSource === undefined || this.context === undefined) { Logger.error(TAG, 'SetAVMetadata Error, curSource or context is undefined'); return; } // [EndExclude meta_data] co...
AST#method_declaration#Left public async setAVMetadata AST#parameter_list#Left ( AST#parameter#Left curSource : AST#type_annotation#Left AST#primary_type#Left VideoData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left num...
public async setAVMetadata(curSource: VideoData, duration: number): Promise<void> { if (curSource === undefined || this.context === undefined) { Logger.error(TAG, 'SetAVMetadata Error, curSource or context is undefined'); return; } const imagePixMap: image.PixelMap | undefined = await ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionController.ets#L81-L111
86d405ae901a95d428294b28d95fa0b25cc4c9fa
gitee
sea5241/PictureSelector
09bac407ebd61100d1ccbf6e6d3b6349cb0013d7
selector/src/main/ets/constants/Constants.ets
arkts
默认的title样式
export const titleStyle = new TitleStyleData() /** * 填充尺寸 */
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left titleStyle = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left TitleStyleData AST#expression#Right AST#new_expression#Right AST#expression#Right AST#argument...
export const titleStyle = new TitleStyleData()
https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/constants/Constants.ets#L8-L12
53375b30342f51638f7e7b6e205030b98f02697e
gitee