nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
getAllCarts
获取购物车中所有商品 @returns {Promise<Cart[]>} 购物车列表
getAllCarts(): Promise<Cart[]> { return this.dataSource.getAllCarts(); }
AST#method_declaration#Left getAllCarts AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Cart [ ] AST#array_type#Right AST#primary_type#Right AS...
getAllCarts(): Promise<Cart[]> { return this.dataSource.getAllCarts(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L82-L84
d48b19e5f81474f3410f97fb213907192839d6d0
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
增长趋势数据接口
export interface GrowthTrend { period: string; count: number; change: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GrowthTrend AST#object_type#Left { AST#type_member#Left period : 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 count : AST#type_annotation#Lef...
export interface GrowthTrend { period: string; count: number; change: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L185-L189
19f8cd18a213a57ae1ea2ead7df20cd0aeb2c6f5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets
arkts
initCircleRadius
设置悬浮球半径 -- 比正常半径要小一圈
initCircleRadius(): void { // 半径 this.circleRadius = this.getMinWidth() / 2 - SURPLUSRADIUS; // 直径 this.circleDiameter = this.circleRadius * 2; }
AST#method_declaration#Left initCircleRadius 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...
initCircleRadius(): void { this.circleRadius = this.getMinWidth() / 2 - SURPLUSRADIUS; this.circleDiameter = this.circleRadius * 2; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets#L109-L114
9f0035645db10811b81141ea51c50bbaf34a3e01
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
Water flow data source.
export class StickyWaterFlowDataSource implements IDataSource { public dataArray: MediaItem[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i: number = 0; i < 100; i++) { let mediaItem: MediaItem = this.createMediaItem(i); this.dataArray.push(mediaItem); } } ...
AST#export_declaration#Left export AST#class_declaration#Left class StickyWaterFlowDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left public dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left MediaItem ...
export class StickyWaterFlowDataSource implements IDataSource { public dataArray: MediaItem[] = []; private listeners: DataChangeListener[] = []; constructor() { for (let i: number = 0; i < 100; i++) { let mediaItem: MediaItem = this.createMediaItem(i); this.dataArray.push(mediaItem); } } ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L21-L105
4f4a0d6fd45445548bdcd75adda10056b861ab7f
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
onUpdateSignalChange
当更新信号变化时触发刷新
onUpdateSignalChange() { console.info('ReviewPage: onUpdateSignalChange triggered, taskUpdateSignal = ' + this.taskUpdateSignal); console.info('ReviewPage: Before update - completedTasks.length = ' + AppState.completedTasks.length); this.updateAllStatistics(); console.info('ReviewPage: After update - to...
AST#method_declaration#Left onUpdateSignalChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . info AST#mem...
onUpdateSignalChange() { console.info('ReviewPage: onUpdateSignalChange triggered, taskUpdateSignal = ' + this.taskUpdateSignal); console.info('ReviewPage: Before update - completedTasks.length = ' + AppState.completedTasks.length); this.updateAllStatistics(); console.info('ReviewPage: After update - to...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L39-L44
145c88ebd2cf974b2feaac68a3490c2ae8624259
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/SubmitForm.ets
arkts
SubmitForm
[Start button_to_log_in_or_register]
@Entry @Component export struct SubmitForm { // [StartExclude button_to_log_in_or_register] @State username: string = '' @State password: string = '' pathStack: NavPathStack = new NavPathStack(); resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct SubmitForm AST#component_body#Left { // [StartExclude button_to_log_in_or_register] AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right username ...
@Entry @Component export struct SubmitForm { @State username: string = '' @State password: string = '' pathStack: NavPathStack = new NavPathStack(); resourceToString(resource: Resource): string { return getContext(this).resourceManager.getStringSync(resource); } build() { NavDestination...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ChooseComponent/entry/src/main/ets/pages/button/SubmitForm.ets#L17-L66
7565ff1b60ac0fc9005895a4a7d71aa52c75e7a6
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets
arkts
aboutToAppear
添加歌单数据
aboutToAppear() { // 添加歌单,仅用于UX展示 for (let i = 1; i <= SONG_SHEET; i++) { this.data.pushData(i); } }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 添加歌单,仅用于UX展示 AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#...
aboutToAppear() { for (let i = 1; i <= SONG_SHEET; i++) { this.data.pushData(i); } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L130-L135
db173e256bace410ea0d6eea4e08a63ab3ef75d8
gitee
1lck/MindFlow.git
f05fab0891716cb852946ac02ed08dd2c0b9155a
front/entry/src/main/ets/pages/tabs/MineTab.ets
arkts
StatCard
统计卡片组件
@Builder StatCard(label: string, value: string, unit: string) { Column() { Text(label) .fontSize(12) .fontColor(Theme.textSub) .margin({ bottom: 8 }) Row() { Text(value) .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor(Theme.primary) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right StatCard AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#...
@Builder StatCard(label: string, value: string, unit: string) { Column() { Text(label) .fontSize(12) .fontColor(Theme.textSub) .margin({ bottom: 8 }) Row() { Text(value) .fontSize(24) .fontWeight(FontWeight.Bold) .fontColor(Theme.primary) ...
https://github.com/1lck/MindFlow.git/blob/f05fab0891716cb852946ac02ed08dd2c0b9155a/front/entry/src/main/ets/pages/tabs/MineTab.ets#L211-L236
1adc377ac0507c9c5c63a4559f1462802d1406b3
github
kico0909/crazy_miner.git
13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9
entry/src/main/ets/common/game/core/db.ets
arkts
CrazyMinerDB
全部基础数据 从云函数获取
function CrazyMinerDB(): Promise<t.TBaseDB> { return new Promise<t.TBaseDB>((resolve, reject) => { getDBFromCloudFunc<t.TBaseDB>(utils.ResourceConvertString($r('app.string.cloudFunction_db_path'))).then((req) => { setTimeout(() => { resolve(req) }, 500) }).catch((ret: http.HttpResponse) =...
AST#function_declaration#Left function CrazyMinerDB AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left t . TBaseDB AST#qualified_type#Right AS...
function CrazyMinerDB(): Promise<t.TBaseDB> { return new Promise<t.TBaseDB>((resolve, reject) => { getDBFromCloudFunc<t.TBaseDB>(utils.ResourceConvertString($r('app.string.cloudFunction_db_path'))).then((req) => { setTimeout(() => { resolve(req) }, 500) }).catch((ret: http.HttpResponse) =...
https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/db.ets#L28-L38
61b710a5cd13da54b0a2975e74f55bdbf0725746
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets
arkts
getOpen
Returns the bodys open value. @return
public getOpen(): number { return this.mOpen; }
AST#method_declaration#Left public getOpen AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expressio...
public getOpen(): number { return this.mOpen; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/CandleEntry.ets#L134-L136
5b2178dad08682195152ac2feb6f266c543f3fc2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_seg_encryption_decryption/aes_gcm_seg_encryption_decryption_synchronous.ets
arkts
encryptMessageUpdateBySegment
分段加密消息
function encryptMessageUpdateBySegment(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|GCM|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams); let updateLength = 20; // 假设以20字节为单位进行分段update,实际并无要求 let ciph...
AST#function_declaration#Left function encryptMessageUpdateBySegment AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p...
function encryptMessageUpdateBySegment(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|GCM|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams); let updateLength = 20; let cipherText = new Uint8Array(); f...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_seg_encryption_decryption/aes_gcm_seg_encryption_decryption_synchronous.ets#L48-...
d617cfcc2384e762ae18509ea17b132efd3a9807
gitee
eternaljust/Msea_HarmonyOS.git
bd83668f32138238482ee6e78f1d8e8717047a7c
entry/src/main/ets/view/ComponentExtend.ets
arkts
systemFont
HarmonyOS Sans 系统默认字体字号规范
@Extend(Text) function systemFont(category: FontCategory) { .fontSize(FontCategory.fontSize(category)) .fontWeight(FontCategory.fontWeight(category)) }
AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Text AST#expression#Right ) AST#decorator#Right function systemFont AST#parameter_list#Left ( AST#parameter#Left category : AST#type_annotation#Left AST#primary_type#Left FontCategory AST#primary_type#Right AST#type_annotation#Rig...
@Extend(Text) function systemFont(category: FontCategory) { .fontSize(FontCategory.fontSize(category)) .fontWeight(FontCategory.fontWeight(category)) }
https://github.com/eternaljust/Msea_HarmonyOS.git/blob/bd83668f32138238482ee6e78f1d8e8717047a7c/entry/src/main/ets/view/ComponentExtend.ets#L100-L103
09d651bb9b02a537dafea3382bd4a596ef8b54ef
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/view/Side.ets
arkts
发布时间
build() { Column() { Text(this.name) .fontSize($r("app.integer.shortvideo_name_font_size")) .fontWeight(FontWeight.Bold) .fontColor(Color.White) .margin({ bottom: $r("app.integer.shortvideo_name_margin_bottom") }) .onClick(() => { // 调用Toast显示提示:此样式仅为案例演示 ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#member_expression#Left A...
build() { Column() { Text(this.name) .fontSize($r("app.integer.shortvideo_name_font_size")) .fontWeight(FontWeight.Bold) .fontColor(Color.White) .margin({ bottom: $r("app.integer.shortvideo_name_margin_bottom") }) .onClick(() => { promptAction.showT...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/view/Side.ets#L233-L265
a2068519a307dc60f4a9ec09edd87b9ff532024b
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/treeview/source/treeview.ets
arkts
addImageExpand
NodeInfo add expand image @param isHasChildNode whether node has child node
addImageExpand(isHasChildNode: boolean): void { if (isHasChildNode) { this.nodeItemView.imageCollapse = CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_DOWN); } else { this.nodeItemView.imageCollapse = undefined; } }
AST#method_declaration#Left addImageExpand AST#parameter_list#Left ( AST#parameter#Left isHasChildNode : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
addImageExpand(isHasChildNode: boolean): void { if (isHasChildNode) { this.nodeItemView.imageCollapse = CollapseImageNodeFlyweightFactory.getCollapseImageNodeByType(CollapseImageType.ARROW_DOWN); } else { this.nodeItemView.imageCollapse = undefined; } }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L471-L478
965b7d2bdbd9bc81ab8565e143dad52a3d863335
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
isToday
检查是否是今天的面试
isToday(): boolean { if (!this.interviewDate) return false; const today = new Date().toISOString().split('T')[0]; return this.interviewDate === today; }
AST#method_declaration#Left isToday AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#e...
isToday(): boolean { if (!this.interviewDate) return false; const today = new Date().toISOString().split('T')[0]; return this.interviewDate === today; }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L234-L238
a7fb41452e63b3c31963141407a9d1141ec333a9
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/BusinessSample/entry/src/main/ets/viewmodel/BusinessViewModel.ets
arkts
getTabItems
Get tab items of businessCard page. @return {Array<TabItemData>} tabItems.
getTabItems(): Array<TabItemData> { let tabItems: Array<TabItemData> = []; for (let i = 0; i < CommonConstants.TAB_SIZE; i++) { let tabItem = new TabItemData(); tabItem.index = i; tabItem.imageOriginal = $r("app.media.ic_tab_normal"); tabItem.imageActivated = $r("app.media.ic_tab_activat...
AST#method_declaration#Left getTabItems 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 TabItemData AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
getTabItems(): Array<TabItemData> { let tabItems: Array<TabItemData> = []; for (let i = 0; i < CommonConstants.TAB_SIZE; i++) { let tabItem = new TabItemData(); tabItem.index = i; tabItem.imageOriginal = $r("app.media.ic_tab_normal"); tabItem.imageActivated = $r("app.media.ic_tab_activat...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/BusinessSample/entry/src/main/ets/viewmodel/BusinessViewModel.ets#L35-L46
f7378f75843a5be5085335354c486a148fa1d04b
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/common/constants/AppConstants.ets
arkts
错误相关常量
export class ErrorConstants { // 通用错误消息 static readonly ERROR_UNKNOWN = '未知错误'; static readonly ERROR_NETWORK = '网络连接失败'; static readonly ERROR_PERMISSION = '权限不足'; static readonly ERROR_DATA_NOT_FOUND = '数据不存在'; static readonly ERROR_INVALID_PARAMETER = '参数错误'; static readonly ERROR_DATABASE = '数据库操作失败';...
AST#export_declaration#Left export AST#class_declaration#Left class ErrorConstants AST#class_body#Left { // 通用错误消息 AST#property_declaration#Left static readonly ERROR_UNKNOWN = AST#expression#Left '未知错误' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly ERROR_NETWORK = ...
export class ErrorConstants { static readonly ERROR_UNKNOWN = '未知错误'; static readonly ERROR_NETWORK = '网络连接失败'; static readonly ERROR_PERMISSION = '权限不足'; static readonly ERROR_DATA_NOT_FOUND = '数据不存在'; static readonly ERROR_INVALID_PARAMETER = '参数错误'; static readonly ERROR_DATABASE = '数据库操作失败'; static...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L311-L342
183074859e1bf6d9d3182f6370abebc974c4d0b7
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/MainPage.ets
arkts
MainPage
主页面
@Entry @Component export default struct MainPage { // 定义状态变量 currentIndex,表示当前选中的 Tab 索引 @State currentIndex: number = 0; // 定义字体颜色和选中时的字体颜色 private fontColor: Resource = $r('app.color.grey_text'); private selectedFontColor: Resource = $r('app.color.red_light'); // 创建 TabsController 对象,用于管理 Tabs 组件 priv...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export default struct MainPage AST#component_body#Left { // 定义状态变量 currentIndex,表示当前选中的 Tab 索引 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex...
@Entry @Component export default struct MainPage { @State currentIndex: number = 0; private fontColor: Resource = $r('app.color.grey_text'); private selectedFontColor: Resource = $r('app.color.red_light'); private controller: TabsController = new TabsController(); @Builder TabBuilder(index: num...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/MainPage.ets#L9-L86
fffa064da821f74d4f6eea299a9aa28db5ab05ba
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
游戏化动作类型枚举
export enum GameAction { ADD_CONTACT = 'add_contact', SEND_GREETING = 'send_greeting', CREATE_AR_CARD = 'create_ar_card', SHARE_BIRTHDAY = 'share_birthday', DAILY_CHECK_IN = 'daily_check_in', CONTINUOUS_DAYS = 'continuous_days', INVITE_FRIEND = 'invite_friend', COMPLETE_PROFILE = 'complete_profile', U...
AST#export_declaration#Left export AST#enum_declaration#Left enum GameAction AST#enum_body#Left { AST#enum_member#Left ADD_CONTACT = AST#expression#Left 'add_contact' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SEND_GREETING = AST#expression#Left 'send_greeting' AST#expression#Right AST#enum_membe...
export enum GameAction { ADD_CONTACT = 'add_contact', SEND_GREETING = 'send_greeting', CREATE_AR_CARD = 'create_ar_card', SHARE_BIRTHDAY = 'share_birthday', DAILY_CHECK_IN = 'daily_check_in', CONTINUOUS_DAYS = 'continuous_days', INVITE_FRIEND = 'invite_friend', COMPLETE_PROFILE = 'complete_profile', U...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L14-L30
2e0f09274abe8cf18112e9f4cec9d99723e0b37b
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/TargetManagement/entry/src/main/ets/pages/MainPage.ets
arkts
saveTask
Save the progress value and update time after you click OK in the dialog box. @param taskName Latest Progress Value.
saveTask(taskName: string) { if (taskName === '') { promptAction.showToast({ message: $r('app.string.cannot_input_empty'), duration: CommonConstants.TOAST_TIME, bottom: CommonConstants.TOAST_MARGIN_BOTTOM }); return; } DataModel.addData(new TaskItemViewModel(taskNam...
AST#method_declaration#Left saveTask AST#parameter_list#Left ( AST#parameter#Left taskName : 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#if_statement#Left if ( AST#...
saveTask(taskName: string) { if (taskName === '') { promptAction.showToast({ message: $r('app.string.cannot_input_empty'), duration: CommonConstants.TOAST_TIME, bottom: CommonConstants.TOAST_MARGIN_BOTTOM }); return; } DataModel.addData(new TaskItemViewModel(taskNam...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/pages/MainPage.ets#L95-L108
85138904196f523e4597c6a8483b43ed8bc8ab9f
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets
arkts
cancelSandboxFile
取消沙箱保留
async cancelSandboxFile(): Promise<void> { try { let docUris: Array<string> = [this.dlpUri]; dlpPermission.cancelRetentionState(docUris); // 设置沙箱保留 promptAction.showToast({ message: 'cancel success', duration: 2000 }); } catch (err) { Logger.error(TAG, 'setRetentionState error' + (err as...
AST#method_declaration#Left async cancelSandboxFile 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#typ...
async cancelSandboxFile(): Promise<void> { try { let docUris: Array<string> = [this.dlpUri]; dlpPermission.cancelRetentionState(docUris); promptAction.showToast({ message: 'cancel success', duration: 2000 }); } catch (err) { Logger.error(TAG, 'setRetentionState error' + (err as Business...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L217-L225
9c67a6c8c5d6753f6bfcca724f15d837a8b15704
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/AESSync.ets
arkts
encodeCBC
加密-CBC模式 @param str 待加密的字符串 @param aesKey AES密钥 @param iv iv偏移量字符串 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeCBC(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, resultCoding); }
AST#method_declaration#Left static encodeCBC AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static encodeCBC(str: string, aesKey: string, iv: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): string { return CryptoSyncUtil.encodeCBC(str, aesKey, iv, 'AES256', 'AES256|CBC|PKCS7', 256, keyCoding, resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L123-L126
d0b537ea897d4521caf3f5b2e80fc7cc9bf3960e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_encryption_decryption/aes_gcm_encryption_decryption_synchronous.ets
arkts
encryptMessage
加密消息
function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|GCM|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams); let encryptUpdate = cipher.updateSync(plainText); // gcm模式加密doFinal时传入空,获得tag...
AST#function_declaration#Left function encryptMessage AST#parameter_list#Left ( AST#parameter#Left symKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . SymKey AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p...
function encryptMessage(symKey: cryptoFramework.SymKey, plainText: cryptoFramework.DataBlob) { let cipher = cryptoFramework.createCipher('AES128|GCM|PKCS7'); cipher.initSync(cryptoFramework.CryptoMode.ENCRYPT_MODE, symKey, gcmParams); let encryptUpdate = cipher.updateSync(plainText); gcmParams.authTag = ciph...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceAesArkTs/entry/src/main/ets/pages/aes_gcm_encryption_decryption/aes_gcm_encryption_decryption_synchronous.ets#L49-L56
010b4c873599154912f9fed4176b30e42304a1cd
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/ScanUtil.ets
arkts
generateBarcode
码图生成,使用Promise异步返回生成的码图。 @param content 码内容字符串 @param options 用于设置生成码图的参数: scanType 码类型。 width 码图宽,单位:px。取值范围:[200, 4096]。 height 码图高,单位:px。取值范围:[200, 4096]。 margin 边距,单位:px,默认值为1,取值范围:[1, 10]。 level 纠错水平,默认值为LEVEL_H。此参数只在生成QR码时有效。 backgroundColor 生成码图背景颜色,HEX格式颜色,默认为白色(0xffffff)。 pixelMapColor 生成码图颜色,HEX格式颜色,默认为黑色...
static generateBarcode(content: string, options?: generateBarcode.CreateOptions): Promise<image.PixelMap> { if (options === undefined) { options = { scanType: scanCore.ScanType.QR_CODE, height: 1024, width: 1024, margin: 5 }; } return generateBarcode.createBarcode...
AST#method_declaration#Left static generateBarcode AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualifi...
static generateBarcode(content: string, options?: generateBarcode.CreateOptions): Promise<image.PixelMap> { if (options === undefined) { options = { scanType: scanCore.ScanType.QR_CODE, height: 1024, width: 1024, margin: 5 }; } return generateBarcode.createBarcode...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/ScanUtil.ets#L62-L72
51a7134f3d79ff9bb7f5ebf298ac5b17e4a4a259
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets
arkts
refresh
call this method to refresh the graph with a given matrix @param newMatrix @return
public refresh(newMatrix: Matrix, chart: Chart<any>, invalidate: boolean): Matrix { this.mMatrixTouch.set(newMatrix); // make sure scale and translation are within their bounds this.limitTransAndScale(this.mMatrixTouch, this.mContentRect); if (invalidate) { chart.invalidate(); } newMatr...
AST#method_declaration#Left public refresh AST#parameter_list#Left ( AST#parameter#Left newMatrix : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left chart : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left...
public refresh(newMatrix: Matrix, chart: Chart<any>, invalidate: boolean): Matrix { this.mMatrixTouch.set(newMatrix); this.limitTransAndScale(this.mMatrixTouch, this.mContentRect); if (invalidate) { chart.invalidate(); } newMatrix.set(this.mMatrixTouch); return newMatrix; }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets#L338-L350
9354be5f475e117d864da6834cfccd28bb9e5b24
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
buildLanguageList
构建语言列表
@Builder buildLanguageList() { Column({ space: 12 }) { Text('选择语言') .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .width('100%') Column() { ForEach(this.supportedLanguages, (languageInfo: LanguageInfo, index: number) => {...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildLanguageList 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_p...
@Builder buildLanguageList() { Column({ space: 12 }) { Text('选择语言') .fontSize(16) .fontColor($r('app.color.text_primary')) .fontWeight(FontWeight.Medium) .width('100%') Column() { ForEach(this.supportedLanguages, (languageInfo: LanguageInfo, index: number) => {...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L317-L336
d48edf4fa1ec5ca8e46620e216ca74c94ab492d3
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVPlayer/MediaService/src/main/ets/controller/AvPlayerController.ets
arkts
initAVPlayer
[Start create_instance] Create an AVPlayer instance
public initAVPlayer() { media.createAVPlayer().then((player: media.AVPlayer) => { if (player !== null) { this.avPlayer = player; // this.curSource.video is the local video path, and this.curSource.url is the network video path if (this.curSource.video) { try { let...
AST#method_declaration#Left public initAVPlayer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left...
public initAVPlayer() { media.createAVPlayer().then((player: media.AVPlayer) => { if (player !== null) { this.avPlayer = player; if (this.curSource.video) { try { let fileDescriptor = this.context?.resourceManager.getRawFdSync(this.curSource.video); i...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVPlayer/MediaService/src/main/ets/controller/AvPlayerController.ets#L54-L87
3ac001e1d150d1b514469a3f8435123e087f4e74
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoCreateGif.ets
arkts
createVideoItem
创建视频单项布局 @param videoInfo @param index
@Builder createVideoItem(videoInfo: VideoInfo, index: number) { Column() { Image(videoInfo.image) .objectFit(ImageFit.Fill) .width($r('app.string.video_create_gif_full_width')) .height($r('app.integer.video_create_gif_video_home_item_height')) .borderRadius($r('app.integer.vi...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right createVideoItem AST#parameter_list#Left ( AST#parameter#Left videoInfo : AST#type_annotation#Left AST#primary_type#Left VideoInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annota...
@Builder createVideoItem(videoInfo: VideoInfo, index: number) { Column() { Image(videoInfo.image) .objectFit(ImageFit.Fill) .width($r('app.string.video_create_gif_full_width')) .height($r('app.integer.video_create_gif_video_home_item_height')) .borderRadius($r('app.integer.vi...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoCreateGif.ets#L164-L207
b657ce101612877c58ee823389896dc414a44dfb
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/Tcp2OneWayTls.ets
arkts
selectCA
选择 CA 文件
selectCA() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { caFileUri = result[0]; this.msgHistory += `CA selected: ${caFileUri}\n`; this.canLoad = true; } }).catch((err: Error) => { this.msg...
AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left documentPicker = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi...
selectCA() { let documentPicker = new picker.DocumentViewPicker(); documentPicker.select().then((result) => { if (result.length > 0) { caFileUri = result[0]; this.msgHistory += `CA selected: ${caFileUri}\n`; this.canLoad = true; } }).catch((err: Error) => { this.msg...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/Tcp2OneWayTls.ets#L182-L193
ebe2c38db70d969492e16cf2ba3787336f2d7207
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/prompt/MessageUtil.ets
arkts
success
显示成功警告框 @param cfg
success(cfg: MessageCfg) { //设置成功弹框页面内容 this.componentContent = new ComponentContent(cfg.context, wrapBuilder(successView), cfg); this.buildView(this.componentContent, cfg); }
AST#method_declaration#Left success AST#parameter_list#Left ( AST#parameter#Left cfg : AST#type_annotation#Left AST#primary_type#Left MessageCfg AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { //设置成功弹框页面内容 AST#expression_statement#Left AST...
success(cfg: MessageCfg) { this.componentContent = new ComponentContent(cfg.context, wrapBuilder(successView), cfg); this.buildView(this.componentContent, cfg); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/MessageUtil.ets#L83-L87
341640ce462ac0a629989fae7593c67fca6d31e4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/Index.ets
arkts
MainPage
@file main 模块统一导出 @author Joker.X
export { MainPage } from "./src/main/ets/view/MainPage";
AST#export_declaration#Left export { MainPage } from "./src/main/ets/view/MainPage" ; AST#export_declaration#Right
export { MainPage } from "./src/main/ets/view/MainPage";
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/Index.ets#L6-L6
48125480a937bf59924d85ea8a3f7bd49c7462e3
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/device/KvUtil.ets
arkts
init
初始化 @returns SingleKVStore
async init(ctx: common.Context) { //获取调用方包名 let bundleInfo: bundleManager.BundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); //构建配置 const kvManagerConfig: distributedKVStore.KVManagerConfig = { context: ctx, bundleName: bundl...
AST#method_declaration#Left async init AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#L...
async init(ctx: common.Context) { let bundleInfo: bundleManager.BundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const kvManagerConfig: distributedKVStore.KVManagerConfig = { context: ctx, bundleName: bundleInfo.name ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/KvUtil.ets#L49-L77
3f8636ad6513b07c54aa4811ea29897e39844651
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/CharUtil.ets
arkts
isUpperCase
判断字符串char是否是大写字母 @param char @returns
static isUpperCase(char: string): boolean { return i18n.Unicode.isUpperCase(char); }
AST#method_declaration#Left static isUpperCase AST#parameter_list#Left ( AST#parameter#Left char : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_ty...
static isUpperCase(char: string): boolean { return i18n.Unicode.isUpperCase(char); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/CharUtil.ets#L58-L60
2ea88f8e4112cdd8b7a616c6f53d46857175708b
gitee
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/view/SwiperListItem.ets
arkts
getIntroductionData
Get the introduction by currentZoneId.
getIntroductionData() { let zoneList = zonesViewModel.getZonesList(); this.introductionData = zoneList.filter((item) => item.id === this.currentZoneId)[0]; }
AST#method_declaration#Left getIntroductionData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left zoneList = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#exp...
getIntroductionData() { let zoneList = zonesViewModel.getZonesList(); this.introductionData = zoneList.filter((item) => item.id === this.currentZoneId)[0]; }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/view/SwiperListItem.ets#L78-L81
711785cb1a0a222a9d61782847c7bd32090e1e21
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/settings/LanguageSettingsPage.ets
arkts
buildDetectedLanguageItem
构建检测到的语言项
@Builder buildDetectedLanguageItem(language: SupportedLanguage) { Row({ space: 12 }) { Text(this.getLanguageInfo(language)?.flag || '🌐') .fontSize(16) Column({ space: 2 }) { Text(this.getLanguageInfo(language)?.nativeName || '') .fontSize(14) .fontColor($r('app.co...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildDetectedLanguageItem AST#parameter_list#Left ( AST#parameter#Left language : AST#type_annotation#Left AST#primary_type#Left SupportedLanguage AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right ...
@Builder buildDetectedLanguageItem(language: SupportedLanguage) { Row({ space: 12 }) { Text(this.getLanguageInfo(language)?.flag || '🌐') .fontSize(16) Column({ space: 2 }) { Text(this.getLanguageInfo(language)?.nativeName || '') .fontSize(14) .fontColor($r('app.co...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L273-L312
090e5dd6351a9e67b97674f0568c0a102b0bbe86
github
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/InterviewRecordModel.ets
arkts
getRoundText
获取面试轮次显示文本
getRoundText(): string { switch (this.round) { case InterviewRound.HR: return 'HR面试'; case InterviewRound.TECHNICAL: return '技术面试'; case InterviewRound.MANAGER: return '主管面试'; case InterviewRound.FINAL: return '终面'; case InterviewRound.ONSITE: re...
AST#method_declaration#Left getRoundText 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#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switc...
getRoundText(): string { switch (this.round) { case InterviewRound.HR: return 'HR面试'; case InterviewRound.TECHNICAL: return '技术面试'; case InterviewRound.MANAGER: return '主管面试'; case InterviewRound.FINAL: return '终面'; case InterviewRound.ONSITE: re...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/InterviewRecordModel.ets#L103-L118
a7d74993574959f9f87ce1d0485c3f1c224f60b2
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
entry/src/main/ets/pages/Index.ets
arkts
cameraPicker
相机选择器,拉起系统相机不需要申请相机权限
cameraPicker() { TaoYao.with(this.context) .camera() .onSuccess((uri) => { // 拍照或者录像的文件沙箱路径 console.log(uri) }) .onError((err) => { console.log(err.stack) }) .openSystemCamera(new CameraBuilder() // 后置相机,默认使用后摄 .setCameraSelector(CameraSele...
AST#method_declaration#Left cameraPicker AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#me...
cameraPicker() { TaoYao.with(this.context) .camera() .onSuccess((uri) => { console.log(uri) }) .onError((err) => { console.log(err.stack) }) .openSystemCamera(new CameraBuilder() .setCameraSelector(CameraSelector.CAMERA_POSITION_BACK) ...
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/entry/src/main/ets/pages/Index.ets#L164-L184
8072d933587fd0591c87ed84f689ceefcc51a569
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets
arkts
全局状态保留能力弹窗控制器,对外提供fillGlobalStateDialog函数来操作弹窗的布局与内容
export class GlobalStateDialogNodeController extends NodeController { private uiContext: UIContext | null = null; private rootNode: BuilderNode<[ESObject]> | null = null; private wrapBuilder: WrappedBuilder<[ESObject]> | null = null; private params: ESObject; setUIContext(uiContext: UIContext) { this.uiC...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalStateDialogNodeController 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 uiContext : AST#type_annotation#Left AST#...
export class GlobalStateDialogNodeController extends NodeController { private uiContext: UIContext | null = null; private rootNode: BuilderNode<[ESObject]> | null = null; private wrapBuilder: WrappedBuilder<[ESObject]> | null = null; private params: ESObject; setUIContext(uiContext: UIContext) { this.uiC...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets#L63-L103
9a966e7cc1d0061f8593ffc165b802f5741e1b49
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets
arkts
generateAESKey
生成AES的对称密钥 @returns AES密钥
static async generateAESKey(): Promise<OutDTO<string>> { return CryptoUtil.generateSymKey('AES256'); }
AST#method_declaration#Left static async generateAESKey AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < AST#...
static async generateAESKey(): Promise<OutDTO<string>> { return CryptoUtil.generateSymKey('AES256'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L66-L68
a49b11eaadeaf98b28626aeb88e1211de83f5562
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ar/ARCardService.ets
arkts
聚光灯接口
export interface SpotLight { position: Vector3D; direction: Vector3D; color: Color3D; intensity: number; angle: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SpotLight AST#object_type#Left { AST#type_member#Left position : AST#type_annotation#Left AST#primary_type#Left Vector3D AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left direction : AST#type_annotati...
export interface SpotLight { position: Vector3D; direction: Vector3D; color: Color3D; intensity: number; angle: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ar/ARCardService.ets#L55-L61
d166518681f889656584a6867fd063e9ffae7288
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileUtility.ets
arkts
copyFile
移动文件
static copyFile(fromPath: string, toPath: string): boolean { try { if (fs.accessSync(fromPath)) { fs.copyFileSync(fromPath, toPath); return true; } return false; } catch (e) { return false; } }
AST#method_declaration#Left static copyFile AST#parameter_list#Left ( AST#parameter#Left fromPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left toPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static copyFile(fromPath: string, toPath: string): boolean { try { if (fs.accessSync(fromPath)) { fs.copyFileSync(fromPath, toPath); return true; } return false; } catch (e) { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L156-L166
a2ca71c4ff041bd7a37a1e8be7cb11618a9b5550
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/login_register/register.ets
arkts
register
*******************************注册*******************************//
@Builder register(){ Column() { Row() { Text("手机号:") .textAlign(TextAlign.Start) .width(80) .padding({left:10}) TextInput({ placeholder: "请输入手机号", text: $$this.telephone }) .placeholderFont({ size: 12, }) .layoutWeight(1...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right register 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 { AST#arkts_ui_element...
@Builder register(){ Column() { Row() { Text("手机号:") .textAlign(TextAlign.Start) .width(80) .padding({left:10}) TextInput({ placeholder: "请输入手机号", text: $$this.telephone }) .placeholderFont({ size: 12, }) .layoutWeight(1...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/login_register/register.ets#L41-L134
9de25265fa3599fd509f0205e4b4e5309f7fe76e
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/utils/SysUtil.ets
arkts
系统样式、系统资源等帮助类
export class SysUtil { /** * 获取提供访问应用资源的能力 * @returns */ static getResourceManager(): resourceManager.ResourceManager { return getContext().resourceManager; } /** * 获取指定资源对应的integer数值或者float数值 * @param res * @returns */ static getNumber(res: Resource): number { return SysUtil.g...
AST#export_declaration#Left export AST#class_declaration#Left class SysUtil AST#class_body#Left { /** * 获取提供访问应用资源的能力 * @returns */ AST#method_declaration#Left static getResourceManager AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left...
export class SysUtil { static getResourceManager(): resourceManager.ResourceManager { return getContext().resourceManager; } static getNumber(res: Resource): number { return SysUtil.getResourceManager().getNumber(res); } static getString(res: Resource): string { return SysUtil.getRes...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/utils/SysUtil.ets#L11-L208
7ccc8e26d90a9a62d2ae76fa29608cc79a8529ce
github
huangwei021230/HarmonyFlow.git
427f918873b0c9efdc975ff4889726b1bfccc546
entry/src/main/ets/components/basicUI/SymbolMenu.ets
arkts
SymbolMenu
符号键盘
@Component export struct SymbolMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; private symbolList: sourceListType[] = symbolSourceListData; private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2; private returnWidth: Resou...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SymbolMenu AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'inputStyle' AST#expression#Right ) AST#decorator#Right inputStyle : AST#type_annotation#Left A...
@Component export struct SymbolMenu { @StorageLink('inputStyle') inputStyle: KeyStyle = StyleConfiguration.getSavedInputStyle(); @Consume menuType: number; private symbolList: sourceListType[] = symbolSourceListData; private spaceWidth: Resource = this.inputStyle.spaceButtonWidth_2; private returnWidth: Resou...
https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/components/basicUI/SymbolMenu.ets#L26-L82
14d616eadf1cddd98e8f6c7fe196016c0ed1c321
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/ContentView.ets
arkts
marketList
模板列表
@Builder marketList(category_id: string, img: Resource) { Refresh({ refreshing: this.isLoading!! }) { List({ space: new WidthBreakpointType(16, 16, 32).getValue(this.windowUtil.mainWindowInfo.widthBp) }) { ForEach(this.surveyTemplate, (survey: SurveyTemplate, surveyIndex: number) => { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right marketList AST#parameter_list#Left ( AST#parameter#Left category_id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left img : AST#type_annotation#Lef...
@Builder marketList(category_id: string, img: Resource) { Refresh({ refreshing: this.isLoading!! }) { List({ space: new WidthBreakpointType(16, 16, 32).getValue(this.windowUtil.mainWindowInfo.widthBp) }) { ForEach(this.surveyTemplate, (survey: SurveyTemplate, surveyIndex: number) => { ...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/ContentView.ets#L257-L352
1d8800b2fe818870990c78aaf4b439728dc5b140
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringEncrypt.ets
arkts
encodedString
将字符串编码为Base64格式 @returns Base64编码后的字符串,如果输入无效则返回null
encodedString(): string | null { if (!this.str) { return null; } try { const base64 = new util.Base64Helper(); const data = this.stringToUint8Array(this.str); return base64.encodeToStringSync(data); } catch (err) { console.error(`Base64编码失败: ${err}`); return null; ...
AST#method_declaration#Left encodedString AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Left { ...
encodedString(): string | null { if (!this.str) { return null; } try { const base64 = new util.Base64Helper(); const data = this.stringToUint8Array(this.str); return base64.encodeToStringSync(data); } catch (err) { console.error(`Base64编码失败: ${err}`); return null; ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringEncrypt.ets#L110-L123
1cdac7f0ee0912833c91426ce2f2f0dbcf4773ba
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/voice/VoiceUDPClient.ets
arkts
on
自定义事件机制(约束2,28)
on(event: string, listener: Function): void { const eventListeners = this.listeners.get(event) || []; eventListeners.push(listener); this.listeners.set(event, eventListeners); }
AST#method_declaration#Left on AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AS...
on(event: string, listener: Function): void { const eventListeners = this.listeners.get(event) || []; eventListeners.push(listener); this.listeners.set(event, eventListeners); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/voice/VoiceUDPClient.ets#L26-L30
bb2d055a8d5f3ce46960ad12f66062baeb4f01ea
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/GoodsIdRequest.ets
arkts
@param {Partial<GoodsIdRequest>} init - 初始化数据
constructor(init?: Partial<GoodsIdRequest>) { if (!init) { return; } this.goodsId = init.goodsId ?? this.goodsId; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left GoodsIdRequest AST#primary_type#Right AST#type_annotation#Right > AST#t...
constructor(init?: Partial<GoodsIdRequest>) { if (!init) { return; } this.goodsId = init.goodsId ?? this.goodsId; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/GoodsIdRequest.ets#L14-L19
11e71d6b40390a66a7165353dfd75ea004ea0c44
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
getActiveNotificationCount
获取当前应用未删除的通知数量。
static async getActiveNotificationCount(): Promise<number> { return notificationManager.getActiveNotificationCount(); }
AST#method_declaration#Left static async getActiveNotificationCount 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 number AST#primary_type#Right AST#type_annotati...
static async getActiveNotificationCount(): Promise<number> { return notificationManager.getActiveNotificationCount(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L336-L338
2f8c8670497afcf4a66778a8c0cba97d0b4bd176
gitee
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/EpisodeDetailPage.ets
arkts
loadEpisodeDetail
加载单集详情
async loadEpisodeDetail() { this.isLoading = true; try { // 从数据库加载单集信息 this.episode = await this.dbService.getEpisodeById(this.episodeId); if (this.episode) { await this.checkDownloadStatus(); console.info(`[EpisodeDetailPage] Loaded episode: ${this.episode.title}`); } el...
AST#method_declaration#Left async loadEpisodeDetail AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isLoading AST...
async loadEpisodeDetail() { this.isLoading = true; try { this.episode = await this.dbService.getEpisodeById(this.episodeId); if (this.episode) { await this.checkDownloadStatus(); console.info(`[EpisodeDetailPage] Loaded episode: ${this.episode.title}`); } else { ...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/EpisodeDetailPage.ets#L32-L48
5ff189653dd910d841104061986144d634a97ef4
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/formatter/DefaultValueFormatter.ets
arkts
getDecimalDigits
Returns the number of decimal digits this formatter uses. @return
public getDecimalDigits(): number { return this.mDecimalDigits; }
AST#method_declaration#Left public getDecimalDigits AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
public getDecimalDigits(): number { return this.mDecimalDigits; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/formatter/DefaultValueFormatter.ets#L67-L69
51da2637f173787585067e28d64c9ab2db595f3a
gitee
OHPG/FinVideo.git
2b288396af5b2a20a24575faa317b46214965391
entry/src/main/ets/pages/home/main/MainViewModel.ets
arkts
@Author peerless2012 @Email peerless2012@126.com @DateTime 2024/11/12 21:42 @Version V1.0 @Description
export class MainViewModel extends ListViewModel { constructor(context: Context) { super(context) } async loadData(type: LoadType): Promise<void> { let groupArray = new Array<GroupInfo>() let resumeItems = await this.repository.getResumeItems() if (resumeItems && resumeItems.length > 0) { ...
AST#export_declaration#Left export AST#class_declaration#Left class MainViewModel extends AST#type_annotation#Left AST#primary_type#Left ListViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left context ...
export class MainViewModel extends ListViewModel { constructor(context: Context) { super(context) } async loadData(type: LoadType): Promise<void> { let groupArray = new Array<GroupInfo>() let resumeItems = await this.repository.getResumeItems() if (resumeItems && resumeItems.length > 0) { ...
https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/home/main/MainViewModel.ets#L12-L62
8e109705db5b93b6f8c8ded1fa6c5a1ca9c43d03
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/EmitterUtil.ets
arkts
once
单次订阅指定事件,支持取消指定事件回调 @param eventId 事件ID,string类型的eventId不支持空字符串。 @param callback 接收到该事件时需要执行的回调处理函数。
static once<T>(eventId: string | number, callback: Callback<emitter.GenericEventData<T>>) { emitter.once(eventId.toString(), callback); }
AST#method_declaration#Left static once AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left eventId : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Lef...
static once<T>(eventId: string | number, callback: Callback<emitter.GenericEventData<T>>) { emitter.once(eventId.toString(), callback); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/EmitterUtil.ets#L98-L100
a20241e010e0e9bd8ae1844493fb95e32a440fb0
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/todo/TodoEditPage.ets
arkts
deleteTodo
删除代办事项
private async deleteTodo(): Promise<void> { if (!this.editMode || !this.todo) { return; } try { await this.todoService.deleteTodo(this.todoId); appRouter.back(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to delete todo: ${error}`); ...
AST#method_declaration#Left private async deleteTodo 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#ty...
private async deleteTodo(): Promise<void> { if (!this.editMode || !this.todo) { return; } try { await this.todoService.deleteTodo(this.todoId); appRouter.back(); } catch (error) { hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Failed to delete todo: ${error}`); ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/todo/TodoEditPage.ets#L169-L180
ca2e49d324f5cce112140c5be575a6c28420ef0e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
delete
删除指定的对象的属性 @param target 目标对象 @param key
static delete(target: Object, key: PropertyKey): boolean { return ObjectUtils.delete(target, key); }
AST#method_declaration#Left static delete AST#parameter_list#Left ( AST#parameter#Left target : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left PropertyKey AST#primary_typ...
static delete(target: Object, key: PropertyKey): boolean { return ObjectUtils.delete(target, key); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L172-L174
c63ebdbdbad91d528c9204598dfb944453232f6a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets
arkts
buildVerifyCodeComponent
TODO 知识点:部分验证码场景要完全禁止对输入验证码的选中、复制等功能,因此可以使用Text组件完成
@Builder buildVerifyCodeComponent() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { ForEach(this.codeIndexArray, (item: number, index: number) => { Text(this.codeText[item]) .verifyCodeUnitStyle() }, (item: number, inde...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildVerifyCodeComponent 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 Flex ( AST#component_parameters#Left { AST#compon...
@Builder buildVerifyCodeComponent() { Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { ForEach(this.codeIndexArray, (item: number, index: number) => { Text(this.codeText[item]) .verifyCodeUnitStyle() }, (item: number, inde...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/verifycode/src/main/ets/view/VerifyCodeView.ets#L143-L166
f80b599119f98c51bff84522cd8b2a655b7c38cc
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_004_F.ets
arkts
Introduction 库函数-string_toString
export function string_lib_func_004_F(taint_src : string) { let clean = "clean"; let t = clean.toString(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_stateme...
export function string_lib_func_004_F(taint_src : string) { let clean = "clean"; let t = clean.toString(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_004_F.ets#L7-L11
112be1f6f2ac0844f2759f141d6527f165997c44
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets
arkts
aboutToAppear
*****************************************************主页面**************************************
aboutToAppear() { //日 this.getDayData(); //周 this.getWeekData(); //月 this.getMonthData(); //年 this.getAllData(); }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { //日 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . getDayData AST#mem...
aboutToAppear() { this.getDayData(); this.getWeekData(); this.getMonthData(); this.getAllData(); }
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets#L392-L401
69f39443d9f6588feadb7062752098069b8123d6
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets
arkts
decodeECB
解密-ECB模式 @param str 加密的字符串 @param sm4Key SM4密钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param dataCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
static decodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.decodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, dataCoding); }
AST#method_declaration#Left static decodeECB 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 sm4Key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static decodeECB(str: string, sm4Key: string, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.decodeECB(str, sm4Key, 'SM4_128', 'SM4_128|ECB|PKCS7', 128, keyCoding, dataCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM4Sync.ets#L58-L61
8d5721f752462227958069454ec1dfd20dc3419c
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoPlayPage.ets
arkts
updateTruncateTime
更新截取的时间
private updateTruncateTime() { let playTime = Math.floor(this.currentTime / 1000) * 1000; // 当前播放时间向前10秒作为最小可截取到的时间, // 当前播放时间向后20秒作为最大可截取到的时间, // 当前播放时间到向后10秒作为当前选中的截取时间 let prevTime = playTime - 10 * 1000; let nextTime = playTime + 20 * 1000; if (prevTime < 0) { prevTime = 0; }...
AST#method_declaration#Left private updateTruncateTime AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left playTime = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left ...
private updateTruncateTime() { let playTime = Math.floor(this.currentTime / 1000) * 1000; let prevTime = playTime - 10 * 1000; let nextTime = playTime + 20 * 1000; if (prevTime < 0) { prevTime = 0; } if (nextTime > this.avPlayer!.duration) { nextTime = this.avPlayer...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/view/VideoPlayPage.ets#L347-L381
89a383887a74b0e32436261cb5c5b834dc226027
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
componentName of string
export const COMPONENT_NAME: string = 'componentName';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMPONENT_NAME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'componentName' AST#expression#Right AST#variable_declarator#Right ; AST#varia...
export const COMPONENT_NAME: string = 'componentName';
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/common/constants/CommonConstants.ets#L29-L29
5d38e59a00ac8aaac3544af058d91ba05aa6fe43
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets
arkts
@memo
export function hookLoadingProgressContentModifier( receiver: ArkLoadingProgressComponent, value?: ContentModifier<LoadingProgressConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const loadingProgressBuilder = (parentNode: KPointer, config: Loadi...
AST#export_declaration#Left export AST#function_declaration#Left function hookLoadingProgressContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkLoadingProgressComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#param...
export function hookLoadingProgressContentModifier( receiver: ArkLoadingProgressComponent, value?: ContentModifier<LoadingProgressConfiguration>) { const wrappedBuilder = value?.applyContent() if (!wrappedBuilder) { return } const loadingProgressBuilder = (parentNode: KPointer, config: Loadi...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L130-L143
36378d46ac4a441d1a4e0c8272c19e4e07786ef9
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
has
Called when owning or not. @since 10
static has(propName: string): boolean { return StorageMap.shared.has(propName) }
AST#method_declaration#Left static has AST#parameter_list#Left ( AST#parameter#Left propName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
static has(propName: string): boolean { return StorageMap.shared.has(propName) }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L124-L126
3c6bbc38c24f0ec1d82be390ed42a48e72458fa9
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/commons/utils/permissionMananger.ets
arkts
checkPermission
静态方法用于检查给定的权限是否已经被授予
static checkPermission(permissions: Permissions[]): boolean { // 创建一个访问令牌管理器实例 let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); // 初始化tokenID为0,稍后将获取真实的tokenID let tokenID: number = 0; // 获取本应用的包信息 const bundleInfo = bundleManager.getBundleInfoForSelfSync(...
AST#method_declaration#Left static checkPermission AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Permissions [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type...
static checkPermission(permissions: Permissions[]): boolean { let atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let tokenID: number = 0; const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION);...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/permissionMananger.ets#L6-L29
68448fc1bcf97cbfbcc7767a74aab896db5c8dfc
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
addArg
添加 @param dialogId @param componentContent
private static addArg(dialogId: string, uiContext: UIContext, componentContent: ComponentContent<Object>) { const arg: ActionCoreArg = { dialogId: dialogId, uiContext: uiContext, componentContent: componentContent } DialogUtils.caches.unshift(arg); }
AST#method_declaration#Left private static addArg 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#Left uiContext : AST#type_annotation#Left AST#primary_type#Left UIContext A...
private static addArg(dialogId: string, uiContext: UIContext, componentContent: ComponentContent<Object>) { const arg: ActionCoreArg = { dialogId: dialogId, uiContext: uiContext, componentContent: componentContent } DialogUtils.caches.unshift(arg); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L145-L148
2f486c5e806e1b70c8a69aa9311788f9f32cf3c1
gitee
xinkai-hu/MyDay.git
dcbc82036cf47b8561b0f2a7783ff0078a7fe61d
entry/src/main/ets/pages/Login.ets
arkts
getDefaultFolders
account 改变时触发。为注册成功的用户创建默认文件夹。
public getDefaultFolders(): void { this.defaultFolders = [{ owner: this.account.username, folderName: '我的一天', folderType: FolderType.MY_DAY, background: $r('app.color.default_my_day_bg'), backgroundType: BackgroundType.COLOR }, { owner: this.account.username, ...
AST#method_declaration#Left public getDefaultFolders AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Le...
public getDefaultFolders(): void { this.defaultFolders = [{ owner: this.account.username, folderName: '我的一天', folderType: FolderType.MY_DAY, background: $r('app.color.default_my_day_bg'), backgroundType: BackgroundType.COLOR }, { owner: this.account.username, ...
https://github.com/xinkai-hu/MyDay.git/blob/dcbc82036cf47b8561b0f2a7783ff0078a7fe61d/entry/src/main/ets/pages/Login.ets#L74-L111
71fa3b0defa4ebcadf0723352c9a8fef93c92488
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets
arkts
startTranscoderingProcess
开始转码对应的流程。
async startTranscoderingProcess() { if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) { if (this.avTranscoder != undefined) { await this.avTranscoder.release(); this.avTranscoder = undefined; } // 1.创建转码实例。 this.avTranscoder = await media.createAVTranscoder(); ...
AST#method_declaration#Left async startTranscoderingProcess AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#call_expression#Left AST#expression#Left canIUse AST#expression#Right AST#argument_list#Left ( AST#expression#...
async startTranscoderingProcess() { if (canIUse('SystemCapability.Multimedia.Media.AVTranscoder')) { if (this.avTranscoder != undefined) { await this.avTranscoder.release(); this.avTranscoder = undefined; } this.avTranscoder = await media.createAVTranscoder(); this.set...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/AVTranscoder/AVTranscoderArkTS/entry/src/main/ets/transcoder/AVTranscoderManager.ets#L60-L88
9bf4a132b43afed057a5e4a75b7e3924489630f3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SettingsPage.ets
arkts
buildFooterInfo
构建底部信息
@Builder buildFooterInfo() { Column({ space: 8 }) { Text(`生日提醒 v${AppInfo.APP_VERSION}`) .fontSize(12) .fontColor('#999999') Text('让每个生日都被记住') .fontSize(12) .fontColor('#cccccc') } .width('100%') .alignItems(HorizontalAlign.Center) .padding(20) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildFooterInfo 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 buildFooterInfo() { Column({ space: 8 }) { Text(`生日提醒 v${AppInfo.APP_VERSION}`) .fontSize(12) .fontColor('#999999') Text('让每个生日都被记住') .fontSize(12) .fontColor('#cccccc') } .width('100%') .alignItems(HorizontalAlign.Center) .padding(20) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L563-L577
42ff1e781fc89fcf4a05b15f107f9592cc877fa2
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets
arkts
updatePassword
更新密码 @param {string} value - 密码 @returns {void} 无返回值
updatePassword(value: string): void { }
AST#method_declaration#Left updatePassword AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Rig...
updatePassword(value: string): void { }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets#L31-L32
f2dc9e7e66f85c51d02097ed09ea9f66541deb44
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
interfaces/ets/ani/animator/ets/@ohos.animator.ets
arkts
native
set and get onCancel
private native setOnCancel(value: () => void) : void;
AST#method_declaration#Left private native AST#ERROR#Left setOnCancel AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AS...
private native setOnCancel(value: () => void) : void;
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/interfaces/ets/ani/animator/ets/@ohos.animator.ets#L75-L75
fbcdcb614ddc60f8b521168b35ca3abc786cdaf6
gitee
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/dialog/DialogHelper.ets
arkts
下载失败弹框 @param operator 回调
export function displayDownloadFailDialog(operator ?: DialogOperator): void { defaultNoTitleDialog($r('app.string.download_fail'), operator); }
AST#export_declaration#Left export AST#function_declaration#Left function displayDownloadFailDialog AST#parameter_list#Left ( AST#parameter#Left operator ? : AST#type_annotation#Left AST#primary_type#Left DialogOperator AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AS...
export function displayDownloadFailDialog(operator ?: DialogOperator): void { defaultNoTitleDialog($r('app.string.download_fail'), operator); }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L96-L98
64816f873b79db518b5e12624bea13a76ab1c1ad
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_core/src/main/ets/core/base/OutDTO.ets
arkts
OKByDataRow
成功-包含单行数据 @param msg 提示消息 @param dataRow 单行数据 @returns
static OKByDataRow<T>(msg: string, dataRow: T): OutDTO<T> { let dto = new OutDTO<T>(true, msg, dataRow, [], 200); return dto; }
AST#method_declaration#Left static OKByDataRow AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter...
static OKByDataRow<T>(msg: string, dataRow: T): OutDTO<T> { let dto = new OutDTO<T>(true, msg, dataRow, [], 200); return dto; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/base/OutDTO.ets#L76-L79
24059bc0f40a51bf8f8a0f469aa55226e182eaac
gitee
azhuge233/Wake-HarmonyOS.git
68c4e961f9cf5fab8699af99313dd5854ea313a1
entry/src/main/ets/view/IPBanner.ets
arkts
startNetListening
启用网络监听 aboutToAppear 内调用
private startNetListening() { // 创建网络监听器 try { this.netConnection = connection.createNetConnection({ netCapabilities: { bearerTypes: [connection.NetBearType.BEARER_WIFI] // 指定监听WiFi } }); } catch (err) { Logg...
AST#method_declaration#Left private startNetListening AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { // 创建网络监听器 AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AS...
private startNetListening() { try { this.netConnection = connection.createNetConnection({ netCapabilities: { bearerTypes: [connection.NetBearType.BEARER_WIFI] } }); } catch (err) { Logger.error(this.LOG_TAG...
https://github.com/azhuge233/Wake-HarmonyOS.git/blob/68c4e961f9cf5fab8699af99313dd5854ea313a1/entry/src/main/ets/view/IPBanner.ets#L26-L63
00b3fe521f81673d6ac7b8c10042a53fe8e185e8
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Log.ets
arkts
showError
print error level log @param {string} tag - Page or class tag @param {string} log - Log needs to be printed
static showError(tag, log) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
AST#method_declaration#Left static showError AST#parameter_list#Left ( AST#parameter#Left tag AST#parameter#Right , AST#parameter#Left log AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#me...
static showError(tag, log) { console.error(`${TAG} tag: ${tag} --> ${log}`); }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement03_api12/entry/src/main/ets/MainAbility/common/Log.ets#L50-L52
4b37d009289ab95e88734839744fedc1a93df557
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/componentstack/src/main/ets/view/ProductList.ets
arkts
ProductList
WaterFlow组件横向间距
@Component export struct ProductList { private productData: ProductDataSource = new ProductDataSource(); private displaySync: displaySync.DisplaySync | undefined = undefined; private frame: number = 1; aboutToAppear() { // 创建DisplaySync对象 this.displaySync = displaySync.create(); // 设置期望帧率 const...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ProductList AST#component_body#Left { AST#property_declaration#Left private productData : AST#type_annotation#Left AST#primary_type#Left ProductDataSource AST#primary_type#Right AST#type_annotation#Right = AST#express...
@Component export struct ProductList { private productData: ProductDataSource = new ProductDataSource(); private displaySync: displaySync.DisplaySync | undefined = undefined; private frame: number = 1; aboutToAppear() { this.displaySync = displaySync.create(); const range: ExpectedFrameRateRa...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/componentstack/src/main/ets/view/ProductList.ets#L28-L84
ce2e683e3b32b098056c7f1fb493f1ef7796b7dc
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/lunar/LunarService.ets
arkts
validateLunarDate
验证农历日期 @param year 农历年份 @param month 农历月份 @param day 农历日期 @param isLeapMonth 是否闰月 @returns 是否有效
validateLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false): boolean { try { // 检查年份范围 if (year < 1900 || year > 2100) { return false; } // 检查月份范围 if (month < 1 || month > 12) { return false; } // 检查是否为有效的闰月 if (isLeapMo...
AST#method_declaration#Left validateLunarDate AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type...
validateLunarDate(year: number, month: number, day: number, isLeapMonth: boolean = false): boolean { try { if (year < 1900 || year > 2100) { return false; } if (month < 1 || month > 12) { return false; } if (isLeapMonth) { const leapMonth ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/lunar/LunarService.ets#L607-L639
a6dcb54c0d3b64f84cecd37a12d65a538f5ccea2
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets
arkts
scrollList
MyScroller组件滑动List
scrollList(offset:number){ this.listScroller.scrollBy(0, offset); }
AST#method_declaration#Left scrollList AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression...
scrollList(offset:number){ this.listScroller.scrollBy(0, offset); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L156-L158
0ef0cef6f4e71d6108b520ade212a54854061ff8
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/attribute/RowAttribute.ets
arkts
@file Row 对齐属性扩展 @author Joker.X 获取横向居中 + 垂直居中的 Row 对齐修饰器 @returns {AttributeModifier<RowAttribute>} Row 对齐修饰器 @example Row() { Text("Hi"); }.attributeModifier(rowCenter());
export function rowCenter(): AttributeModifier<RowAttribute> { return { applyNormalAttribute: (instance: RowAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(VerticalAlign.Center); } }; }
AST#export_declaration#Left export AST#function_declaration#Left function rowCenter AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left AttributeModifier AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left RowAttribute AST#prim...
export function rowCenter(): AttributeModifier<RowAttribute> { return { applyNormalAttribute: (instance: RowAttribute): void => { instance.justifyContent(FlexAlign.Center); instance.alignItems(VerticalAlign.Center); } }; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/attribute/RowAttribute.ets#L12-L19
a5a31b251f64cf3a42fe7566c9637bd2b70d065f
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Connectivity/UploadAndDownLoad/features/uploadanddownload/index.ets
arkts
requestUpload
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { requestUpload } from './src/main/ets/upload/RequestUpload';
AST#export_declaration#Left export { requestUpload } from './src/main/ets/upload/RequestUpload' ; AST#export_declaration#Right
export { requestUpload } from './src/main/ets/upload/RequestUpload';
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Connectivity/UploadAndDownLoad/features/uploadanddownload/index.ets#L15-L15
ac33c3a6f58c32399d97818f3aa0450279e3b4d9
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人操作记录接口
export interface ContactOperationRecord { id: string; type: ContactOperationType; contactId?: string; contactIds?: string[]; oldData?: Contact; newData?: Contact; timestamp: string; operator?: string; description?: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactOperationRecord AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotati...
export interface ContactOperationRecord { id: string; type: ContactOperationType; contactId?: string; contactIds?: string[]; oldData?: Contact; newData?: Contact; timestamp: string; operator?: string; description?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L313-L323
e2bf2da613152a39953a3202f73590ae0366cc9a
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserChannelOverride.ets
arkts
应用约束60: 使用import代替require A wrapper around the ClientUser's channel overrides.
export default class ClientUserChannelOverride { // 需要在类中显式声明所有可能属性(约束2: 禁止运行时变更对象布局) // 根据Constants.UserChannelOverrideMap内容预定义属性(示例属性,需根据实际映射补充) // 例如:假设映射包含'mute'属性对应到'muted'字段 public muted?: boolean; public deaf?: boolean; // 其他需要映射的属性... constructor(data: Object) { // 应用约束1: 禁止any类型,使用具体类型Object ...
AST#export_declaration#Left export default AST#class_declaration#Left class ClientUserChannelOverride AST#class_body#Left { // 需要在类中显式声明所有可能属性(约束2: 禁止运行时变更对象布局) // 根据Constants.UserChannelOverrideMap内容预定义属性(示例属性,需根据实际映射补充) // 例如:假设映射包含'mute'属性对应到'muted'字段 AST#property_declaration#Left public muted ? : AST#type_annotatio...
export default class ClientUserChannelOverride { public muted?: boolean; public deaf?: boolean; constructor(data: Object) { this.patch(data); } patch(data: Object): void { if ('mute' in data && Constants.UserChannelOverrideMap.mute === 'muted') { this.muted = dat...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/structures/ClientUserChannelOverride.ets#L6-L47
24756f2d4f57633689ed23f3ef6bfd7943d4d598
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/datastore/src/main/ets/datasource/token/TokenStoreDataSource.ets
arkts
@file Token 本地存储数据源接口 @author Joker.X
export interface TokenStoreDataSource { /** * 保存 Token * @param {string} token Token * @returns {Promise<void>} Promise<void> */ setToken(token: string): Promise<void>; /** * 读取 Token * @returns {Promise<string>} Token,默认空字符串 */ getToken(): Promise<string>; /** * 清除 Token * @retur...
AST#export_declaration#Left export AST#interface_declaration#Left interface TokenStoreDataSource AST#object_type#Left { /** * 保存 Token * @param {string} token Token * @returns {Promise<void>} Promise<void> */ AST#type_member#Left setToken AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotat...
export interface TokenStoreDataSource { setToken(token: string): Promise<void>; getToken(): Promise<string>; clearToken(): Promise<void>; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/datastore/src/main/ets/datasource/token/TokenStoreDataSource.ets#L5-L24
71b525a0a676229841dadd2b4fff2a1849cba6cc
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/dialog/BaseTextInputDialog.ets
arkts
initObserveData
Input定义自己的观察数据 覆盖基类的initObserveData @param options
protected initObserveData<T extends IBaseDialogOptions>(options: T) { if (!options.observedData || !(options.observedData instanceof InputObserved)) { options.observedData = new InputObserved() options.observedData.dialogId = options.dialogId } }
AST#method_declaration#Left protected initObserveData AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left IBaseDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#paramet...
protected initObserveData<T extends IBaseDialogOptions>(options: T) { if (!options.observedData || !(options.observedData instanceof InputObserved)) { options.observedData = new InputObserved() options.observedData.dialogId = options.dialogId } }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/dialog/BaseTextInputDialog.ets#L11-L16
9cbdb2034109e48c5f3ab997cb4c2abdeec018b5
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/entity/Goods.ets
arkts
@file 商品模型 @author Joker.X
export class Goods { /** * ID */ id: number = 0; /** * 类型ID */ typeId: number = 0; /** * 标题 */ title: string = ""; /** * 副标题 */ subTitle?: string | null = null; /** * 主图 */ mainPic: string = ""; /** * 图片 */ pics?: string[] | null = null; /** * 价格 */ ...
AST#export_declaration#Left export AST#class_declaration#Left class Goods 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 Goods { id: number = 0; typeId: number = 0; title: string = ""; subTitle?: string | null = null; mainPic: string = ""; pics?: string[] | null = null; price: number = 0; sold: number = 0; content?: string | null = null; contentPics?: string[] | null = null; ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/Goods.ets#L5-L96
9d57b3e1c818699c189ec416c44f8871b8bfda4e
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/game/GameificationService.ets
arkts
updateStreaks
更新连击记录
private async updateStreaks(action: GameAction): Promise<void> { if (!this.userGameData) return; const streakKey = action.toString(); const today = new Date().toDateString(); const streak = this.userGameData.streaks.get(streakKey) || { type: streakKey, current: 0, best: 0, ...
AST#method_declaration#Left private async updateStreaks AST#parameter_list#Left ( AST#parameter#Left action : AST#type_annotation#Left AST#primary_type#Left GameAction AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen...
private async updateStreaks(action: GameAction): Promise<void> { if (!this.userGameData) return; const streakKey = action.toString(); const today = new Date().toDateString(); const streak = this.userGameData.streaks.get(streakKey) || { type: streakKey, current: 0, best: 0, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L701-L736
6286cf42080e58239f03bc89d2aa80611f0cdbe3
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/utils/StatusBarManager.ets
arkts
immerseFullScreenSync
沉浸式全屏(全屏屏幕,且显示状态栏、导航栏) 同步方法:适合一次性定性设置沉浸式状态栏,不会动态调整。此方案大多数场景够用了,用户不会频繁显示|隐藏导航栏。 仅在Ability使用(Ability全局,且初始化状态栏和导航栏的高度),建议在 Ability --> onWindowStageCreate 中执行
static immerseFullScreenSync(windowStage: window.WindowStage) { // 同步获取一个主窗口实例 let windowClass: window.Window = windowStage.getMainWindowSync() let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); // 获取状态栏和导航栏的高度并保存在AppStorage中 AppStorage.setOrCreate<number>(STATUS_BAR_HEIGHT...
AST#method_declaration#Left static immerseFullScreenSync AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_li...
static immerseFullScreenSync(windowStage: window.WindowStage) { let windowClass: window.Window = windowStage.getMainWindowSync() let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); AppStorage.setOrCreate<number>(STATUS_BAR_HEIGHT, area.topRect.height); AppStorage.setOr...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/Wechat_Arkts-master/entry/src/main/ets/utils/StatusBarManager.ets#L63-L81
49943cfd2fe79d0b6968fc431dfe74b4aa2408b2
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
initNetwork
一系列网络监听事件
private initNetwork() { // 创建 NetConnection 对象 Index.netConnection = connection.createNetConnection(); // 注册监听 Index.netConnection.register(() => { console.error('connection register success'); }); // 监听网络是否可用 Index.netConnection!.on('netAvailable', (data) => { console.error('Ne...
AST#method_declaration#Left private initNetwork AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 创建 NetConnection 对象 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left Index AST#expression#Right . netCon...
private initNetwork() { Index.netConnection = connection.createNetConnection(); Index.netConnection.register(() => { console.error('connection register success'); }); Index.netConnection!.on('netAvailable', (data) => { console.error('NetJudge netAvailable'); this.appTmp...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L438-L474
1c8201a3991161696b5cbe44f13acd6fc2b13168
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/utils/MyWebClient.ets
arkts
onShowFileSelector
文件选择
onShowFileSelector(event: OnShowFileSelectorEvent): boolean { const isCapture = event.fileSelector.isCapture(); //是否拍照/拍视频 if (isCapture) { //拍照/拍视频 PickerUtil.cameraEasy().then((result) => { event.result.handleFileList([result]); }); } else { const types = event.fileSelector.getAc...
AST#method_declaration#Left onShowFileSelector AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnShowFileSelectorEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left bool...
onShowFileSelector(event: OnShowFileSelectorEvent): boolean { const isCapture = event.fileSelector.isCapture(); if (isCapture) { PickerUtil.cameraEasy().then((result) => { event.result.handleFileList([result]); }); } else { const types = event.fileSelector.getAcceptType() ?? []; ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/utils/MyWebClient.ets#L39-L91
0e070b3eabb527642c4be5b8dc4991af5095e888
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/view/CategoryPage.ets
arkts
CategoryPage
@file 分类页面视图 @author Joker.X
@ComponentV2 export struct CategoryPage { /** * 分类页面 ViewModel */ @Local private vm: CategoryViewModel = new CategoryViewModel(); /** * 当前窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 右侧列表滚动控制器 */ private rightListScroller: Scrolle...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CategoryPage 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 CategoryV...
@ComponentV2 export struct CategoryPage { @Local private vm: CategoryViewModel = new CategoryViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); private rightListScroller: Scroller = new Scroller(); private sideBarGroupId: string = "category-side-bar"...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/view/CategoryPage.ets#L12-L226
d4bc2f9c1e14801a41ee8a27be8e682aa6377e6d
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/viewmodel/ZonesItem.ets
arkts
Item info of the zones.
export default class ZonesItem { id: number = 0; title: ResourceStr = ''; subTitle: ResourceStr = ''; createTime: ResourceStr = ''; content: ResourceStr[] = []; thumbnail: ResourceStr = ''; swiperPic: ResourceStr = ''; subPicTop: ResourceStr = ''; subPicBottom: ResourceStr = ''; titleIcon: ResourceS...
AST#export_declaration#Left export default AST#class_declaration#Left class ZonesItem AST#class_body#Left { 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_declaration#Ri...
export default class ZonesItem { id: number = 0; title: ResourceStr = ''; subTitle: ResourceStr = ''; createTime: ResourceStr = ''; content: ResourceStr[] = []; thumbnail: ResourceStr = ''; swiperPic: ResourceStr = ''; subPicTop: ResourceStr = ''; subPicBottom: ResourceStr = ''; titleIcon: ResourceS...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/ZonesItem.ets#L19-L37
2c2acd90bb84c45af503792a7a02b0c1b3a18969
github
fourseas1998/hos.ArkTSComponents.git
5f0dbd0038f17067722cb035c88fe826e4846e69
entry/src/main/ets/pages/LoginPage.ets
arkts
构建页面
build() { // 垂直布局 Column() { // Logo图片 Image($r('app.media.logo')) .width($r('app.float.logo_image_size')) .height($r('app.float.logo_image_size')) .margin({ top: $r('app.float.logo_margin_top'), bottom: $r('app.float.logo_margin_bottom') }...
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 { // Logo图片 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Image ( AST#expression#Left A...
build() { Column() { Image($r('app.media.logo')) .width($r('app.float.logo_image_size')) .height($r('app.float.logo_image_size')) .margin({ top: $r('app.float.logo_margin_top'), bottom: $r('app.float.logo_margin_bottom') }) Text($r('...
https://github.com/fourseas1998/hos.ArkTSComponents.git/blob/5f0dbd0038f17067722cb035c88fe826e4846e69/entry/src/main/ets/pages/LoginPage.ets#L91-L215
cfb85d1761f0f750e17b8523b4417ff2a215a8e4
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
entry/src/main/ets/pages/index/DialogPage.ets
arkts
loadingDialog
显示进度加载类弹出框
loadingDialog(index: number) { if (index == 0) { //简单使用 DialogHelper.showLoadingDialog({ autoCancel: true }) } else if (index == 1) { //自定义文字内容 DialogHelper.showLoadingDialog({ loadColor: Color.White, content: "努力加载中", fontSize: 15, backgroundColor: '#ED00...
AST#method_declaration#Left loadingDialog AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_stateme...
loadingDialog(index: number) { if (index == 0) { DialogHelper.showLoadingDialog({ autoCancel: true }) } else if (index == 1) { DialogHelper.showLoadingDialog({ loadColor: Color.White, content: "努力加载中", fontSize: 15, backgroundColor: '#ED000000', ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/index/DialogPage.ets#L982-L1021
3c58c7e9a2ba5b5fb35ab18708a1e8e92fc36237
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets
arkts
clearMemos
====== 清空备忘录 ======
async clearMemos(): Promise<void> { if (!this.db) return; const sql = `UPDATE ${Tables.Learn.NAME} SET ${Tables.Learn.Col.MEMO} = '', ${Tables.Learn.Col.SHARE_MEMOS} = ''`; await this.db.updateDb(sql); }
AST#method_declaration#Left async clearMemos AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum...
async clearMemos(): Promise<void> { if (!this.db) return; const sql = `UPDATE ${Tables.Learn.NAME} SET ${Tables.Learn.Col.MEMO} = '', ${Tables.Learn.Col.SHARE_MEMOS} = ''`; await this.db.updateDb(sql); }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/myData/WordUserDbAccess.ets#L501-L506
455e611f895d17b6f25b8679e3529f9845b38c07
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/storage/PreferencesService.ets
arkts
getString
获取字符串值 @param key 键 @param defaultValue 默认值 @returns 字符串值
async getString(key: string, defaultValue: string = ''): Promise<string> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as string; } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed t...
AST#method_declaration#Left async getString 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 defaultValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_...
async getString(key: string, defaultValue: string = ''): Promise<string> { try { this.checkInitialized(); return await this.dataPreferences!.get(key, defaultValue) as string; } catch (error) { const businessError = error as BusinessError; hilog.error(0x0001, 'BirthdayReminder', `Failed t...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/storage/PreferencesService.ets#L82-L91
74fc13acc3fd475122721aa8bcae63aa179cd6b6
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/PreviewUtil.ets
arkts
previewAudio
预览音频 @param uri 预览uri
static async previewAudio(uri: string): Promise<void> { await PreviewUtil.openPreview('audio', uri); }
AST#method_declaration#Left static async previewAudio AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async previewAudio(uri: string): Promise<void> { await PreviewUtil.openPreview('audio', uri); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L67-L69
ad5ff8b9a7c5aa3e0e229b7d40cc58374da44494
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBarV2.d.ets
arkts
Defines the icon type of ToolBarV2 item. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
export declare type ToolBarV2ItemIconType = ToolBarV2ItemImage | ToolBarV2SymbolGlyph;
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#type_declaration#Left type ToolBarV2ItemIconType = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ToolBarV2ItemImage AST#primary_type#Right | AST#primary_type#Left ToolBarV2SymbolGlyph AST#primary_type#Right AST#union_type...
export declare type ToolBarV2ItemIconType = ToolBarV2ItemImage | ToolBarV2SymbolGlyph;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L244-L244
286de2d771e6cd5779412d67aa3aaacf148f3cc7
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.advertising.AdComponent.d.ets
arkts
The method to build ad component. @syscap SystemCapability.Advertising.Ads @since 11 The method to build ad component. @syscap SystemCapability.Advertising.Ads @atomicservice @since 12
build(): void; } export { AdComponent }
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Left ; } export AST#ERROR#Right AST#build_body#Left { AST#expression_statement#Left AST#expression#Left AdComponent AST#expression#Right AST#expression_statement#Right } AST#b...
build(): void; } export { AdComponent }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.advertising.AdComponent.d.ets#L122-L125
de660fe7f00cc7b925738007a18d19c59df40d30
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getGranularity
@return the minimum interval between axis values
public getGranularity(): number { return this.mGranularity; }
AST#method_declaration#Left public getGranularity AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_ex...
public getGranularity(): number { return this.mGranularity; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L416-L418
447405c950eb514216ad3064c9a108f95ff4d373
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkData/KVManagerDemo/entry/src/main/ets/common/constans/CommonConstants.ets
arkts
自定义公共常量类
export default class CommonConstants{ //提示信息显示时长 static readonly DURATION = 3000; //数据库Key值 static readonly KEY_DATA_STRING_ELEMENT = 'comment'; }
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { //提示信息显示时长 AST#property_declaration#Left static readonly DURATION = AST#expression#Left 3000 AST#expression#Right ; AST#property_declaration#Right //数据库Key值 AST#property_declaration#Left static readonly KEY...
export default class CommonConstants{ static readonly DURATION = 3000; static readonly KEY_DATA_STRING_ELEMENT = 'comment'; }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkData/KVManagerDemo/entry/src/main/ets/common/constans/CommonConstants.ets#L4-L9
4f211316ff0a90ac787e8eb953a7d4ea19ea4f93
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/dialogv2/source/dialogv2.ets
arkts
getEnumNumberByResourceId
get enum number @param resourceId resource id @param defaultValue default value @returns number
function getEnumNumberByResourceId(resourceId: number, defaultValue: number): number { try { let sourceValue: number = getContext().resourceManager.getNumber(resourceId); if (sourceValue > 0) { return sourceValue; } else { return defaultValue; } } catch (error) { let code: number = (...
AST#function_declaration#Left function getEnumNumberByResourceId AST#parameter_list#Left ( AST#parameter#Left resourceId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultValue : AST#type_annotation#Left AST#primary_t...
function getEnumNumberByResourceId(resourceId: number, defaultValue: number): number { try { let sourceValue: number = getContext().resourceManager.getNumber(resourceId); if (sourceValue > 0) { return sourceValue; } else { return defaultValue; } } catch (error) { let code: number = (...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1640-L1654
fc2889809aa525db7237434ebcc56115641ab258
gitee