nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/SocketProfiler.ets
arkts
Copyright (C) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export interface SocketProfiler { readMessageQueue(): void }
AST#export_declaration#Left export AST#interface_declaration#Left interface SocketProfiler AST#object_type#Left { AST#type_member#Left readMessageQueue 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#type_mem...
export interface SocketProfiler { readMessageQueue(): void }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/base/SocketProfiler.ets#L15-L17
164d97d5b1dad4b23676d1f0af0c2a0209253952
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/PageRepository.ets
arkts
构造函数 @param networkDataSource 页面网络数据源
constructor(networkDataSource?: PageNetworkDataSource) { this.networkDataSource = networkDataSource ?? new PageNetworkDataSourceImpl(); }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left networkDataSource ? : AST#type_annotation#Left AST#primary_type#Left PageNetworkDataSource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Le...
constructor(networkDataSource?: PageNetworkDataSource) { this.networkDataSource = networkDataSource ?? new PageNetworkDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/PageRepository.ets#L18-L20
bfc650fa02089541163c95b047a931883617aa8b
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gerenxinxixiugai.ets
arkts
hotItems
UI
@Builder hotItems(data:Type1,index: number) { Row({ space: 10 }) { Image(data.img) .width(90) .height(90) .borderRadius(12) } }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right hotItems AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Type1 AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left AST#pr...
@Builder hotItems(data:Type1,index: number) { Row({ space: 10 }) { Image(data.img) .width(90) .height(90) .borderRadius(12) } }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gerenxinxixiugai.ets#L55-L64
2ce6b77279557bf788d36b1f43637b22b8de96d1
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets
arkts
setAxisMinLabels
The minumum number of labels on the axis
public setAxisMinLabels(labels: number): void { if (labels > 0) { this.mAxisMinLabels = labels; } }
AST#method_declaration#Left public setAxisMinLabels AST#parameter_list#Left ( AST#parameter#Left labels : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primar...
public setAxisMinLabels(labels: number): void { if (labels > 0) { this.mAxisMinLabels = labels; } }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/AxisBase.ets#L168-L172
d4812ab40b2ed9c901cc0f3ca074b6a6cd8eda5a
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/DFX/Debug/entry/src/main/ets/component/DebugInfo.ets
arkts
DebugInfo
Copyright (c) 2022-2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,...
@Component export default struct DebugInfo { @Prop debugWindow: boolean @Link pssMemory: number @Link sharedMemory: number @Link privateMemory: number build() { Stack({ alignContent: Alignment.Top }) { Text($r('app.string.navigation_information')) .fontSize(25) .width('80%') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct DebugInfo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right debugWindow : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#t...
@Component export default struct DebugInfo { @Prop debugWindow: boolean @Link pssMemory: number @Link sharedMemory: number @Link privateMemory: number build() { Stack({ alignContent: Alignment.Top }) { Text($r('app.string.navigation_information')) .fontSize(25) .width('80%') ...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/DFX/Debug/entry/src/main/ets/component/DebugInfo.ets#L16-L69
1a4799c7f6f4b3c5e88156ab0a18755badad745a
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/im/IMManager.ets
arkts
createConversation
创建会话
async createConversation(conversation: Conversation): Promise<boolean> { try { const exists = this.conversations.find(c => c.id === conversation.id); if (!exists) { this.conversations.push(conversation); await this.saveConversations(); EventBus.emit('IM_CONVERSATION_CREATED', { c...
AST#method_declaration#Left async createConversation AST#parameter_list#Left ( AST#parameter#Left conversation : AST#type_annotation#Left AST#primary_type#Left Conversation AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AS...
async createConversation(conversation: Conversation): Promise<boolean> { try { const exists = this.conversations.find(c => c.id === conversation.id); if (!exists) { this.conversations.push(conversation); await this.saveConversations(); EventBus.emit('IM_CONVERSATION_CREATED', { c...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/im/IMManager.ets#L79-L93
90a9e0f9afd1d5e4c02e18b11dbe7fc8ad8ffdef
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/orientationDevelopment/entry/src/main/ets/pages/Index.ets
arkts
canIUseNfc
[EndExclude enable_nfc]
canIUseNfc(): void { // [Start caniuse_nfc_core] if (canIUse('SystemCapability.Communication.NFC.Core')) { hilog.info(0x0000, 'Index', `该设备支持SystemCapability.Communication.NFC.Core`); } else { hilog.error(0x0000, 'Index', `该设备不支持SystemCapability.Communication.NFC.Core`); } // [End canius...
AST#method_declaration#Left canIUseNfc AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // [Start caniuse_nfc_core] AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#...
canIUseNfc(): void { if (canIUse('SystemCapability.Communication.NFC.Core')) { hilog.info(0x0000, 'Index', `该设备支持SystemCapability.Communication.NFC.Core`); } else { hilog.error(0x0000, 'Index', `该设备不支持SystemCapability.Communication.NFC.Core`); } if (canIUse('SystemCapability.C...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/orientationDevelopment/entry/src/main/ets/pages/Index.ets#L31-L50
9e18f2fef530164cec0019b1df1881d4b2c67611
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/FavoritesService.ets
arkts
addGenerationHistory
添加生成历史记录
async addGenerationHistory(history: AIGenerationHistory): Promise<void> { this.generationHistory.push(history); await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Added generation history: ${history.id}`); }
AST#method_declaration#Left async addGenerationHistory AST#parameter_list#Left ( AST#parameter#Left history : AST#type_annotation#Left AST#primary_type#Left AIGenerationHistory AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
async addGenerationHistory(history: AIGenerationHistory): Promise<void> { this.generationHistory.push(history); await this.saveData(); hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Added generation history: ${history.id}`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/FavoritesService.ets#L137-L142
44822832c5e2990427ca7cc3a22ec32cf9eef149
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_dialog/src/main/ets/dialog/DialogHelper.ets
arkts
showBindSheet
显示自定义半模态 @param wrappedBuilder 自定义半模态中显示的组件内容 @param options @returns
static showBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T): string { ActionParameter.initBindSheetDefault(options); const dialogId = ActionBaseCore.getInstance().openBindSheet(wrappedBuilder, options); return dialogId; }
AST#method_declaration#Left static showBindSheet AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#primary_type#Left BaseSheetOptions AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left...
static showBindSheet<T extends BaseSheetOptions>(wrappedBuilder: WrappedBuilder<[T]>, options: T): string { ActionParameter.initBindSheetDefault(options); const dialogId = ActionBaseCore.getInstance().openBindSheet(wrappedBuilder, options); return dialogId; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/DialogHelper.ets#L365-L369
39d0724e6eae4b477747f849213c6287c300e5a2
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
CustomDialogPractice/entry/src/main/ets/pages/InterceptReturn02.ets
arkts
InterceptReturn02
[Start InterceptReturn02_start]
@Component export struct InterceptReturn02 { @Consume('NavPathStack') pageStack: NavPathStack; build() { NavDestination() { Column() { Row() { Button('OPEN') .fontSize(16) .width('100%') .borderRadius(20) .margin({ bottom: 16 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InterceptReturn02 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consume ( AST#expression#Left 'NavPathStack' AST#expression#Right ) AST#decorator#Right pageStack : AST#type_annotation#Le...
@Component export struct InterceptReturn02 { @Consume('NavPathStack') pageStack: NavPathStack; build() { NavDestination() { Column() { Row() { Button('OPEN') .fontSize(16) .width('100%') .borderRadius(20) .margin({ bottom: 16 }) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/CustomDialogPractice/entry/src/main/ets/pages/InterceptReturn02.ets#L17-L47
83534d9ded4ae1377b30e822c0d9f2e4bda6e441
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
联系人验证规则接口
export interface ContactValidationRules { name: NameValidationRule; phone: PhoneValidationRule; email: EmailValidationRule; birthday: BirthdayValidationRule; intimacyLevel: IntimacyLevelValidationRule; tags: TagsValidationRule; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ContactValidationRules AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left NameValidationRule AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left phone : AS...
export interface ContactValidationRules { name: NameValidationRule; phone: PhoneValidationRule; email: EmailValidationRule; birthday: BirthdayValidationRule; intimacyLevel: IntimacyLevelValidationRule; tags: TagsValidationRule; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L293-L300
2ca6195e73f33384cfe9da9d39068222acac5b1e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AuthUtil.ets
arkts
getAvailableStatus
认证对象 查询指定类型和等级的认证能力是否支持。 @param authType @param authTrustLevel @returns
static getAvailableStatus(authType: userAuth.UserAuthType, authTrustLevel: userAuth.AuthTrustLevel): StatusResult { try { userAuth.getAvailableStatus(authType, authTrustLevel); return { status: true }; } catch (err) { let error = err as BusinessError; LogUtil.error(`AuthUtil-getAvailable...
AST#method_declaration#Left static getAvailableStatus AST#parameter_list#Left ( AST#parameter#Left authType : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left userAuth . UserAuthType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ...
static getAvailableStatus(authType: userAuth.UserAuthType, authTrustLevel: userAuth.AuthTrustLevel): StatusResult { try { userAuth.getAvailableStatus(authType, authTrustLevel); return { status: true }; } catch (err) { let error = err as BusinessError; LogUtil.error(`AuthUtil-getAvailable...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AuthUtil.ets#L41-L50
83f25b7dbcd421d0f500475fdeee917d47c070d1
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/argument_passing/argument_passing_003_T.ets
arkts
Introduction 参数传递-默认参数值
export function argument_passing_003_T(taint_src : string) { f(taint_src); }
AST#export_declaration#Left export AST#function_declaration#Left function argument_passing_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem...
export function argument_passing_003_T(taint_src : string) { f(taint_src); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/argument_passing/argument_passing_003_T.ets#L6-L8
ea0a6cb4f3462b493090651784533c6dd7877c42
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildSettingItem
设置项 (带开关)
@Builder buildSettingItem(title: string, description: string, isEnabled: boolean, onToggle: () => void) { Row({ space: 12 }) { Column({ space: 4 }) { Text(title) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) Text(description) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annota...
@Builder buildSettingItem(title: string, description: string, isEnabled: boolean, onToggle: () => void) { Row({ space: 12 }) { Column({ space: 4 }) { Text(title) .fontSize(16) .fontWeight(FontWeight.Medium) .fontColor(this.COLORS.textPrimary) Text(description) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3831-L3858
0e62a9606615f5e3a1c575f408c62346ff755f13
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets
arkts
getModifier
获取当前gridItem的modifier @param item 网格元素 @returns 属性对象
getModifier(item: T): TranslateItemModifier { logger.info(`getModifier start, sortItem:${JSON.stringify(item)}`); const index: number = this.sortAppData.indexOf(item); logger.info(`getModifier start, sortIndex:${index}`); if (index === -1) { return new TranslateItemModifier(); } else { r...
AST#method_declaration#Left getModifier AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TranslateItemModifier AST#primary_...
getModifier(item: T): TranslateItemModifier { logger.info(`getModifier start, sortItem:${JSON.stringify(item)}`); const index: number = this.sortAppData.indexOf(item); logger.info(`getModifier start, sortIndex:${index}`); if (index === -1) { return new TranslateItemModifier(); } else { r...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L131-L140
38fea8f068c719f3e304c6f86b5b8164bce873df
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
getRecentChatLogs
Get recent chat logs (across all dates) @param limit - Maximum number of logs to return @returns Array of ChatLog objects
async getRecentChatLogs(limit: number = 50): Promise<ChatLog[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_CHAT_LOGS); predicates.orderByDesc('timestamp'); predicates.limitAs(limit); try { ...
AST#method_declaration#Left async getRecentChatLogs AST#parameter_list#Left ( AST#parameter#Left limit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 50 AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati...
async getRecentChatLogs(limit: number = 50): Promise<ChatLog[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_CHAT_LOGS); predicates.orderByDesc('timestamp'); predicates.limitAs(limit); try { ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L716-L748
f41f8855c2897f25a60ce8e8ca6f6553eccecfae
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+Storage.ets
arkts
setStorageSync
这里的入参根据微信接口定义的变化而变化,框架只做了透传,不修改数据结构 setStorageSync 入参不是对象,而是两个参数,这里 data 是 array 类型,所以可以使用 index 访问
setStorageSync(data: DMPMap, callback: DMPBridgeCallback): boolean { const params: object = data.toObject() const key: string = params[0] const value: number | string | boolean | Date | object = params[1] const mgr = DMPMMKVManager.sharedInstance() return mgr.encode(key, value) }
AST#method_declaration#Left setStorageSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left DMPMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left DMPBridgeCallback AST#p...
setStorageSync(data: DMPMap, callback: DMPBridgeCallback): boolean { const params: object = data.toObject() const key: string = params[0] const value: number | string | boolean | Date | object = params[1] const mgr = DMPMMKVManager.sharedInstance() return mgr.encode(key, value) }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bridges/DMPContainerBridgesModule+Storage.ets#L37-L43
11d15a2778ce682f3518df846a48b5103a893c57
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/ScanUtil.ets
arkts
decode
调用图片识码,使用Promise方式异步返回识码结果。 @param uri 图片路径。 @param options 启动图片识码参数 scanTypes 设置扫码类型,默认扫码ALL(全部码类型)。 enableMultiMode 是否开启多码识别,默认false。true:多码识别、false:单码识别。 enableAlbum 是否开启相册,默认true。true-开启相册扫码、false-关闭相册扫码。 @returns ScanResult 扫码结果: scanType 码类型。 originalValue 码识别内容结果。 scanCodeRect 码识别位置信息。
static async decode(uri: string, options?: scanBarcode.ScanOptions): Promise<Array<scanBarcode.ScanResult>> { const inputImage: detectBarcode.InputImage = { uri: uri }; if (options === undefined) { options = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: true }; } return...
AST#method_declaration#Left static async decode 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#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type...
static async decode(uri: string, options?: scanBarcode.ScanOptions): Promise<Array<scanBarcode.ScanResult>> { const inputImage: detectBarcode.InputImage = { uri: uri }; if (options === undefined) { options = { scanTypes: [scanCore.ScanType.ALL], enableMultiMode: true, enableAlbum: true }; } return...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/ScanUtil.ets#L87-L93
33a7712bae94c0fe46e462776ed0fa5f54c8d020
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoSwitching/entry/src/main/ets/component/VideoComponent.ets
arkts
setSourceInfo
视频信息上报函数
async setSourceInfo(): Promise<void> { // 时间上报函数 this.avPlayer.on('timeUpdate', (time: number) => { logger.info('timeUpdate called: time is :' + time); logger.info('timeUpdate called: currentTime is :' + this.avPlayer.currentTime); this.callbackTimeUpdate(time); }); // 音量变化回调函数 thi...
AST#method_declaration#Left async setSourceInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async setSourceInfo(): Promise<void> { this.avPlayer.on('timeUpdate', (time: number) => { logger.info('timeUpdate called: time is :' + time); logger.info('timeUpdate called: currentTime is :' + this.avPlayer.currentTime); this.callbackTimeUpdate(time); }); this.avPlayer.on('volum...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoSwitching/entry/src/main/ets/component/VideoComponent.ets#L178-L238
1ec01713879c32f04c03e9a4a3875c3e3291de12
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/DiskStorage.ets
arkts
ensureInitialized
确保存储已初始化
private async ensureInitialized(): Promise<void> { if (!this._preference) { await this.initialize(); } }
AST#method_declaration#Left private async ensureInitialized AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right >...
private async ensureInitialized(): Promise<void> { if (!this._preference) { await this.initialize(); } }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/DiskStorage.ets#L129-L133
d8b8b809df3efa670e714cd50daa42aa5d8fe2f2
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/component/TextAreaDialogView.ets
arkts
aboutToAppear
@Local themeColorMode: ThemeColorMode = DialogHub.getThemeColorMode();
aboutToAppear(): void { this.text = this.options.text ?? ""; this.modifier.inputFilter = this.options.inputFilter; if (this.options.align == TextAlignment.Bottom) { this.textAlignment = Alignment.Bottom; } else if (this.options.align == TextAlignment.Center) { this.textAlignment = Alignment....
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb...
aboutToAppear(): void { this.text = this.options.text ?? ""; this.modifier.inputFilter = this.options.inputFilter; if (this.options.align == TextAlignment.Bottom) { this.textAlignment = Alignment.Bottom; } else if (this.options.align == TextAlignment.Center) { this.textAlignment = Alignment....
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/TextAreaDialogView.ets#L21-L40
9f625eb173e50cf08976d07a159bd26ae0bb81bb
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
UseSendable/entry/src/main/ets/pages/InterThreadCommunication4.ets
arkts
InterThreadCommunication4
[End globalconfig]
@Component export struct InterThreadCommunication4 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.immutable_data_sharing_title')) .buttonStyles() .margin({ bottom: 16 }) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct InterThreadCommunication4 AST#component_body#Left { AST#method_declaration#Left AST#decorator#Left @ Styles AST#decorator#Right buttonStyles AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_bod...
@Component export struct InterThreadCommunication4 { @Styles buttonStyles() { .width('100%') .height(40) } build() { NavDestination() { Column() { Button($r('app.string.immutable_data_sharing_title')) .buttonStyles() .margin({ bottom: 16 }) ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/InterThreadCommunication4.ets#L50-L81
1583cf07163cae4a8605a835fdd69a386f8d7bd7
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
getCollectCountByManger
统计试卷收藏数量 @param examList @returns
public getCollectCountByManger(examList: ExamDetail[]): number { return examList.filter((item: ExamDetail) => item.isCollect === false).length; }
AST#method_declaration#Left public getCollectCountByManger AST#parameter_list#Left ( AST#parameter#Left examList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ExamDetail [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#...
public getCollectCountByManger(examList: ExamDetail[]): number { return examList.filter((item: ExamDetail) => item.isCollect === false).length; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L164-L166
5e864bb747f8b36e2cdd5afa82a32a1e6b25c8cc
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/bookDetail/ReadRecordItem.ets
arkts
Copyright (C), 2024-05-03 @author LinXun @date 2024/5/3 15:40 @version 1.0 @description: 阅读记录
@Component export default struct ReadRecordItem { private count: number = 243; private unit: string = '小时'; private placeText: string = '阅读时长'; build() { Column() { Text() { Span(this.count.toString()) .fontSize(20) .fontWeight(400) .lineHeight(24) Span(th...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default AST#ERROR#Left struct ReadRecordItem { AST#property_declaration#Left private count : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 243 AS...
@Component export default struct ReadRecordItem { private count: number = 243; private unit: string = '小时'; private placeText: string = '阅读时长'; build() { Column() { Text() { Span(this.count.toString()) .fontSize(20) .fontWeight(400) .lineHeight(24) Span(th...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componets/bookDetail/ReadRecordItem.ets#L8-L26
f174c83736e2db22e5cc6ef6251ca9e208a4cdba
github
fengmingdev/protobuf-arkts-generator.git
75888d404fd6ce52a046cba2a94807ecf1350147
runtime/arkpb/MessageRegistry.ets
arkts
clear
清空注册表 ⚠️ 警告:此操作会清空所有已注册的类型 使用示例: ```typescript MessageRegistry.clear() ```
static clear(): void { MessageRegistry.types.clear() }
AST#method_declaration#Left static clear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#...
static clear(): void { MessageRegistry.types.clear() }
https://github.com/fengmingdev/protobuf-arkts-generator.git/blob/75888d404fd6ce52a046cba2a94807ecf1350147/runtime/arkpb/MessageRegistry.ets#L242-L244
5b2b1bfd1f4b9773ad14bcb564da71e7d659101a
github
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSMusicPlayer/entry/src/main/ets/common/constants/SongConstants.ets
arkts
Constants for common components.
export class SongConstants { /** * Song list index add 1. */ static readonly ADD_INDEX_ONE: number = 1; /** * Song list index add 2. */ static readonly ADD_INDEX_TWO: number = 2; /** * Song list index add 3. */ static readonly ADD_INDEX_THREE: number = 3; /** * The slice start is 0...
AST#export_declaration#Left export AST#class_declaration#Left class SongConstants AST#class_body#Left { /** * Song list index add 1. */ AST#property_declaration#Left static readonly ADD_INDEX_ONE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#express...
export class SongConstants { static readonly ADD_INDEX_ONE: number = 1; static readonly ADD_INDEX_TWO: number = 2; static readonly ADD_INDEX_THREE: number = 3; static readonly SLICE_START_ZERO: number = 0; static readonly SLICE_END_THREE: number = 3; static readonly SLICE_INDEX_ONE: n...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSMusicPlayer/entry/src/main/ets/common/constants/SongConstants.ets#L5-L55
7a4c62da7703dbcfc3c09b6eace49817bb4d1277
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Native/DecodeHEIFImage/decodeheifimage/Index.ets
arkts
DecodeHEIFImageView
Copyright (c) 2025 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { DecodeHEIFImageView } from './src/main/ets/DecodeHEIFImageView';
AST#export_declaration#Left export { DecodeHEIFImageView } from './src/main/ets/DecodeHEIFImageView' ; AST#export_declaration#Right
export { DecodeHEIFImageView } from './src/main/ets/DecodeHEIFImageView';
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Native/DecodeHEIFImage/decodeheifimage/Index.ets#L16-L16
87e3f3ff3f1e088684a62b5b9cde0703f7bac688
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/Tools.ets
arkts
getMimeType
根据文件后缀名获取文件mimeType @param fileExtention 文件后缀名,例如:html txt doc ts mp3
static getMimeType(fileExtention: string): string { const typeDescriptor = Tools.getTypeDescriptor(fileExtention); const mimeTypes = typeDescriptor.mimeTypes; if (mimeTypes && mimeTypes.length > 0) { return mimeTypes[0]; } else { return '*/*'; } }
AST#method_declaration#Left static getMimeType AST#parameter_list#Left ( AST#parameter#Left fileExtention : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#pr...
static getMimeType(fileExtention: string): string { const typeDescriptor = Tools.getTypeDescriptor(fileExtention); const mimeTypes = typeDescriptor.mimeTypes; if (mimeTypes && mimeTypes.length > 0) { return mimeTypes[0]; } else { return '*/*'; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L336-L344
f8691465851a9363f8362b36ef2e3342b4a3d8ee
gitee
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
duration
export const AD_DURATION: number = 5;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left AD_DURATION : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 5 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R...
export const AD_DURATION: number = 5;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L97-L97
9c977aa16aa8a80bb1ef6bfb50907810cd22b26f
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.FoldSplitContainer.d.ets
arkts
The status of hover mode. @interface HoverStatus @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export interface HoverModeStatus { /** * The fold status of devices. * * @type { display.FoldStatus } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ foldStatus: display.FoldStatus; /** * Is the app currently in hover mode? * In hover ...
AST#export_declaration#Left export AST#interface_declaration#Left interface HoverModeStatus AST#object_type#Left { /** * The fold status of devices. * * @type { display.FoldStatus } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 12 */ AST#type_member#Left foldSt...
export interface HoverModeStatus { foldStatus: display.FoldStatus; isHoverMode: boolean; appRotation: number; windowStatusType: window.WindowStatusType; }
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.FoldSplitContainer.d.ets#L196-L234
21ddf96efbdbf43394ebe0b42f91307ff80ae0ad
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/navigation/PrivacyPolicyNav.ets
arkts
PrivacyPolicyNav
@file 隐私政策页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function PrivacyPolicyNav(): void { PrivacyPolicyPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PrivacyPolicyNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_cust...
@Builder export function PrivacyPolicyNav(): void { PrivacyPolicyPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/navigation/PrivacyPolicyNav.ets#L8-L11
de70bb99cc34429c569053a075d438243323c9d0
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/mine/UserProfile.ets
arkts
getAvatarIcon
获取头像对应的 emoji 图标
private getAvatarIcon(): string { return AVATAR_ICONS[this.userAvatar] || '👤'; }
AST#method_declaration#Left private getAvatarIcon AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_ex...
private getAvatarIcon(): string { return AVATAR_ICONS[this.userAvatar] || '👤'; }
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/mine/UserProfile.ets#L38-L40
f28e194f546b47e35db33a90914e816837bc9f93
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/analytics/AnalyticsPage.ets
arkts
onExport
导出统计数据
async onExport(format: 'json' | 'csv') { try { const data = await this.analyticsService.exportStatistics(format); // TODO: 保存到文件或分享 console.log('Exported data:', data); this.showExportDialog = false; } catch (error) { console.error('Failed to export data:', error); } }
AST#method_declaration#Left async onExport AST#parameter_list#Left ( AST#parameter#Left format AST#parameter#Right AST#ERROR#Left : 'json' | 'csv' AST#ERROR#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variabl...
async onExport(format: 'json' | 'csv') { try { const data = await this.analyticsService.exportStatistics(format); console.log('Exported data:', data); this.showExportDialog = false; } catch (error) { console.error('Failed to export data:', error); } }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/analytics/AnalyticsPage.ets#L48-L57
5beb4eaeb44e1fab7cbe1e8c0dc2d6f9372f82a1
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/ListItemDrag.ets
arkts
ListItemDrag
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...
@Component export struct ListItemDrag { @State numbers: string[] = ['one', 'two', 'three', 'four', 'five', 'six'] @State dragIndex: number = -1 // 自定义拖拽过程中显示的内容 @Builder pixelMapBuilder(item: string) { Text(item) .width(400) .height(80) .fontSize(16) .borderRadius(10) .textA...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemDrag AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right numbers : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_typ...
@Component export struct ListItemDrag { @State numbers: string[] = ['one', 'two', 'three', 'four', 'five', 'six'] @State dragIndex: number = -1 @Builder pixelMapBuilder(item: string) { Text(item) .width(400) .height(80) .fontSize(16) .borderRadius(10) .textAlign(TextAlign.C...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/ListItemDrag.ets#L16-L71
438f44aaf341cd9bc4dcce428b1ceec9f8132bef
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets
arkts
add1stItem
增加数据
public add1stItem(): void { this.dataArray.splice(0, 0, this.dataArray[this.dataArray.length]); this.notifyDataAdd(0); }
AST#method_declaration#Left public add1stItem AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expres...
public add1stItem(): void { this.dataArray.splice(0, 0, this.dataArray[this.dataArray.length]); this.notifyDataAdd(0); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L122-L125
4ec4c7c798733cb4797f139bbc534ec22fd75aac
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/datas/model/SearchManager.ets
arkts
queryForWrangTimes
按 wrangTimes 倒序分段 searchText 可选:模糊查询(仅匹配 wordEn 与 wordJp) 仅包含 wrangTimes > 0 的单词(与 Java 行为一致)
queryForWrangTimes(filtedWords: WordUser[]): SectionDatas<string, WordUser> { const sectionWords = new SectionDatas<string, WordUser>(); filtedWords.sort((a, b) => { const A : number = a.wrangTimes ?? 0; const B : number = b.wrangTimes ?? 0; return B - A; // 降序 }); filtedWords.forEa...
AST#method_declaration#Left queryForWrangTimes AST#parameter_list#Left ( AST#parameter#Left filtedWords : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left WordUser [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annota...
queryForWrangTimes(filtedWords: WordUser[]): SectionDatas<string, WordUser> { const sectionWords = new SectionDatas<string, WordUser>(); filtedWords.sort((a, b) => { const A : number = a.wrangTimes ?? 0; const B : number = b.wrangTimes ?? 0; return B - A; }); filtedWords.forEach(wo...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L748-L766
1e953bd6455c951844b99908df5bd0a5fab91050
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_history.ets
arkts
get_history_months
Lists all the months in which ther are history records made. @returns A number[][] array, e.g. [[2024, 2], [2023, 4], ...].
static get_history_months(context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; // Ensure this month ensure_this_month_history_file(context_filesDir); // Traverse directory let result: number[][] = []; try { let history_files = fs.listFileSync(file...
AST#method_declaration#Left static get_history_months AST#parameter_list#Left ( AST#parameter#Left context_filesDir ? : 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#...
static get_history_months(context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; ensure_this_month_history_file(context_filesDir); let result: number[][] = []; try { let history_files = fs.listFileSync(filesDir + '/history', { recursion: false });...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_history.ets#L148-L170
6d6a78c39cfaa6384a0eff743b2f6ee555190b55
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets
arkts
createSocket
创建Socket @param localIp @param port
async createSocket(localIp: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls bind localIp: ${localIp}`); try { if (this.udpSocket) { await this.closeSocket(); } this.udpSocket = socket.constructUDPSocketInstance(); await this.udpSocket.bind({ address: l...
AST#method_declaration#Left async createSocket AST#parameter_list#Left ( AST#parameter#Left localIp : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left port : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t...
async createSocket(localIp: string, port: number): Promise<boolean> { Logger.info(`${TAG} tls bind localIp: ${localIp}`); try { if (this.udpSocket) { await this.closeSocket(); } this.udpSocket = socket.constructUDPSocketInstance(); await this.udpSocket.bind({ address: l...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/socket/UdpSocket.ets#L29-L49
4b7a19a5a770163687ad921d6394f3dd6683f930
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/TabNode.ets
arkts
getSize
底部导航栏高度 计算FlowItem宽/高
getSize() { let ret = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); } // 设置FlowItem的宽/高数组 setItemSizeArray() { for (let i = 0; i < 100; i++) { this.itemWidthArray.push(this.getSize()); this.itemHeightArray.push(this.getSize()); }
AST#method_declaration#Left getSize AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left ret = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Math...
getSize() { let ret = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); } setItemSizeArray() { for (let i = 0; i < 100; i++) { this.itemWidthArray.push(this.getSize()); this.itemHeightArray.push(this.getSize()); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/view/TabNode.ets#L47-L57
dea3b44260274c40167232e4b3d21c521b621d26
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/GreetingsPage.ets
arkts
exitSelectionMode
退出选择模式
private exitSelectionMode(): void { this.isSelectionMode = false; this.selectedGreetings.clear(); }
AST#method_declaration#Left private exitSelectionMode 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#L...
private exitSelectionMode(): void { this.isSelectionMode = false; this.selectedGreetings.clear(); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/GreetingsPage.ets#L121-L124
3145e27470a3ae99baa1ae6525a5b96f56f566fa
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/RSASync.ets
arkts
encodePKCS1
加密 @param str 待加密的字符串 @param pubKey RSA公钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式 @param isPem 秘钥是否为pem格式 - 默认为false
static encodePKCS1(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
AST#method_declaration#Left static encodePKCS1 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 pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_typ...
static encodePKCS1(str: string, pubKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64', isPem: boolean = false): string { return CryptoSyncUtil.encodeAsym(str, pubKey, 'RSA1024', 'RSA1024|PKCS1', 1024, keyCoding, resultCoding, isPem); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSASync.ets#L56-L59
82cffb2ddd90c3a19e47fdef345541aa899935bc
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
arkts
isInstanceNotNull
[StartExclude audio_player_service]
public static isInstanceNotNull(): boolean { return AudioPlayerService.instance !== null; }
AST#method_declaration#Left public static isInstanceNotNull AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AS...
public static isInstanceNotNull(): boolean { return AudioPlayerService.instance !== null; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets#L42-L44
4a276fca75759680fc26e11220b3788bd44b6635
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets
arkts
versionId
版本ID
static versionId(): string { return deviceInfo.versionId }
AST#method_declaration#Left static versionId AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express...
static versionId(): string { return deviceInfo.versionId }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L182-L184
05dc49713fc0a10de034407aeef46ae0fa19564a
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/viewmodels/ReviewViewModel.ets
arkts
getMotivationalText
获取激励文案
static getMotivationalText(completedCount: number): string { if (completedCount === 0) return '开始你的专注之旅'; if (completedCount < 5) return '很好的开始,继续保持!'; if (completedCount < 10) return '专注力正在养成中'; if (completedCount < 20) return '你已经是时间管理高手了!'; return '坚持让你成为更好的自己'; }
AST#method_declaration#Left static getMotivationalText AST#parameter_list#Left ( AST#parameter#Left completedCount : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left stri...
static getMotivationalText(completedCount: number): string { if (completedCount === 0) return '开始你的专注之旅'; if (completedCount < 5) return '很好的开始,继续保持!'; if (completedCount < 10) return '专注力正在养成中'; if (completedCount < 20) return '你已经是时间管理高手了!'; return '坚持让你成为更好的自己'; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/viewmodels/ReviewViewModel.ets#L56-L62
01f8aeb9c9333fec77d1c1cdb470082d17b854f9
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/CombinedData.ets
arkts
calcMinMax
@Override
public calcMinMax() { if (this.mDataSets == null) { this.mDataSets = new JArrayList(); } this.mDataSets.clear(); this.mYMax = -Number.MAX_VALUE; this.mYMin = Number.MAX_VALUE; this.mXMax = -Number.MAX_VALUE; this.mXMin = Number.MAX_VALUE; this.mLeftAxisMax = -Number.MAX_VALUE; ...
AST#method_declaration#Left public calcMinMax AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . mDataS...
public calcMinMax() { if (this.mDataSets == null) { this.mDataSets = new JArrayList(); } this.mDataSets.clear(); this.mYMax = -Number.MAX_VALUE; this.mYMin = Number.MAX_VALUE; this.mXMax = -Number.MAX_VALUE; this.mXMin = Number.MAX_VALUE; this.mLeftAxisMax = -Number.MAX_VALUE; ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/CombinedData.ets#L74-L132
81421da732e0bd3a5b41a2c9abb1416a2ac1304e
gitee
shubai-xixi/DistributeNewsArkts.git
7a527c5f4121612c8070d809824b0f2615d1b238
entry/src/main/ets/model/NewsDataModel.ets
arkts
获取默认新闻(第一条新闻数据)
export function getDefaultData(): NewsData { let item = NewsComposition[0] let newsData: NewsData = new NewsData(item) return newsData; }
AST#export_declaration#Left export AST#function_declaration#Left function getDefaultData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NewsData AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#...
export function getDefaultData(): NewsData { let item = NewsComposition[0] let newsData: NewsData = new NewsData(item) return newsData; }
https://github.com/shubai-xixi/DistributeNewsArkts.git/blob/7a527c5f4121612c8070d809824b0f2615d1b238/entry/src/main/ets/model/NewsDataModel.ets#L194-L198
3c95e05030e0b93cf83cf0a8e386f2c93690a679
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets
arkts
getData
获取指定数据项
getData(index: number): FriendMoment { return this.comments[index]; }
AST#method_declaration#Left getData 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#type_annotation#Left AST#primary_type#Left FriendMoment AST#primary_type#Ri...
getData(index: number): FriendMoment { return this.comments[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/publishmultimediaupdates/src/main/ets/model/BasicDataSource.ets#L109-L111
e75e19c07b9f8056cda29ae572ec4a2725dc5280
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DbFileUtility.ets
arkts
checkDataBaseExists
检查数据库文件是否存在 @param dbPath 数据库文件路径 @returns 文件存在返回true,否则返回false
private static checkDataBaseExists(dbPath: string): boolean { try { return fs.accessSync(dbPath); } catch { return false; } }
AST#method_declaration#Left private static checkDataBaseExists AST#parameter_list#Left ( AST#parameter#Left dbPath : 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 bool...
private static checkDataBaseExists(dbPath: string): boolean { try { return fs.accessSync(dbPath); } catch { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DbFileUtility.ets#L155-L161
17780320db03329beb8e0771feb1729e43847398
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/ImageDrag.ets
arkts
ImageDrag
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...
@Component export struct ImageDrag { @State visible: boolean = true // 自定义拖拽过程中显示的内容 @Builder pixelMapBuilder() { Image($r('app.media.icon')) .width(48) .aspectRatio(1) } build() { Column() { Image($r('app.media.icon')) .id('image') .width(48) .aspectRatio(1...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ImageDrag AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right visible : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotat...
@Component export struct ImageDrag { @State visible: boolean = true @Builder pixelMapBuilder() { Image($r('app.media.icon')) .width(48) .aspectRatio(1) } build() { Column() { Image($r('app.media.icon')) .id('image') .width(48) .aspectRatio(1) .visib...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/ComponentCollection/entry/src/main/ets/pages/universal/events/dragEventSample/component/ImageDrag.ets#L16-L48
ec6b1dd8e1605350efee13eca37e5a8cc042ecab
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/blendmode/src/main/ets/model/DataSource.ets
arkts
getData
获取指定数据项
public getData(index: number): PendantType { return this.originDataArray[index]; }
AST#method_declaration#Left public getData 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#type_annotation#Left AST#primary_type#Left PendantType AST#primary_t...
public getData(index: number): PendantType { return this.originDataArray[index]; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/blendmode/src/main/ets/model/DataSource.ets#L30-L32
e658336b429f7d107e2043df759087af109f2f61
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets
arkts
translate
Post-translates to the specified points. Less Performant. @param transformedPts @return
public translate(transformedPts: number[], outputMatrix: Matrix): Matrix { var save: Matrix = outputMatrix != null && outputMatrix != undefined ? outputMatrix : new Matrix(); save.reset(); save.set(this.mMatrixTouch); const x: number = transformedPts[0] - this.offsetLeft(); const y: number = transfo...
AST#method_declaration#Left public translate AST#parameter_list#Left ( AST#parameter#Left transformedPts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outputMatrix : AST#type_...
public translate(transformedPts: number[], outputMatrix: Matrix): Matrix { var save: Matrix = outputMatrix != null && outputMatrix != undefined ? outputMatrix : new Matrix(); save.reset(); save.set(this.mMatrixTouch); const x: number = transformedPts[0] - this.offsetLeft(); const y: number = transfo...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets#L292-L300
002830bf7c32f1dcadd4f5fd91831a59b4c3c6e0
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/AxisBase.ets
arkts
getAxisLineColor
Returns the color of the axis line (line alongside the axis). @return
public getAxisLineColor(): number { return this.mAxisLineColor; }
AST#method_declaration#Left public getAxisLineColor 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 getAxisLineColor(): number { return this.mAxisLineColor; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L332-L334
7f8240dbebe81b523dea4874eff423d6e014034b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
getStatusBarHeight
获取状态栏的高度,单位为px。 @returns
static getStatusBarHeight(): number { try { const windowClass = AppUtil.getMainWindow(); const avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); return avoidArea.topRect.height; } catch (err) { LogUtil.error(err); return 0; } }
AST#method_declaration#Left static getStatusBarHeight 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#try_statement#Left try AST#block_statement#Left { AST#stat...
static getStatusBarHeight(): number { try { const windowClass = AppUtil.getMainWindow(); const avoidArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); return avoidArea.topRect.height; } catch (err) { LogUtil.error(err); return 0; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L369-L378
e5e1df52fd6243ca58dc4201da966d3534770b3a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/widgets/pages/WidgetCard2x2.ets
arkts
buildContentView
构建内容视图
@Builder buildContentView() { Column({ space: 8 }) { // 头部信息 Row() { if (this.widgetData.contactAvatar) { Image(this.widgetData.contactAvatar) .width('24vp') .height('24vp') .borderRadius(12) } else { Circle({ width: 24, height: 2...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContentView 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_pa...
@Builder buildContentView() { Column({ space: 8 }) { Row() { if (this.widgetData.contactAvatar) { Image(this.widgetData.contactAvatar) .width('24vp') .height('24vp') .borderRadius(12) } else { Circle({ width: 24, height: 24 }) ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/pages/WidgetCard2x2.ets#L33-L112
da5115aa72ce801661689372aea38c30dfa9c130
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/renderer/BubbleChartRenderer.ets
arkts
drawData
@Override
public drawData(c: CanvasRenderingContext2D): void { let bubbleData: BubbleData | null = this.mChart.getBubbleData(); if (!bubbleData) { return; } for (let i = 0;i < bubbleData.getDataSets().size(); i++) { if (bubbleData.getDataSets().get(i).isVisible()) { this.drawDataSet(c, bubbl...
AST#method_declaration#Left public drawData AST#parameter_list#Left ( AST#parameter#Left c : AST#type_annotation#Left AST#primary_type#Left CanvasRenderingContext2D AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#p...
public drawData(c: CanvasRenderingContext2D): void { let bubbleData: BubbleData | null = this.mChart.getBubbleData(); if (!bubbleData) { return; } for (let i = 0;i < bubbleData.getDataSets().size(); i++) { if (bubbleData.getDataSets().get(i).isVisible()) { this.drawDataSet(c, bubbl...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/BubbleChartRenderer.ets#L53-L65
5b1129549f41b03fb4c3dfa966c5211e7626e2aa
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets
arkts
queryAccountData
Query account data. @param {string} accountName Account Name. @param {DataRdb.RdbStore} rdbStore RDB database.
queryAccountData(accountName: string, rdbStore: DataRdb.RdbStore) { return new Promise<DataRdb.ResultSet>((resolve, reject) => { let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_ACCOUNT); predicates.equalTo(CommonConstants.FIELD_DISTRIBUTED_ACCOUNT_NAME, accountNam...
AST#method_declaration#Left queryAccountData AST#parameter_list#Left ( AST#parameter#Left accountName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left rdbStore : AST#type_annotation#Left AST#primary_type#Left AST#qualified_...
queryAccountData(accountName: string, rdbStore: DataRdb.RdbStore) { return new Promise<DataRdb.ResultSet>((resolve, reject) => { let predicates: DataRdb.RdbPredicates = new DataRdb.RdbPredicates(CommonConstants.TABLE_ACCOUNT); predicates.equalTo(CommonConstants.FIELD_DISTRIBUTED_ACCOUNT_NAME, accountNam...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DistributedAppDev/DistributedAccount/entry/src/main/ets/common/utils/DatabaseUtils.ets#L113-L125
fce0d8440580a683a1c27672f58dfd916a6e924b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
spinkit/src/main/ets/components/SpinW.ets
arkts
SpinW
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01
@ComponentV2 export struct SpinW { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local angle2: number = 0; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.spin...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinW AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinW { @Require @Param spinSize: number; @Require @Param spinColor: ResourceColor; @Local angle1: number = 0; @Local angle2: number = 0; build() { Stack() { Canvas() .width(this.spinSize) .height(this.spinSize) .border({ width: this.spin...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinW.ets#L22-L88
9678d8ec1514cb75cb1780824b28d822d9b50a52
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/AppDatabaseUtil.ets
arkts
existsTable
检测表中的字段是否缺失,若是缺失则新增
async existsTable(tableName: string) { try { const rowNames = await DbUtil.queryRowNames(tableName); const fields = this.getFields(tableName) if (!fields?.length) return for (let index = 0; index < fields.length; index++) { const element = fields[index]; if (!rowNames.include...
AST#method_declaration#Left async existsTable AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Lef...
async existsTable(tableName: string) { try { const rowNames = await DbUtil.queryRowNames(tableName); const fields = this.getFields(tableName) if (!fields?.length) return for (let index = 0; index < fields.length; index++) { const element = fields[index]; if (!rowNames.include...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/AppDatabaseUtil.ets#L20-L37
f6c60ca06363027fdaa13bdc820103f8e269b4d0
github
lentozi/DailyPlan.git
96ce0bec8f545511c51b577c4aa8327c2c5bb0c8
entry/src/main/ets/databaseability/DatabaseAbility.ets
arkts
deleteData
删除数据
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => {}) { if (!callback || typeof callback === 'undefined' || callback === undefined) { hilog.info(0x0000, '[Debug.Rdb]', 'deleteData() has no callback!'); return; } let resFlag: boolean = false; if (this.rdbStore) ...
AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callb...
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => {}) { if (!callback || typeof callback === 'undefined' || callback === undefined) { hilog.info(0x0000, '[Debug.Rdb]', 'deleteData() has no callback!'); return; } let resFlag: boolean = false; if (this.rdbStore) ...
https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/databaseability/DatabaseAbility.ets#L75-L92
aa6ff21b927810cc6712ad0331c0756d4bcd6457
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.ToolBarV2.d.ets
arkts
stateEffect
Sets whether or not to display the press status effect. @param { boolean } stateEffect - press status effect. @returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier. @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 18
stateEffect(stateEffect: boolean): ToolBarV2Modifier;
AST#method_declaration#Left stateEffect AST#parameter_list#Left ( AST#parameter#Left stateEffect : 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 ToolBarV2Modifier AST...
stateEffect(stateEffect: boolean): ToolBarV2Modifier;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ToolBarV2.d.ets#L590-L590
1e84b5d1f50f5a08b2f584b03d0d2e8609e154df
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/ChartModel.ets
arkts
calculateOffsets
Calculates the offsets of the chart to the border depending on the position of an eventual legend or depending on the length of the y-axis and x-axis labels and their position
protected abstract calculateOffsets();
AST#method_declaration#Left protected abstract calculateOffsets AST#parameter_list#Left ( ) AST#parameter_list#Right ; AST#method_declaration#Right
protected abstract calculateOffsets();
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ChartModel.ets#L316-L316
faaddb2a0de336d7808aa3234e573b5cfb2f6eb1
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets
arkts
evaluateBound
TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换
evaluateBound(): void { const xBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_WIDTH, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, togglePerc...
AST#method_declaration#Left evaluateBound AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left xBol = AST#...
evaluateBound(): void { const xBol = constrainOffsetAndAnimation({ dimensionWH: ImageFitType.TYPE_WIDTH, imageDefaultSize: this.imageDefaultSize, imageOffsetInfo: this.imageOffsetInfo, scaleValue: this.imageScaleInfo.scaleValue, rotate: this.imageRotateInfo.lastRotate, togglePerc...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L188-L245
9a728c45a2378a4e45140f1ad7e654e21aec5ec0
gitee
lemoye622/vmall.git
eac911317a088cc92ca07c58f29c50e18c0a5286
entry/src/main/ets/pages/tabs/Home.ets
arkts
aboutToAppear
滚动条实例
aboutToAppear() { this.fetchBanners(); this.fetchNavigationMenus(); this.fetchPremiumProducts(); this.fetchCategories(); this.fetchRecommendedProducts(); }
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 . fetchBanners AST#membe...
aboutToAppear() { this.fetchBanners(); this.fetchNavigationMenus(); this.fetchPremiumProducts(); this.fetchCategories(); this.fetchRecommendedProducts(); }
https://github.com/lemoye622/vmall.git/blob/eac911317a088cc92ca07c58f29c50e18c0a5286/entry/src/main/ets/pages/tabs/Home.ets#L26-L32
329c8ea6796ef8b9ae45e3e3c619095e717826dd
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
@file 商品相关仓库类,封装商品模块请求 @author Joker.X
export class GoodsRepository { /** * 商品网络数据源 */ private networkDataSource: GoodsNetworkDataSource; /** * 构造函数 * @param networkDataSource 可选的商品网络数据源实例 */ constructor(networkDataSource?: GoodsNetworkDataSource) { this.networkDataSource = networkDataSource ?? new GoodsNetworkDataSourceImpl(); ...
AST#export_declaration#Left export AST#class_declaration#Left class GoodsRepository AST#class_body#Left { /** * 商品网络数据源 */ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left GoodsNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#property...
export class GoodsRepository { private networkDataSource: GoodsNetworkDataSource; constructor(networkDataSource?: GoodsNetworkDataSource) { this.networkDataSource = networkDataSource ?? new GoodsNetworkDataSourceImpl(); } async getGoodsTypeList(): Promise<NetworkResponse<Category[]>> { return...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/GoodsRepository.ets#L20-L94
02d15d9bede8d0af941fd0a5958037fb65ede3d1
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
设定角标个数 在应用的桌面图标上呈现。 @param {number} badgeNumber 角标个数。当角标设定个数取值小于或等于0时,清除角标。取值大于99时,通知角标将显示99+。 @returns {Promise<void>} void
export async function setBadgeNumber(badgeNumber: number): Promise<void> { return notificationManager.setBadgeNumber(badgeNumber); }
AST#export_declaration#Left export AST#function_declaration#Left async function setBadgeNumber AST#parameter_list#Left ( AST#parameter#Left badgeNumber : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annot...
export async function setBadgeNumber(badgeNumber: number): Promise<void> { return notificationManager.setBadgeNumber(badgeNumber); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L334-L336
224d0445fb8730bd5a3f81cef1f123419317fbd6
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DeviceUtil.ets
arkts
getHardwareModel
获取硬件版本号。示例:HL1CMSM
static getHardwareModel(): string { return deviceInfo.hardwareModel; }
AST#method_declaration#Left static getHardwareModel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
static getHardwareModel(): string { return deviceInfo.hardwareModel; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L179-L181
82ba52b25b388aceafb23c059926ac4c1c38570f
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/services/CloudDBService.ets
arkts
close
关闭云数据库
async close(): Promise<void> { console.log('关闭云数据库连接(模拟)'); this.initialized = false; }
AST#method_declaration#Left async close AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#...
async close(): Promise<void> { console.log('关闭云数据库连接(模拟)'); this.initialized = false; }
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/services/CloudDBService.ets#L176-L179
749f1efc2ce00d54fc1b0ba1a231c78c2961ff70
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/constants/LayoutPercent.ets
arkts
5% 百分比
export const P5: string = "5%";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P5 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "5%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right A...
export const P5: string = "5%";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L14-L14
1fb939663c462007eefd46a6c687ef20e0e69da0
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinPoetry/entry/src/main/ets/model/PoetryMenuEssence.ets
arkts
诗词的数据格式
export interface PoetryType { id: number title: string author: AuthorType type: string tags: string[] source: string status: string dynasty: string submitter: SubmitterType, createdAt: string updatedAt: string content: string[] }
AST#export_declaration#Left export AST#interface_declaration#Left interface PoetryType AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left title : AST#type_annotation#Left AST#p...
export interface PoetryType { id: number title: string author: AuthorType type: string tags: string[] source: string status: string dynasty: string submitter: SubmitterType, createdAt: string updatedAt: string content: string[] }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/model/PoetryMenuEssence.ets#L22-L35
449b0f2a1e03b23b4b1c9c5c286351b160d426f7
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/HillCipher.ets
arkts
decrypt
解密文本 @param text 要解密的文本 @param key 2x2密钥矩阵 @returns 解密后的文本
static decrypt(text: string, key: number[][]): string { // 计算密钥矩阵的行列式 const a = key[0][0]; const b = key[0][1]; const c = key[1][0]; const d = key[1][1]; const det = (a * d - b * c + HillCipher.MOD) % HillCipher.MOD; // 计算行列式的模逆 let detInverse = 0; for (let i = 0; i < HillCipher.MOD...
AST#method_declaration#Left static decrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [...
static decrypt(text: string, key: number[][]): string { const a = key[0][0]; const b = key[0][1]; const c = key[1][0]; const d = key[1][1]; const det = (a * d - b * c + HillCipher.MOD) % HillCipher.MOD; let detInverse = 0; for (let i = 0; i < HillCipher.MOD; i++) { if ((det ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/HillCipher.ets#L121-L170
f314f59ee4c6d851833f16b024c5c23ab8e69cb9
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/analytics/AnalyticsService.ets
arkts
祝福语风格统计接口
export interface GreetingStyleStat { style: string; count: number; percentage: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingStyleStat AST#object_type#Left { AST#type_member#Left style : 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_annotatio...
export interface GreetingStyleStat { style: string; count: number; percentage: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L55-L59
d1649dd3ffcb1cd95e2d15e4a5f198afdbc3c08a
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/higher_order_function/higher_order_function_003_T.ets
arkts
Introduction 高阶函数-二阶
export function higher_order_function_003_T(taint_src : string) { taint.Sink(f33(g3)(taint_src,"a")); }
AST#export_declaration#Left export AST#function_declaration#Left function higher_order_function_003_T AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_s...
export function higher_order_function_003_T(taint_src : string) { taint.Sink(f33(g3)(taint_src,"a")); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/higher_order_function/higher_order_function_003_T.ets#L6-L8
3e4db25d19ece403978fbdef64cb598c26b6f4d5
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/SearchPage.ets
arkts
clearSearchHistory
清除搜索历史
private clearSearchHistory(): void { this.searchHistory = []; // TODO: 清除本地存储 }
AST#method_declaration#Left private clearSearchHistory 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#...
private clearSearchHistory(): void { this.searchHistory = []; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L80-L83
b399edca212bc5e49cc16a1a05ecb0787df9e176
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSource.ets
arkts
@file 客服相关数据源接口 @author Joker.X
export interface CustomerServiceNetworkDataSource { /** * 创建客服会话 * @returns 客服会话响应 */ createSession(): Promise<NetworkResponse<CsSession>>; /** * 获取会话详情 * @returns 会话详情响应 */ getSessionDetail(): Promise<NetworkResponse<CsSession>>; /** * 标记消息为已读 * @param params 已读消息请求参数 * @returns ...
AST#export_declaration#Left export AST#interface_declaration#Left interface CustomerServiceNetworkDataSource AST#object_type#Left { /** * 创建客服会话 * @returns 客服会话响应 */ AST#type_member#Left createSession AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gene...
export interface CustomerServiceNetworkDataSource { createSession(): Promise<NetworkResponse<CsSession>>; getSessionDetail(): Promise<NetworkResponse<CsSession>>; readMessage(params: ReadMessageRequest): Promise<NetworkResponse<boolean>>; getMessagePage(params: MessagePageRequest): Promise<Networ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/cs/CustomerServiceNetworkDataSource.ets#L7-L39
16c07ff740ff457f1ce5546f65c7af455f4256e3
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/RabinKarp.ets
arkts
Rabin-Karp 字符串搜索算法实现 该算法使用哈希函数来加速字符串匹配
export class RabinKarp { private static readonly PRIME: number = 101; // 质数,用于哈希计算 private static readonly BASE: number = 256; // 字符集大小 /** * 使用 Rabin-Karp 算法在文本中搜索模式串 * @param text 要搜索的文本 * @param pattern 要查找的模式串 * @returns 模式串在文本中的起始位置,如果未找到则返回 -1 */ public static search(text: string, pattern:...
AST#export_declaration#Left export AST#class_declaration#Left class RabinKarp AST#class_body#Left { AST#property_declaration#Left private static readonly PRIME : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 101 AST#expression#Right ; AST#pr...
export class RabinKarp { private static readonly PRIME: number = 101; private static readonly BASE: number = 256; public static search(text: string, pattern: string): number { if (!text || !pattern || pattern.length > text.length) { return -1; } const patternHash = RabinKarp.hash(pattern)...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L5-L251
1a7f3b3aa7c94cf5bbc3df492d1efb12fe10d1b3
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/viewmodel/VerifyItem.ets
arkts
验证码项实体 Verify item entity for login verification
export default class VerifyItem { /** * 验证码图片资源 * Image of verify item. */ image: Resource; /** * 验证码正确答案字符 * Correct characters of verify item. */ characters: string; constructor(image: Resource, characters: string) { this.image = image; this.characters = characters; } }
AST#export_declaration#Left export default AST#class_declaration#Left class VerifyItem AST#class_body#Left { /** * 验证码图片资源 * Image of verify item. */ AST#property_declaration#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_dec...
export default class VerifyItem { image: Resource; characters: string; constructor(image: Resource, characters: string) { this.image = image; this.characters = characters; } }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/VerifyItem.ets#L20-L37
1e672ccc4b8f1993040e2c2296e8a2ed9f40ca84
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/common/CommonData.ets
arkts
公共数据类
export default class CommonData { // 日程点年月日数组,用于月视图和周视图日程点刷新 public static SCHEDULE_ARRAY: string[] = []; // 日程点数组,用于应用持久化存储日程信息 public static SCHEDULE_DATA: Array<ScheduleInfo> = []; // 月视图/周视图上当前选中的日期 public static CURRENT_SELECT_DATE: string = ''; // 设备类型 public static DEVICE_TYPE: DeviceType = Devic...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonData AST#class_body#Left { // 日程点年月日数组,用于月视图和周视图日程点刷新 AST#property_declaration#Left public static SCHEDULE_ARRAY : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right A...
export default class CommonData { public static SCHEDULE_ARRAY: string[] = []; public static SCHEDULE_DATA: Array<ScheduleInfo> = []; public static CURRENT_SELECT_DATE: string = ''; public static DEVICE_TYPE: DeviceType = DeviceType.PHONE; public static IS_FOLD: boolean = false; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/common/CommonData.ets#L20-L31
8da187e800d973d33fdb81bc1abc5b1ff811cbbd
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
删除帖子 @param postId 要删除的帖子ID @returns 删除成功返回true
export async function deletePost(postId: number): Promise<boolean> { try { console.info(`删除帖子, postId: ${postId}`); // 检查参数 if (!postId) { throw new Error('删除帖子失败: 帖子ID不能为空'); } // 获取当前用户会话,确保用户已登录 const userSession = UserSession.getInstance(); if (!userSession.isLoggedIn()...
AST#export_declaration#Left export AST#function_declaration#Left async function deletePost AST#parameter_list#Left ( AST#parameter#Left postId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Lef...
export async function deletePost(postId: number): Promise<boolean> { try { console.info(`删除帖子, postId: ${postId}`); if (!postId) { throw new Error('删除帖子失败: 帖子ID不能为空'); } const userSession = UserSession.getInstance(); if (!userSession.isLoggedIn()) { throw new Error(...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1702-L1775
f8bed2257db48c91b7218a8ff70f2af8ab6b0819
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets
arkts
off
TODO:知识点:解绑
off(): void { this.inputController.off('insertText'); this.inputController.off('deleteLeft'); this.isListen = false; logger.info('detached'); // 退出文本编辑状态 this.inputController.hideTextInput(); this.isKeyboardShow = false; }
AST#method_declaration#Left off AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#...
off(): void { this.inputController.off('insertText'); this.inputController.off('deleteLeft'); this.isListen = false; logger.info('detached'); this.inputController.hideTextInput(); this.isKeyboardShow = false; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/VerifyCode/casesfeature/verifycode/src/main/ets/view/VerifyCodeView.ets#L105-L113
c5e0a45a9c6a41c3a8c13f18d23152813f17d4b0
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets
arkts
on
订阅事件(持续监听) @param event 事件名称 @param handler 处理函数(自动推断参数类型) @returns 取消订阅的函数
static on<T = void>(event: string, handler: (data?: T) => void): () => void { if (typeof handler !== 'function') { throw new Error('处理器必须为函数'); } // 初始化事件队列 if (!SimpleEventBus.listeners.has(event)) { SimpleEventBus.listeners.set(event, []); } // 添加处理器 SimpleEventBus.listeners....
AST#method_declaration#Left static on AST#type_parameters#Left < AST#type_parameter#Left T = AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#...
static on<T = void>(event: string, handler: (data?: T) => void): () => void { if (typeof handler !== 'function') { throw new Error('处理器必须为函数'); } if (!SimpleEventBus.listeners.has(event)) { SimpleEventBus.listeners.set(event, []); } SimpleEventBus.listeners.get(event)!.push(h...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/eventbus/SimpleEventBus.ets#L52-L67
5261e4ee4db463602309117116ddf9626bc323fe
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets
arkts
compareRsaPubKeyBySpec
将RSA公钥规格与预期值进行比较
function compareRsaPubKeyBySpec(rsaKeySpec: cryptoFramework.RSAPubKeySpec, n: bigint | string | number, e: bigint | string | number) { if (typeof n === 'string' || typeof e === 'string') { console.error('type is string'); return false; } if (typeof n === 'number' || typeof e === 'number') { console....
AST#function_declaration#Left function compareRsaPubKeyBySpec AST#parameter_list#Left ( AST#parameter#Left rsaKeySpec : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . RSAPubKeySpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , A...
function compareRsaPubKeyBySpec(rsaKeySpec: cryptoFramework.RSAPubKeySpec, n: bigint | string | number, e: bigint | string | number) { if (typeof n === 'string' || typeof e === 'string') { console.error('type is string'); return false; } if (typeof n === 'number' || typeof e === 'number') { console....
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/rsa/Callback.ets#L48-L65
56805c9802ed19ca99f63594f67418b5757b9b73
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
init
vm初始化 @param timeMs 跳跃到歌曲的毫秒时间点 @returns {Promise<void>}
async init(context: Context, musicInfoArr: Array<MusicInfo>): Promise<void> { // 初始化歌曲列表数据 musicInfoArr.forEach((musicInfo: MusicInfo) => { const musicModel: MusicModel = new MusicModel(musicInfo); this.musicModelArr.push(musicModel); }) this.curMusicModelRaw = this.musicModelArr[this.curMus...
AST#method_declaration#Left async init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left musicInfoArr : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le...
async init(context: Context, musicInfoArr: Array<MusicInfo>): Promise<void> { musicInfoArr.forEach((musicInfo: MusicInfo) => { const musicModel: MusicModel = new MusicModel(musicInfo); this.musicModelArr.push(musicModel); }) this.curMusicModelRaw = this.musicModelArr[this.curMusicModelIndex...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets#L107-L190
80aeb164ed705552531c09047ceaf135e37c606c
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/model/src/main/ets/request/ReadMessageRequest.ets
arkts
@param {ReadMessageRequest} init - 初始化数据
constructor(init: ReadMessageRequest) { this.ids = init.ids; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left init : AST#type_annotation#Left AST#primary_type#Left ReadMessageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_...
constructor(init: ReadMessageRequest) { this.ids = init.ids; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/model/src/main/ets/request/ReadMessageRequest.ets#L14-L16
601c5ea3e9c2d6a912fccca5b1d350de988440bb
github
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets
arkts
showText
/ 文字弹框
public static showText(loadingText: ResourceStr) { JhProgressHUD._showToast(loadingText, _ToastType.text) }
AST#method_declaration#Left public static showText AST#parameter_list#Left ( AST#parameter#Left loadingText : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stateme...
public static showText(loadingText: ResourceStr) { JhProgressHUD._showToast(loadingText, _ToastType.text) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhProgressHUD.ets#L49-L51
b3b0bbce50b88082531ff1b1a28d2f929de3cf92
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
buildUserProfile
用户信息卡片
@Builder buildUserProfile() { Row({ space: 16 }) { // 头像 Column() { Text('🎂') .fontSize(24) } .width(56) .height(56) .borderRadius(28) .backgroundColor(this.COLORS.primaryLight) .justifyContent(FlexAlign.Center) // 用户信息 Column({ space...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildUserProfile AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#component_parameters#Left { AST#component_param...
@Builder buildUserProfile() { Row({ space: 16 }) { Column() { Text('🎂') .fontSize(24) } .width(56) .height(56) .borderRadius(28) .backgroundColor(this.COLORS.primaryLight) .justifyContent(FlexAlign.Center) Column({ space: 4 }) { ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3468-L3519
08bc1e5bd5da37ed598f9e8a1e1f0ede793d11d2
github
AlbertZyc/tab-layout
4ba256eead3792c84128f8679b26ac159a2d7f06
entry/src/main/ets/BasicDataSource.ets
arkts
notifyDataMove
通知LazyForEach组件将from索引和to索引处的子组件进行交换
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
AST#method_declaration#Left notifyDataMove AST#parameter_list#Left ( AST#parameter#Left from : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left to : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right...
notifyDataMove(from: number, to: number): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L66-L70
c6beb0b6e317ed40d4e68774666a06d0414d0df6
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
unitArray2StrCoding
将字节流以16进制字符串输出-入参编码格式 @param arr Uint8Array数组 @param coding @returns 字符串
static unitArray2StrCoding(arr: Uint8Array, coding: buffer.BufferEncoding): string { return buffer.from(arr).toString(coding); }
AST#method_declaration#Left static unitArray2StrCoding AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualif...
static unitArray2StrCoding(arr: Uint8Array, coding: buffer.BufferEncoding): string { return buffer.from(arr).toString(coding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L59-L61
430c783e4f96081c57fa483046fc56995385fdb7
gitee
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/modules/live/LiveManager.ets
arkts
like
点赞
async like(): Promise<void> { EventBus.emit('LIVE_LIKED'); Logger.info('LiveManager', 'Like sent'); }
AST#method_declaration#Left async like AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments#R...
async like(): Promise<void> { EventBus.emit('LIVE_LIKED'); Logger.info('LiveManager', 'Like sent'); }
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/live/LiveManager.ets#L201-L204
d10c82af7b23d47115eb87440042c9208ce949d7
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/sorting/QuickSort.ets
arkts
sort
快速排序算法 @param arr 需要排序的数组 @returns 排序后的数组
public static sort(arr: number[]): number[] { const result = [...arr]; QuickSort.quickSort(result, 0, result.length - 1); return result; }
AST#method_declaration#Left public static sort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left ...
public static sort(arr: number[]): number[] { const result = [...arr]; QuickSort.quickSort(result, 0, result.length - 1); return result; }
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/QuickSort.ets#L10-L14
e6d4ac0398bf772922a1538217769650f94fe162
github
lime-zz/Ark-ui_RubbishRecycleApp.git
c2a9bff8fbb5bc46d922934afad0327cc1696969
rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets
arkts
getSelectedItemCount
获取选中商品数量
getSelectedItemCount(): number { return this.datas.filter((item: Type1): boolean => item.selected).length; }
AST#method_declaration#Left getSelectedItemCount 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_exp...
getSelectedItemCount(): number { return this.datas.filter((item: Type1): boolean => item.selected).length; }
https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/gouwuche.ets#L260-L262
1f621602dd2cc795183f4b214c230184b4fdcf5c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/PreferencesUtil.ets
arkts
getBooleanSync
获取boolean类型的缓存值 @param key @returns
static getBooleanSync(key: string, defValue: boolean = false, preferenceName: string = PreferencesUtil.defaultPreferenceName): boolean { return PreferencesUtil.getSync(key, defValue, preferenceName) as boolean; }
AST#method_declaration#Left static getBooleanSync 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 defValue : AST#type_annotation#Left AST#primary_type#Left boolean AST#prima...
static getBooleanSync(key: string, defValue: boolean = false, preferenceName: string = PreferencesUtil.defaultPreferenceName): boolean { return PreferencesUtil.getSync(key, defValue, preferenceName) as boolean; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L173-L176
7ebd78584ead1298cdc1eb68d31a96db9d63c6f0
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/SearchHistoryRepository.ets
arkts
addSearchHistory
添加搜索历史记录 @param {string} keyword 搜索关键词 @returns {Promise<void>} Promise<void> @example const repo: SearchHistoryRepository = new SearchHistoryRepository(); await repo.addSearchHistory("手机");
async addSearchHistory(keyword: string): Promise<void> { const trimmed: string = keyword.trim(); if (!trimmed) { return; } const history: SearchHistory = new SearchHistory(); history.keyword = trimmed; history.searchTime = Date.now(); return this.dataSource.addSearchHistory(history); ...
AST#method_declaration#Left async addSearchHistory AST#parameter_list#Left ( AST#parameter#Left keyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async addSearchHistory(keyword: string): Promise<void> { const trimmed: string = keyword.trim(); if (!trimmed) { return; } const history: SearchHistory = new SearchHistory(); history.keyword = trimmed; history.searchTime = Date.now(); return this.dataSource.addSearchHistory(history); ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L30-L39
55a70a5fc1cbcbdb26648ce39408d33ba8310e88
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets
arkts
copySandFile
[Start copy_sand_to_distributed] 将A设备的待拷贝沙箱文件,拷贝到A设备的分布式路径下。
function copySandFile(): void { // 待拷贝文件沙箱路径 let filePath: string = pathDir + '/src.txt'; try { // 文件不存在时,需要创建文件并写入内容 let file = fs.openSync(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); fs.writeSync(file.fd, 'Create file success'); fs.closeSync(file); } catch (err) { let error: Bu...
AST#function_declaration#Left function copySandFile AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 待拷贝文件沙箱路径 AST#statement#Left AST#variable_declaration#Left let AST#variable_declar...
function copySandFile(): void { let filePath: string = pathDir + '/src.txt'; try { let file = fs.openSync(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); fs.writeSync(file.fd, 'Create file success'); fs.closeSync(file); } catch (err) { let error: BusinessError = err as BusinessErro...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/DistributedFileSample/entry/src/main/ets/pages/Index.ets#L155-L188
7f59ff76502b79c609a3edbf1ea77fc8b7294538
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/DisplayUtils.ets
arkts
isTabletByLayout
通过逻辑分辨率比例判断 @returns 宽高比≥1.3且最小边≥600dp时返回true
public static isTabletByLayout(): boolean { const widthVp = DisplayUtils.getScreenWidthVp(); const heightVp = DisplayUtils.getScreenHeightVp(); const minEdge = Math.min(widthVp, heightVp); const aspectRatio = Math.max(widthVp, heightVp) / minEdge; return aspectRatio >= 1.3 && minEdge >= 600; // 平板典...
AST#method_declaration#Left public static isTabletByLayout 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#variable_declaration#Left const AST#variable_declara...
public static isTabletByLayout(): boolean { const widthVp = DisplayUtils.getScreenWidthVp(); const heightVp = DisplayUtils.getScreenHeightVp(); const minEdge = Math.min(widthVp, heightVp); const aspectRatio = Math.max(widthVp, heightVp) / minEdge; return aspectRatio >= 1.3 && minEdge >= 600; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/DisplayUtils.ets#L69-L76
5d6db2810198d539d0493660b0af1a4dbb9ffbbb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets
arkts
onComponentHide
组件隐藏时执行
onComponentHide() { this.isDialogShow = false; this.dialogController.close(); }
AST#method_declaration#Left onComponentHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isDialogShow AST#member_expression...
onComponentHide() { this.isDialogShow = false; this.dialogController.close(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets#L120-L123
173ce8e46f579a1055a92ce9370f97e0c6eb0c5c
gitee
HomoArk/Homogram.git
8a6e85898b6194fdd04ead75e732d348888a0c07
features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets
arkts
onEnterPhotoBrowser
进入大图页回调
private onEnterPhotoBrowser(photoBrowserInfo: PhotoBrowserInfo): boolean { console.info('onEnterPhotoBrowser' + JSON.stringify(photoBrowserInfo)); return false; }
AST#method_declaration#Left private onEnterPhotoBrowser AST#parameter_list#Left ( AST#parameter#Left photoBrowserInfo : AST#type_annotation#Left AST#primary_type#Left PhotoBrowserInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t...
private onEnterPhotoBrowser(photoBrowserInfo: PhotoBrowserInfo): boolean { console.info('onEnterPhotoBrowser' + JSON.stringify(photoBrowserInfo)); return false; }
https://github.com/HomoArk/Homogram.git/blob/8a6e85898b6194fdd04ead75e732d348888a0c07/features/home/src/main/ets/views/Chat/ChatDetailBottomPhotoPicker.ets#L120-L123
bc1f0927eeb10f271b139d21d5952002b53f57f3
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
getConvertKeyPair
获取转换的非对称密钥KeyPair,异步 @param pubKey 公钥字符串 @param priKey 私钥字符串 @param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8) @param algName 待生成对称密钥生成器的算法名称(SM2_256、SM2) @returns
static async getConvertKeyPair(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null, priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding, algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> { return CryptoUtil.getConvertKeyPair(algName, pubKey, priK...
AST#method_declaration#Left static async getConvertKeyPair AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryp...
static async getConvertKeyPair(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null, priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding, algName: string = 'SM2_256'): Promise<cryptoFramework.KeyPair> { return CryptoUtil.getConvertKeyPair(algName, pubKey, priK...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L108-L112
fe49e62611073af0e3058405c0ffebf44279b7ef
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
更新任务状态 @param taskId 任务ID @param status 新状态 @returns 更新后的任务
export function updateTaskStatus(taskId: number, status: number): Promise<Task> { try { return request<Task>(RequestMethod.PUT, `/tasks/${taskId}/status/${status}`); } catch (error) { console.error(`更新任务状态失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`更新任务状态失败: ${error...
AST#export_declaration#Left export AST#function_declaration#Left function updateTaskStatus AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left status : AST#type_annotation#Le...
export function updateTaskStatus(taskId: number, status: number): Promise<Task> { try { return request<Task>(RequestMethod.PUT, `/tasks/${taskId}/status/${status}`); } catch (error) { console.error(`更新任务状态失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`更新任务状态失败: ${error...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L447-L454
bc8631dc2059059812e2d720787704f162cc4459
github
openharmony-sig/knowledge_demo_smart_home
6cdf5d81ef84217f386c4200bfc4124a0ded5a0d
FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets
arkts
initDevices
获取个人设备列表
async initDevices() { if (this.userId != '') { let devices = await DistScheduleService.getDeviceListByUserId(this.userId) for (let device of devices) { let categoryId = await StorageService.getDeviceCategory(device.typeId) switch (categoryId) { case DeviceType.CARRY: ...
AST#method_declaration#Left async initDevices AST#parameter_list#Left ( ) AST#parameter_list#Right AST#ERROR#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . userId AST#membe...
async initDevices() { if (this.userId != '') { let devices = await DistScheduleService.getDeviceListByUserId(this.userId) for (let device of devices) { let categoryId = await StorageService.getDeviceCategory(device.typeId) switch (categoryId) { case DeviceType.CARRY: ...
https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/default/common/components/homeTabs.ets#L110-L125
e7a3bb00e80823c56d66500758ed738fd458c044
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Notification/CustomEmitter/feature/emitter/index.ets
arkts
CustomEmitter
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { CustomEmitter } from './src/main/ets/components/feature/CustomEmitter'
AST#export_declaration#Left export { CustomEmitter } from './src/main/ets/components/feature/CustomEmitter' AST#export_declaration#Right
export { CustomEmitter } from './src/main/ets/components/feature/CustomEmitter'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Notification/CustomEmitter/feature/emitter/index.ets#L16-L16
7f3f7696c20f3e8e3ba622024497dd13e645a688
gitee