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
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
创建社区帖子 @param post 帖子信息 @returns 创建的帖子信息
export function createPost(post: Post): Promise<Post> { // 创建请求数据对象 const requestData: RequestData = {}; // 设置基本字段 requestData.title = post.title || ''; requestData.content = post.content || ''; requestData.images = post.images; requestData.status = 1; // 1表示正常状态 requestData.likeCount = 0; requestD...
AST#export_declaration#Left export AST#function_declaration#Left function createPost AST#parameter_list#Left ( AST#parameter#Left post : AST#type_annotation#Left AST#primary_type#Left Post AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#prim...
export function createPost(post: Post): Promise<Post> { const requestData: RequestData = {}; requestData.title = post.title || ''; requestData.content = post.content || ''; requestData.images = post.images; requestData.status = 1; requestData.likeCount = 0; requestData.commentCount = 0; reques...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1022-L1049
963a9f8c3520409e6ace6b0bc64ee9027dc43645
github
hqj201013136012/HarmonyMiliUiPro.git
0625e681e07b771998a0ac4430824627d0eb60ed
entry/src/main/ets/utils/speech/AudioCapturerHelper.ets
arkts
录音工具类
export class AudioCapturerHelper{ private static audioCapturer: audio.AudioCapturer | undefined = undefined; private static file: fs.File | undefined = undefined; /** * 开始录音 * @returns */ static async startRecord(): Promise<string> { let filePath = Helper.getCacheDirPath('audio', `audio_${Helper...
AST#export_declaration#Left export AST#class_declaration#Left class AudioCapturerHelper AST#class_body#Left { AST#property_declaration#Left private static audioCapturer : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left audio . AudioCapturer AST#qualified_type#Right AST#primary...
export class AudioCapturerHelper{ private static audioCapturer: audio.AudioCapturer | undefined = undefined; private static file: fs.File | undefined = undefined; static async startRecord(): Promise<string> { let filePath = Helper.getCacheDirPath('audio', `audio_${Helper.getTodayStr('yyyyMMddHHmmssfff')...
https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/utils/speech/AudioCapturerHelper.ets#L10-L154
0ba6c47fb073c9ecb78506f7ca31f0813f86b850
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/index.ets
arkts
应用约束:24. 对象字面量不能用于类型声明,改用接口或类
export default { // "Root" classes (starting points) Client, Shard, ShardClientUtil, ShardingManager, WebhookClient, // Utilities Collection, Constants, DiscordAPIError, EvaluatedPermissions: EvaluatedPermissions, Permissions, Snowflake, SnowflakeUtil, Util: Util, util: Util, version,...
AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { // "Root" classes (starting points) AST#property_assignment#Left Client AST#property_assignment#Right , AST#property_assignment#Left Shard AST#property_assignment#Right , AST#property_assignment#Left ShardClientUtil AST#property_as...
export default { Client, Shard, ShardClientUtil, ShardingManager, WebhookClient, Collection, Constants, DiscordAPIError, EvaluatedPermissions: EvaluatedPermissions, Permissions, Snowflake, SnowflakeUtil, Util: Util, util: Util, version, escapeMarkdown: Util.escapeMarkdown, f...
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/index.ets#L55-L118
9fa8233f1a5330c56e041eda225d975a7273048b
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets
arkts
genGcmParamsSpec
Obtaining parameters required for GCM encryption and decryption. @returns Parameters required for encryption and decryption.
async genGcmParamsSpec(): Promise<cryptoFramework.GcmParamsSpec> { let ivBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_IV_DATA); let aadBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_AAD_DATA); let tagBlob: cryptoFramework.DataBlob = this.genKeyMa...
AST#method_declaration#Left async genGcmParamsSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . GcmParamsSpec AST#qual...
async genGcmParamsSpec(): Promise<cryptoFramework.GcmParamsSpec> { let ivBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_IV_DATA); let aadBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_AAD_DATA); let tagBlob: cryptoFramework.DataBlob = this.genKeyMa...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets#L66-L77
ccfe07a22a9b3c8867cff1e7434e08035888c42d
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
更新祝福语参数接口
export interface UpdateGreetingParams { id: string; content?: string; style?: GreetingStyle; occasion?: GreetingOccasion; language?: GreetingLanguage; tags?: string[]; isCustom?: boolean; rating?: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface UpdateGreetingParams AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left content ? : AST#type_annot...
export interface UpdateGreetingParams { id: string; content?: string; style?: GreetingStyle; occasion?: GreetingOccasion; language?: GreetingLanguage; tags?: string[]; isCustom?: boolean; rating?: number; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L215-L224
bd2d7be7c1fbb2661b765aed7d2362d417d13855
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/components/ChangelogContent.ets
arkts
ChangelogContent
changelog组件 @since 2022-06-06
@Component export struct ChangelogContent { @State private changelogInfoList: Array<ChangelogInfo> = null; private isCurrentPage: boolean; isNeedFold: boolean; @Prop @Watch('parseChangelog') description: string; @State private isParseChangelogFinished: boolean = false; @Builder buildChangelog() { Colum...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChangelogContent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right private changelogInfoList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ...
@Component export struct ChangelogContent { @State private changelogInfoList: Array<ChangelogInfo> = null; private isCurrentPage: boolean; isNeedFold: boolean; @Prop @Watch('parseChangelog') description: string; @State private isParseChangelogFinished: boolean = false; @Builder buildChangelog() { Colum...
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/components/ChangelogContent.ets#L33-L182
1cd8db068c1a2e5f2a750896f297d4278fd74cdb
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/entry/src/main/ets/pages/mine/settingPage.ets
arkts
quitLoginBuilder
退出
@Builder quitLoginBuilder() { Row() { Text("退出登录") .fontColor('#ff0000') .textAlign(TextAlign.Center) .fontSize(22) } .width('100%') .height(50) .margin({ top: 20 }) .justifyContent(FlexAlign.Center) .backgroundColor('#ffff') .onClick(() => { router....
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right quitLoginBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_el...
@Builder quitLoginBuilder() { Row() { Text("退出登录") .fontColor('#ff0000') .textAlign(TextAlign.Center) .fontSize(22) } .width('100%') .height(50) .margin({ top: 20 }) .justifyContent(FlexAlign.Center) .backgroundColor('#ffff') .onClick(() => { router....
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/mine/settingPage.ets#L209-L226
01354c3d3f2f68b21988f6bf257e0e0b611ae62a
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Bundle/Model/DMPBundleAppConfigNext.ets
arkts
app-config.json
export class DMPBundleAppConfigNext { data: object; app: object; modules: object; pages: string[] | null; style: string; sitemapLocation: string; subPackages: SubPackageConfig[]; _entryPagePath: string; moduleMaps: Map<string, ModuleConfig> constructor
AST#export_declaration#Left export AST#ERROR#Left class DMPBundleAppConfigNext { AST#property_declaration#Left data : AST#type_annotation#Left AST#primary_type#Left object AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left app : AST#type_annotation#Left AST#p...
export class DMPBundleAppConfigNext { data: object; app: object; modules: object; pages: string[] | null; style: string; sitemapLocation: string; subPackages: SubPackageConfig[]; _entryPagePath: string; moduleMaps: Map<string, ModuleConfig> constructor
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Bundle/Model/DMPBundleAppConfigNext.ets#L4-L15
d50ebbf453c3d47f6cffe840fd30c011f0a259ca
github
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_module_ui/ace_ets_module_theme/ace_ets_module_theme_api12/entry/src/main/ets/constants/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants { static readonly EVENT_ID_CHANGE_DATA = 101 }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly EVENT_ID_CHANGE_DATA = AST#expression#Left 101 AST#expression#Right AST#property_declaration#Right } AST#class_body#Right AST#class_declaration#Right AST#export_declaration#...
export class Constants { static readonly EVENT_ID_CHANGE_DATA = 101 }
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_ui/ace_ets_module_theme/ace_ets_module_theme_api12/entry/src/main/ets/constants/Constants.ets#L16-L18
cca8c521f3e9b0a4c0d5801ed1ca41f2c95a4d5a
gitee
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/http/HttpRequestDownload/entry/src/main/ets/pages/Index.ets
arkts
saveFile
保存文件并返回保存路径
saveFile(buf: ArrayBuffer, fileName: string): string { let pathDir = getContext(this).filesDir; let filePath = pathDir + "/" + fileName; let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); fs.writeSync(file.fd, buf); this.msgHistory += "文件已保存到:" + filePath + "\r\n" fs....
AST#method_declaration#Left saveFile AST#parameter_list#Left ( AST#parameter#Left buf : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#R...
saveFile(buf: ArrayBuffer, fileName: string): string { let pathDir = getContext(this).filesDir; let filePath = pathDir + "/" + fileName; let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); fs.writeSync(file.fd, buf); this.msgHistory += "文件已保存到:" + filePath + "\r\n" fs....
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/http/HttpRequestDownload/entry/src/main/ets/pages/Index.ets#L173-L181
270c32f84469bed3ea06f22af874f9f3df95c9c6
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
导出一个名为 CommonConstants 的类,用于存储记账应用中的常量信息
export default class CommonConstants { /** * Rdb 数据库配置。 */ static readonly STORE_CONFIG: relationalStore.StoreConfig = { name: 'database.db', securityLevel: relationalStore.SecurityLevel.S1 }; /** * 账户表配置。 */ static readonly ACCOUNT_TABLE: AccountTable = { tableName: 'accountTable', ...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * Rdb 数据库配置。 */ AST#property_declaration#Left static readonly STORE_CONFIG : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . StoreConfig AST#qualified_type...
export default class CommonConstants { static readonly STORE_CONFIG: relationalStore.StoreConfig = { name: 'database.db', securityLevel: relationalStore.SecurityLevel.S1 }; static readonly ACCOUNT_TABLE: AccountTable = { tableName: 'accountTable', sqlCreate: 'CREATE TABLE IF NOT EXISTS acco...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/constants/CommonConstants.ets#L8-L83
455961152e7f4a547b93dd48778a93174cc88e77
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/StrUtil.ets
arkts
startsWith
判断字符串是否以给定的字符串开头 @param string 要检索的字符串 @param target 要检索字符 @param position 检索的位置 @returns
static startsWith(string: string = '', target: string, position: number = 0): boolean { return string.startsWith(target, position); }
AST#method_declaration#Left static startsWith AST#parameter_list#Left ( AST#parameter#Left string : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left target : AST#type_annotation#L...
static startsWith(string: string = '', target: string, position: number = 0): boolean { return string.startsWith(target, position); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L153-L155
b7f1b4da6b06009f52c2604756d3dc0d1d004fdd
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
debugPrint
打印当前导航栈(调试用)
debugPrint() { console.log('[NavPathManager] Stack:', JSON.stringify(this._navPath)) }
AST#method_declaration#Left debugPrint AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST#member_express...
debugPrint() { console.log('[NavPathManager] Stack:', JSON.stringify(this._navPath)) }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L80-L82
aeb19cb7563179232cc9cfbb75326d669ad72a7e
github
mhtcgr/ToDoList_For_Harmony.git
356d4c9a507205f02870e970203022a380c8a2a1
entry/src/main/ets/model/model.ets
arkts
saveTodos
保存当前 ToDoData 数组到 Preferences
async saveTodos() { try { await preference.put(CommonConstants.KEY_NAME, JSON.stringify(this.ToDoData)); await preference.flush(); // 将数据写入存储 Logger.info(`tododata have ${this.ToDoData.length} todos.Save succesfully.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to save t...
AST#method_declaration#Left async saveTodos AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#membe...
async saveTodos() { try { await preference.put(CommonConstants.KEY_NAME, JSON.stringify(this.ToDoData)); await preference.flush(); Logger.info(`tododata have ${this.ToDoData.length} todos.Save succesfully.`); } catch (err) { Logger.error(CommonConstants.TAG, `Failed to save todos, Caus...
https://github.com/mhtcgr/ToDoList_For_Harmony.git/blob/356d4c9a507205f02870e970203022a380c8a2a1/entry/src/main/ets/model/model.ets#L41-L49
c60f9f2a9afa0b9b6c488fba8a7beb17a6d3c3d5
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/multiplefilesdownload/Index.ets
arkts
MultipleFilesDownloadComponent
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { MultipleFilesDownloadComponent } from './src/main/ets/view/MultipleFilesDownload';
AST#export_declaration#Left export { MultipleFilesDownloadComponent } from './src/main/ets/view/MultipleFilesDownload' ; AST#export_declaration#Right
export { MultipleFilesDownloadComponent } from './src/main/ets/view/MultipleFilesDownload';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multiplefilesdownload/Index.ets#L15-L15
06880ceb2eff4cac7f6b44632adb0b8fa069b133
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/llm/LLMService.ets
arkts
聊天请求接口
export interface ChatRequest { messages: ChatMessage[]; temperature?: number; maxTokens?: number; stream?: boolean; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ChatRequest AST#object_type#Left { AST#type_member#Left messages : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ChatMessage [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; ...
export interface ChatRequest { messages: ChatMessage[]; temperature?: number; maxTokens?: number; stream?: boolean; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/llm/LLMService.ets#L37-L42
fa1ca66acd4bb4cec0cc1bfe9b9d0900ad2ab6c5
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/groupgesture/Parallel.ets
arkts
Parallel
[Start parallel_recognition_gesture]
@Entry @Component export struct Parallel { @State count1: number = 0; @State count2: number = 0; build() { NavDestination() { Column({ space: 12 }) { Text($r('app.string.groupgesture_Parallel_text')) .fontSize(14) .fontColor('#666') Column() { Text('Paralle...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct Parallel AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right count1 : AST#type_annotation#Left AST#primary_type#Left nu...
@Entry @Component export struct Parallel { @State count1: number = 0; @State count2: number = 0; build() { NavDestination() { Column({ space: 12 }) { Text($r('app.string.groupgesture_Parallel_text')) .fontSize(14) .fontColor('#666') Column() { Text('Paralle...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/groupgesture/Parallel.ets#L17-L56
3becb6ac7ce6f3a4d25fcb331ab8e560677a7d55
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets
arkts
convertPemPriKeyFromStr
将非对称加密pem格式字符串priKey转换为symKey对象 @param privateKey字符串key-pem格式 @param symAlgName 秘钥规格 @returns
static convertPemPriKeyFromStr(privateKey: string, symAlgName: string) { let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertPemKeySync(null, privateKey); return symKey; }
AST#method_declaration#Left static convertPemPriKeyFromStr AST#parameter_list#Left ( AST#parameter#Left privateKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left...
static convertPemPriKeyFromStr(privateKey: string, symAlgName: string) { let aesGenerator = crypto.createAsyKeyGenerator(symAlgName); let symKey = aesGenerator.convertPemKeySync(null, privateKey); return symKey; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L78-L82
36fb47f87d5a61463edcdb705d0593dcc44cffad
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/notification/NotificationService.ets
arkts
playNotificationSound
播放通知声音
private async playNotificationSound(): Promise<void> { try { if (!this.settings.soundEnabled) { return; } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Playing notification sound: ${this.settings.selectedRingtone}`); // 简化的声音播放实现 promptActio...
AST#method_declaration#Left private async playNotificationSound AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Rig...
private async playNotificationSound(): Promise<void> { try { if (!this.settings.soundEnabled) { return; } hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationService] Playing notification sound: ${this.settings.selectedRingtone}`); promptAction.showToast(...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L453-L470
781a54d828d21796ff525d5dc767e67750febf49
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HDRVivid/AVCodecVideo/entry/src/main/ets/common/utils/CameraCheck.ets
arkts
[Start create_video_output2]
export function videoProfileCheck(cameraManager: camera.CameraManager, cameraData: CameraDataModel): undefined | camera.VideoProfile { let cameraDevices = cameraManager.getSupportedCameras(); // [StartExclude create_video_output2] if (cameraDevices !== undefined && cameraDevices.length <= 0) { Logger.error(...
AST#export_declaration#Left export AST#function_declaration#Left function videoProfileCheck AST#parameter_list#Left ( AST#parameter#Left cameraManager : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left camera . CameraManager AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right...
export function videoProfileCheck(cameraManager: camera.CameraManager, cameraData: CameraDataModel): undefined | camera.VideoProfile { let cameraDevices = cameraManager.getSupportedCameras(); if (cameraDevices !== undefined && cameraDevices.length <= 0) { Logger.error(TAG, 'cameraManager.getSupportedCamera...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HDRVivid/AVCodecVideo/entry/src/main/ets/common/utils/CameraCheck.ets#L70-L135
85e5a8a9bb3168d70a2e29121d3bae58cd8d9ce1
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets
arkts
文本选择器弹窗代理
export class TextPickerBuilderProxy extends BasePickerBuilderProxy<ITextPickerOptions, TextPickerDialog> { create(options: ITextPickerOptions) { return new TextPickerDialog(options); } /** * 选择数据集合 * @param range * @returns */ range(range: string[] | string[][] | TextPickerRangeContent[] | Text...
AST#export_declaration#Left export AST#class_declaration#Left class TextPickerBuilderProxy extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasePickerBuilderProxy AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ITextPickerOptions AST#primary_type#Right AST#type_annot...
export class TextPickerBuilderProxy extends BasePickerBuilderProxy<ITextPickerOptions, TextPickerDialog> { create(options: ITextPickerOptions) { return new TextPickerDialog(options); } range(range: string[] | string[][] | TextPickerRangeContent[] | TextCascadePickerRangeContent[]) { this.builderOption...
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/TextPickerBuilderProxy.ets#L9-L68
f430575fceeaa88ff46636d4de2eb5548e978a17
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleOfflineManager.ets
arkts
同步状态枚举
export enum SyncStatus { SYNCED = 'synced', PENDING = 'pending', SYNCING = 'syncing', FAILED = 'failed' }
AST#export_declaration#Left export AST#enum_declaration#Left enum SyncStatus AST#enum_body#Left { AST#enum_member#Left SYNCED = AST#expression#Left 'synced' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left PENDING = AST#expression#Left 'pending' AST#expression#Right AST#enum_member#Right , AST#enum_mem...
export enum SyncStatus { SYNCED = 'synced', PENDING = 'pending', SYNCING = 'syncing', FAILED = 'failed' }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L13-L18
c6573324e846117e1ce993aba746f1d619ce6441
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
get
获取选中商品的总价 @returns {number} 总价(单位:分)
get totalAmount(): number { let total = 0; for (const cart of this.cartList) { for (const spec of cart.spec) { const key = `${cart.goodsId}_${spec.id}`; if (this.selectedSpecIds.has(key)) { total += spec.price * spec.count; } } } return total; }
AST#method_declaration#Left get AST#ERROR#Left totalAmount AST#ERROR#Right 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#variable_declaration#Left let AST#var...
get totalAmount(): number { let total = 0; for (const cart of this.cartList) { for (const spec of cart.spec) { const key = `${cart.goodsId}_${spec.id}`; if (this.selectedSpecIds.has(key)) { total += spec.price * spec.count; } } } return total; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L54-L65
fac0c919c4488d0f56be659808fe55b08e83c352
github
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
uploadAvatar
上传头像
static async uploadAvatar(userId: string, fileUri: string): Promise<ResponseDao<AvatarResponse>> { try { const formData = new FormData(); // 添加用户ID formData.append("userId", userId +''); // 添加图片文件 const file: UploadFileItem = { filename: `avatar_${Date.now()}.png`, t...
AST#method_declaration#Left static async uploadAvatar AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileUri : AST#type_annotation#Left AST#primary_type#Left string AST#...
static async uploadAvatar(userId: string, fileUri: string): Promise<ResponseDao<AvatarResponse>> { try { const formData = new FormData(); formData.append("userId", userId +''); const file: UploadFileItem = { filename: `avatar_${Date.now()}.png`, type: 'image/png', ...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L375-L404
6aa8df434249fa9302cfc1b0a7aa699523d4d63e
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/cross_file/cross_file_001_T/cross_file_001_T_b.ets
arkts
Introduction export/import
export function cross_file_001_T_b (taint_src : string) { let t = cross_file_001_T_a(taint_src); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function cross_file_001_T_b AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#...
export function cross_file_001_T_b (taint_src : string) { let t = cross_file_001_T_a(taint_src); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/cross_file/cross_file_001_T/cross_file_001_T_b.ets#L7-L10
d2669531bde0f806c47df899856285f571c45c9e
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/pages/TVIndex.ets
arkts
RegisterDeviceListCallback
发现设备列表
function RegisterDeviceListCallback() { remoteDeviceModel.registerDeviceListCallback(() => { let discoveredDeviceSize = remoteDeviceModel.discoverList.length; let deviceSize = remoteDeviceModel.deviceList.length; localDeviceId = remoteDeviceModel.localDeviceId; discoveredDeviceIdList.length = 0; ...
AST#function_declaration#Left function RegisterDeviceListCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left remoteDeviceM...
function RegisterDeviceListCallback() { remoteDeviceModel.registerDeviceListCallback(() => { let discoveredDeviceSize = remoteDeviceModel.discoverList.length; let deviceSize = remoteDeviceModel.deviceList.length; localDeviceId = remoteDeviceModel.localDeviceId; discoveredDeviceIdList.length = 0; ...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/pages/TVIndex.ets#L34-L61
e733298fd96a22a3e23532e901e23b190aefa6f0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoShow/VideoComponent/src/main/ets/components/pages/SmallVideo.ets
arkts
SmallVideo
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...
@Component export struct SmallVideo { @State smallVideoSrc: Resource = $r('app.media.videos') @Link @Watch("onChanged") isHidden: boolean @Link isCancel: boolean @Consume('playTime') updateTime: number smallVideoController: VideoController = new VideoController() onChanged(): void { if (this.isHidden) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SmallVideo AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right smallVideoSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type...
@Component export struct SmallVideo { @State smallVideoSrc: Resource = $r('app.media.videos') @Link @Watch("onChanged") isHidden: boolean @Link isCancel: boolean @Consume('playTime') updateTime: number smallVideoController: VideoController = new VideoController() onChanged(): void { if (this.isHidden) ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoShow/VideoComponent/src/main/ets/components/pages/SmallVideo.ets#L16-L33
15066c9fc8fba5db7c371b54af26a96d467ce1b5
gitee
XiangRui_FuZi/harmony-oscourse
da885f9a777a1eace7a07e1cd81137746687974b
class1/entry/src/main/ets/view/ChatData.ets
arkts
Information of chat.
export const chatList: Array<Chat> = [ { sender: 'myself', message: 'Hi,How can I help you?' }, { sender: 'others', message: 'Hey' }, { sender: 'others', message: 'I am interested in your products' }, { sender: 'myself', message: 'That is great!' }, { sender: 'mysel...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left chatList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Chat AST#primary_type#Right AST#type_annotation#Right > AST#t...
export const chatList: Array<Chat> = [ { sender: 'myself', message: 'Hi,How can I help you?' }, { sender: 'others', message: 'Hey' }, { sender: 'others', message: 'I am interested in your products' }, { sender: 'myself', message: 'That is great!' }, { sender: 'mysel...
https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/ChatData.ets#L27-L52
67890b3e3266eea141bf056fe80d20fcce49c968
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/watermark/src/main/ets/view/MainView.ets
arkts
addWaterMark
添加水印
addWaterMark() { CONTEXT.resourceManager.getMediaContent(this.source.id, (error, value) => { if (error) { return; } const imageSource: image.ImageSource = image.createImageSource(value.buffer); imageSource.getImageInfo((err, data) => { if (err) { return; } ...
AST#method_declaration#Left addWaterMark AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left CONT...
addWaterMark() { CONTEXT.resourceManager.getMediaContent(this.source.id, (error, value) => { if (error) { return; } const imageSource: image.ImageSource = image.createImageSource(value.buffer); imageSource.getImageInfo((err, data) => { if (err) { return; } ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/watermark/src/main/ets/view/MainView.ets#L104-L152
09427469fba6b8c29945b66f8fb778723c2fa037
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/constants/Constants.ets
arkts
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class Constants{ static readonly HOME: string = '首页'; static readonly FILM: string = '风景'; static readonly TELEPLAY: string = '商品'; static readonly ANIMATION: string = '旅游'; static readonly SPORT: string = '头像'; }
AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly HOME : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '首页' AST#expression#Right ; AST#property_d...
export class Constants{ static readonly HOME: string = '首页'; static readonly FILM: string = '风景'; static readonly TELEPLAY: string = '商品'; static readonly ANIMATION: string = '旅游'; static readonly SPORT: string = '头像'; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/perfermance/customreusablepool/src/main/ets/constants/Constants.ets#L16-L22
207e1acad16df364daea3f944e87ddf8fc526d3a
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/image/NetWorkImage.ets
arkts
构建网络图片组件 @returns {void} 无返回值
build(): void { Stack() { if (this.showBackground) { Column() .width(P100) .height(P100) .backgroundColor(this.backgroundColorValue) .borderRadius(this.cornerRadius ?? 0); } if (this.model) { if ( (this.widthValue ?? this.sizeValue...
AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#ui_if_s...
build(): void { Stack() { if (this.showBackground) { Column() .width(P100) .height(P100) .backgroundColor(this.backgroundColorValue) .borderRadius(this.cornerRadius ?? 0); } if (this.model) { if ( (this.widthValue ?? this.sizeValue...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/NetWorkImage.ets#L54-L94
2766dc30cc8de411bc856804a3318345829c14f6
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/common/MyHttpUtils.ets
arkts
getMyCollectData
获取收藏数据
async getMyCollectData(userId:number) { // 根据当前用户id 查询用户收藏的所有诗词数据 必传参数是userId let res = await http.createHttp().request(Constants.myCollectApi, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: { userId: userId } }) ...
AST#method_declaration#Left async getMyCollectData AST#parameter_list#Left ( AST#parameter#Left userId : 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#block_statement#Left { // 根据当前用户id 查询用户收藏的所有诗词数据 必传参数是userId ...
async getMyCollectData(userId:number) { let res = await http.createHttp().request(Constants.myCollectApi, { method: http.RequestMethod.POST, header: { 'Content-Type': 'application/json' }, extraData: { userId: userId } }) return JSON.parse(`${res.result}`) ...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/common/MyHttpUtils.ets#L8-L20
67f0a2a68f1ac53a45cd6f8fa83ee6873c42430a
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets
arkts
getHdrVideoBol
HDR录像持久化,再次进入,确定开关是否开启
getHdrVideoBol(bol: boolean): void { let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig; cameraConfig.hdrVideoBol = bol; GlobalContext.get().setObject('cameraConfig', cameraConfig); }
AST#method_declaration#Left getHdrVideoBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Righ...
getHdrVideoBol(bol: boolean): void { let cameraConfig: CameraConfig = GlobalContext.get().getObject('cameraConfig') as CameraConfig; cameraConfig.hdrVideoBol = bol; GlobalContext.get().setObject('cameraConfig', cameraConfig); }
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/Dialog/SettingDialog.ets#L73-L77
ee21d06ad25cd2fda0dece5d8b80874b7d2f59cf
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/array/SectionDatas.ets
arkts
invalidateCache
每个分组开始的 index(方便做 indexOfAll) ========== 内部工具 ==========
private invalidateCache(): void { this.cachedAllDatas = null; this.cachedSectionStarts = null; }
AST#method_declaration#Left private invalidateCache 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#Lef...
private invalidateCache(): void { this.cachedAllDatas = null; this.cachedSectionStarts = null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/SectionDatas.ets#L12-L15
67b55d336958af36e1a2f633e18c9f06bb516ddb
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets
arkts
getSize
返回缓存文件大小
getSize(): number { return this.size; }
AST#method_declaration#Left getSize 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_expression#Left ...
getSize(): number { return this.size; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/src/main/ets/diskLruCache/DiskCacheEntry.ets#L56-L58
6a66c326c0caa6a454e46f017231d60758e0bcfa
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BaseMsg.ets
arkts
用户信息
export class UserInfo { userId: number; userImage: Resource; userName: string; address: string; userType: string; constructor(userId: number, userImage: Resource, userName: string, address: string, userType: string) { this.userId = userId; this.userImage = userImage; this.userName = userName; ...
AST#export_declaration#Left export AST#class_declaration#Left class UserInfo AST#class_body#Left { AST#property_declaration#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left userImage : AST#...
export class UserInfo { userId: number; userImage: Resource; userName: string; address: string; userType: string; constructor(userId: number, userImage: Resource, userName: string, address: string, userType: string) { this.userId = userId; this.userImage = userImage; this.userName = userName; ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/model/BaseMsg.ets#L17-L31
498fe12a71bee9b88d2c3cbc6e2c0e217503c882
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/Index.ets
arkts
getWeekArray
获取星期数组
private getWeekArray(): number[] { return [0, 1, 2, 3, 4, 5]; }
AST#method_declaration#Left private getWeekArray AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#return_statement#L...
private getWeekArray(): number[] { return [0, 1, 2, 3, 4, 5]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L4180-L4182
4c2897127f4888fd5bab738918e594e373847749
github
AlbertZyc/tab-layout
4ba256eead3792c84128f8679b26ac159a2d7f06
entry/src/main/ets/BasicDataSource.ets
arkts
notifyDataChange
通知LazyForEach组件在index对应索引处数据有变化,需要重建该子组件
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }) }
AST#method_declaration#Left notifyDataChange 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 void AST#primary_type#R...
notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }) }
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L52-L56
d955be0279a70195a8fd74a56f7528f4a1e9f593
gitee
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/view_models/ArtistDetailModel.ets
arkts
@param artistId @returns
export function fetchArtistMv(artistId: number): Promise<ArtistMvModel[]> { let queryParams = { 'id': artistId }; return new Promise(async (resolve, reject) => { try { const result = await httpRequestGet('/artist/mv', { queryParams }); if (result['code'] === 200) { let mvs: ArtistMvModel[] =...
AST#export_declaration#Left export AST#function_declaration#Left function fetchArtistMv AST#parameter_list#Left ( AST#parameter#Left artistId : 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...
export function fetchArtistMv(artistId: number): Promise<ArtistMvModel[]> { let queryParams = { 'id': artistId }; return new Promise(async (resolve, reject) => { try { const result = await httpRequestGet('/artist/mv', { queryParams }); if (result['code'] === 200) { let mvs: ArtistMvModel[] =...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/ArtistDetailModel.ets#L141-L162
c1fbe8303efa235a182d02eb3766ec6da4a5c2a3
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
get_all_time_stamps
Gets a list of all tabs' timestamps. @returns A number[] array, the timestamps.
get_all_time_stamps() { let stamps: number[] = []; for (let index = 0; index < this.Tabs.length; index++) { stamps.push(this.Labels[index].timestamp); } return stamps; }
AST#method_declaration#Left get_all_time_stamps AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left stamps : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AS...
get_all_time_stamps() { let stamps: number[] = []; for (let index = 0; index < this.Tabs.length; index++) { stamps.push(this.Labels[index].timestamp); } return stamps; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L571-L578
b90f9c88da0b547821fd0ac21a721cf570c1a894
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
processImage
处理图片
async processImage(imagePath: string, options: ImageProcessOptions): Promise<string> { if (!this.imagePackerApi) { throw new Error('图片处理器未初始化'); } try { // 读取原图 const imageSource = image.createImageSource(imagePath); const imageInfo = await imageSource.getImageInfo(); // 创建像素...
AST#method_declaration#Left async processImage AST#parameter_list#Left ( AST#parameter#Left imagePath : 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 ImageProcessOpt...
async processImage(imagePath: string, options: ImageProcessOptions): Promise<string> { if (!this.imagePackerApi) { throw new Error('图片处理器未初始化'); } try { const imageSource = image.createImageSource(imagePath); const imageInfo = await imageSource.getImageInfo(); const d...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L246-L307
b4e27faaefb403d98deaa3f800f9b4e0d593f8cb
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM4.ets
arkts
encryptGCMSegmentSync
加密(GCM模式)分段,同步 @param dataBlob 加密或者解密的数据。dataBlob不能为null。 @param key 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|GCM|PKCS7、SM4_128|GCM|PKCS5、等) @param len 自定义的数据拆分长度。 @returns
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'SM4_128|GCM|PKCS7', len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cry...
AST#method_declaration#Left static encryptGCMSegmentSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter...
static encryptGCMSegmentSync(dataBlob: cryptoFramework.DataBlob, key: cryptoFramework.Key, gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'SM4_128|GCM|PKCS7', len: number = 128): cryptoFramework.DataBlob { let cipher = cryptoFramework.createCipher(transformation); cipher.initSync(cry...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L298-L316
cf893e86cfa9f431869b9c090c34ffbb9763b06d
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/HeartRate.ets
arkts
tooHigh
心率过高
tooHigh(): boolean { return this.heartRate > HEART_RATE_TOO_HIGH; }
AST#method_declaration#Left tooHigh AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left...
tooHigh(): boolean { return this.heartRate > HEART_RATE_TOO_HIGH; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/HeartRate.ets#L74-L76
b8b70c4ad681fbfb74108b70165a82b89dcb8304
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
get
==================== 联系人相关操作 ==================== 获取联系人DAO
get contacts(): ContactDAO { this.checkInitialization(); return this.contactDAO; }
AST#method_declaration#Left get AST#ERROR#Left contacts AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ContactDAO AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expres...
get contacts(): ContactDAO { this.checkInitialization(); return this.contactDAO; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L82-L85
c2d4ca3fd04870926d6c9cbce5412a2f6491fb1d
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/FootprintRepository.ets
arkts
getFootprintByGoodsId
根据商品ID获取足迹记录 @param {number} goodsId 商品ID @returns {Promise<Footprint | undefined>} 匹配到的足迹
getFootprintByGoodsId(goodsId: number): Promise<Footprint | undefined> { return this.dataSource.getFootprintByGoodsId(goodsId); }
AST#method_declaration#Left getFootprintByGoodsId AST#parameter_list#Left ( AST#parameter#Left goodsId : 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 AST#generic_type...
getFootprintByGoodsId(goodsId: number): Promise<Footprint | undefined> { return this.dataSource.getFootprintByGoodsId(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/FootprintRepository.ets#L78-L80
9a1c30f1fd6692fac7783c4fc115fa7c5c6e9f97
github
yycy134679/FoodieHarmony.git
e6971f0a8f7574ae278d02eb5c057e57e667dab5
entry/src/main/ets/view/favorites/index.ets
arkts
FavoriteTabContent
收藏模块导出文件
export { FavoriteTabContent } from './FavoriteTabContent';
AST#export_declaration#Left export { FavoriteTabContent } from './FavoriteTabContent' ; AST#export_declaration#Right
export { FavoriteTabContent } from './FavoriteTabContent';
https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/favorites/index.ets#L5-L5
ae887a75109d46676dbb9ae4737f8dc6ea9f061c
github
zeroone001/harmonyAPP.git
49c8fa1b56de89cb7513b25f3b1b753ba857968a
commons/utils/Index.ets
arkts
Speaker
export { MainPage } from './src/main/ets/components/MainPage'
export { Speaker } from './src/main/ets/utils/Speaker';
AST#export_declaration#Left export { Speaker } from './src/main/ets/utils/Speaker' ; AST#export_declaration#Right
export { Speaker } from './src/main/ets/utils/Speaker';
https://github.com/zeroone001/harmonyAPP.git/blob/49c8fa1b56de89cb7513b25f3b1b753ba857968a/commons/utils/Index.ets#L2-L2
35dcc93e12a14ecdc014efb407c5671b417aa1ce
github
anhao0226/harmony-music-player.git
4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073
entry/src/main/ets/view_models/ArtistDetailModel.ets
arkts
@param artistId @returns
export function fetchArtistAlbums(artistId: number): Promise<ArtistAlbumModel[]> { let queryParams = { 'id': artistId }; return new Promise(async (resolve, reject) => { try { const result = await httpRequestGet('/artist/album', { queryParams }); if (result['code'] === 200) { let hotAlbums: A...
AST#export_declaration#Left export AST#function_declaration#Left function fetchArtistAlbums AST#parameter_list#Left ( AST#parameter#Left artistId : 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#...
export function fetchArtistAlbums(artistId: number): Promise<ArtistAlbumModel[]> { let queryParams = { 'id': artistId }; return new Promise(async (resolve, reject) => { try { const result = await httpRequestGet('/artist/album', { queryParams }); if (result['code'] === 200) { let hotAlbums: A...
https://github.com/anhao0226/harmony-music-player.git/blob/4bc1d8f9f5fdb573af387d3ba9ad333c9beb8073/entry/src/main/ets/view_models/ArtistDetailModel.ets#L113-L134
f3614c219397fe5efdd267df4f9b50fb52c0b8a7
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
d2i
ASN.1格式的字符串转换成C1C3C2格式的字符 @param standard_data ASN.1格式的字符 @returns C1C3C2格式的字符
d2i(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.error('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message...
AST#method_declaration#Left d2i AST#parameter_list#Left ( AST#parameter#Left standard_data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ...
d2i(standard_data: string): string { let message: string = standard_data; if (!message.startsWith(ASN1Util.SEQUENCE)) { Logger.error('转换SM2字符串出错'); } message = message.slice(ASN1Util.SEQUENCE.length, message.length); let sequence_lexHex: string = this.getLenHex(message); message = message...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L105-L127
d34c2752072f0a1a983cd9c454c42e338dd238d7
gitee
Hyricane/Interview_Success.git
9783273fe05fc8951b99bf32d3887c605268db8f
entry/src/main/ets/commons/utils/History.ets
arkts
clear
清除首选项 持久化的数据
clear() { this.getStore().clearSync() // 清空 this.getStore().flushSync() // 永久保存 }
AST#method_declaration#Left clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_ex...
clear() { this.getStore().clearSync() this.getStore().flushSync() }
https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/History.ets#L43-L46
4f44da2bf1887670cb9ac3bca339e69fef825e1d
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets
arkts
drawPointer
绘制时针、分针、秒针
private drawPointer(degree: number, pointerImgRes: string) { this.renderContext.save(); let theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE; this.renderContext.rotate(theta); this.renderContext.beginPath(); let secondImg = new ImageBitmap(po...
AST#method_declaration#Left private drawPointer AST#parameter_list#Left ( AST#parameter#Left degree : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pointerImgRes : AST#type_annotation#Left AST#primary_type#Left string AST#...
private drawPointer(degree: number, pointerImgRes: string) { this.renderContext.save(); let theta = (degree + MainConstant.DEFAULT_HORIZONTAL_ANGLE) * Math.PI / MainConstant.DEFAULT_HORIZONTAL_ANGLE; this.renderContext.rotate(theta); this.renderContext.beginPath(); let secondImg = new ImageBitmap(po...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/view/Main/ClockArea.ets#L103-L117
1b1c065cbc5b04e2508c3f5b50133258bc0b7d0f
gitee
TianQvQ/WeChat_ArkTs.git
077ddcdb8e8032f71f45540461fbd66f2d49c973
entry/src/main/ets/pages/Find/FriendCircle.ets
arkts
NewMessage
中间栏消息提示
@Builder NewMessage(image:Resource, word:string){ Row(){ //图片 Image(image) .width(40) .height(40) //文本 Text(word) .fontColor(Color.White) .padding({left:8,right:8}) .height(25) .fontSize(15) .textAlign(TextAlign.Center) .backgro...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NewMessage AST#parameter_list#Left ( AST#parameter#Left image : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left word : AST#type_annotation#Left A...
@Builder NewMessage(image:Resource, word:string){ Row(){ Image(image) .width(40) .height(40) Text(word) .fontColor(Color.White) .padding({left:8,right:8}) .height(25) .fontSize(15) .textAlign(TextAlign.Center) .backgroundColor...
https://github.com/TianQvQ/WeChat_ArkTs.git/blob/077ddcdb8e8032f71f45540461fbd66f2d49c973/entry/src/main/ets/pages/Find/FriendCircle.ets#L51-L68
3ab84bebd830081f6f627411cae114306532bb28
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderRefundPage.ets
arkts
RefundInfoCard
退款信息卡片 @param {Order} order - 订单数据 @returns {void} 无返回值
@Builder private RefundInfoCard(order: Order): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ hasBorder: true, titleBuilder: (): void => this.RefundInfoTitle() }); ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private RefundInfoCard AST#parameter_list#Left ( AST#parameter#Left order : AST#type_annotation#Left AST#primary_type#Left Order AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotat...
@Builder private RefundInfoCard(order: Order): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ hasBorder: true, titleBuilder: (): void => this.RefundInfoTitle() }); ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L126-L154
b27bb20563549ebe9da89299bf057c2f9754e59b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/component/TextInputDialogView.ets
arkts
getDisplayWidth
获取设备的屏幕宽度,单位为VP。 @returns
private getDisplayWidth(): number { return px2vp(display.getDefaultDisplaySync().width); }
AST#method_declaration#Left private getDisplayWidth 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#call_ex...
private getDisplayWidth(): number { return px2vp(display.getDefaultDisplaySync().width); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/component/TextInputDialogView.ets#L173-L175
dde962ccad0e80fea289e9e3e8239ec319ece410
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets
arkts
默认图片url
export const DEFAULT_IMG_URL: string = 'https://gitee.com/harmonyos-cases/cases/raw/master/CommonAppDevelopment/feature/imageenableanalyzer/src/main/resources/base/media/imageenableanalyzer_cat2.JPG';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DEFAULT_IMG_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'https://gitee.com/harmonyos-cases/cases/raw/master/CommonAppDevelopment/feat...
export const DEFAULT_IMG_URL: string = 'https://gitee.com/harmonyos-cases/cases/raw/master/CommonAppDevelopment/feature/imageenableanalyzer/src/main/resources/base/media/imageenableanalyzer_cat2.JPG';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagetheft/src/main/ets/constants/Constants.ets#L17-L17
fab452f9b98b1bbb27a55e9867a7557de86a3afd
gitee
gouhaoshuang/arkts-booking-software.git
e0254dae0c4cfd3d43c4e3970528d97136fcc69b
demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
isEmpty
Check obj is empty @param {object} obj @return {boolean} true(empty)
isEmpty(obj: object | string): boolean { return obj === undefined || obj === null || obj === ''; }
AST#method_declaration#Left isEmpty AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left object AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
isEmpty(obj: object | string): boolean { return obj === undefined || obj === null || obj === ''; }
https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets#L113-L115
b282ee2c054870f434b255a4e7c2718b3beb5020
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/model/MessagesData.ets
arkts
聊天界面(ChatPage.ets)中的List列表对应的数据源实现类(负责聊天消息数据的UI显示)。 注意:本类中的数据来源为全局消息缓存管理类 MessageProvider 中缓存消息集合的对象引用(浅拷贝),相当于共用同一个缓存,无需单 独维护数据,实现了聊天消息数据的管理(MessageProvider负责)和UI界面显示(MessagesDataSource负责)的解偶。 @author JackJang @since 1.0
export default class MessagesData extends BasicDataSource<Message> { /** 从接口里拿到数据*/ private messages: Array<Message> =new Array(); notifyDataReload(): void { super.notifyDataReload(); } totalCount(): number { return this.messages.length } getData(index: number): Message { return this.mess...
AST#export_declaration#Left export default AST#class_declaration#Left class MessagesData extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left BasicDataSource AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Message AST#primary_type#Right AST#type_annotation#Right > AST#ty...
export default class MessagesData extends BasicDataSource<Message> { private messages: Array<Message> =new Array(); notifyDataReload(): void { super.notifyDataReload(); } totalCount(): number { return this.messages.length } getData(index: number): Message { return this.messages[index] ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/model/MessagesData.ets#L13-L42
dd35e6f68ab1c5d331b5e234d9bd1d69e0517d82
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/SHA.ets
arkts
digestSHA384
SHA384摘要 @param str 带摘要的字符串 @returns 摘要后的字符串
static async digestSHA384(str: string): Promise<string> { return CryptoUtil.digest(str, 'SHA384'); }
AST#method_declaration#Left static async digestSHA384 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_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
static async digestSHA384(str: string): Promise<string> { return CryptoUtil.digest(str, 'SHA384'); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SHA.ets#L59-L61
78bb6cf73591ee70c710f41bf89da155fc98a204
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.arkui.advanced.TreeView.d.ets
arkts
Declare NodeParam @typedef NodeParam @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare NodeParam @typedef NodeParam @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
export interface NodeParam { /** * Set the parentNodeId. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Set the parentNodeId. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice * @since 11 */...
AST#export_declaration#Left export AST#interface_declaration#Left interface NodeParam AST#object_type#Left { /** * Set the parentNodeId. * @type { number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * Set the parentNodeId. * @type { number } * @syscap SystemCa...
export interface NodeParam { parentNodeId?: number, currentNodeId?: number, isFolder?: boolean; icon?: ResourceStr; symbolIconStyle?: SymbolGlyphModifier; selectedIcon?: ResourceStr; symbolSelectedIconStyle?: SymbolGlyphModifi...
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.TreeView.d.ets#L324-L486
2f7ab7526affd380036289160e4faf920ada3653
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/FileUtility.ets
arkts
copyFileWithProgress
文件拷贝(支持进度回调) @param sourcePath 源文件路径 @param targetPath 目标路径 @param bufferSize 缓冲区大小 @param onProgress 进度回调(0-100)
private static async copyFileWithProgress( sourcePath: string, targetPath: string, bufferSize: number, onProgress?: (percent: number) => void ): Promise<void> { const readStream = fs.createStreamSync(sourcePath, 'r'); const writeStream = fs.createStreamSync(targetPath, 'w+'); const fileSiz...
AST#method_declaration#Left private static async copyFileWithProgress AST#parameter_list#Left ( AST#parameter#Left sourcePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetPath : AST#type_annotation#Left AST#primar...
private static async copyFileWithProgress( sourcePath: string, targetPath: string, bufferSize: number, onProgress?: (percent: number) => void ): Promise<void> { const readStream = fs.createStreamSync(sourcePath, 'r'); const writeStream = fs.createStreamSync(targetPath, 'w+'); const fileSiz...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/FileUtility.ets#L124-L153
ff0cbd86427cbb1c661a213396d4a98f1592f54f
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
systemShareChange
监听是否进行系统分享
@Monitor('appTmpData.isSystemShare') systemShareChange() { if (this.appTmpData.isSystemShare) { this.isShowSidebar = false; this.isToolViewShow = false; this.pageInfos.pop(); } }
AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'appTmpData.isSystemShare' AST#expression#Right ) AST#decorator#Right systemShareChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expressi...
@Monitor('appTmpData.isSystemShare') systemShareChange() { if (this.appTmpData.isSystemShare) { this.isShowSidebar = false; this.isToolViewShow = false; this.pageInfos.pop(); } }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L228-L235
40f4f637efc8073851c505e61e1911d8f77e0c8e
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/expandtitle/src/main/ets/model/TitleAttribute.ets
arkts
标题属性
export class TitleAttribute { // 标题内容 private textTmp: string | Resource; // 标题样式 private attributeTmp: AttributeModifier<TextAttribute>; constructor(text: string | Resource, attribute: AttributeModifier<TextAttribute>) { this.textTmp = text; this.attributeTmp = attribute; } get text(): string |...
AST#export_declaration#Left export AST#class_declaration#Left class TitleAttribute AST#class_body#Left { // 标题内容 AST#property_declaration#Left private textTmp : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#un...
export class TitleAttribute { private textTmp: string | Resource; private attributeTmp: AttributeModifier<TextAttribute>; constructor(text: string | Resource, attribute: AttributeModifier<TextAttribute>) { this.textTmp = text; this.attributeTmp = attribute; } get text(): string | Resource{ ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/expandtitle/src/main/ets/model/TitleAttribute.ets#L20-L38
76c0f712084d4bfa963bada1f41fda515abcdcba
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets
arkts
The layout options for the container when the foldable screen is expanded. @interface ExpandedRegionLayoutOptions @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export interface ExpandedRegionLayoutOptions { /** * The ratio of the widths of two areas in the horizontal direction. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ horizontalSplitRatio?: number; /** * The ratio of th...
AST#export_declaration#Left export AST#interface_declaration#Left interface ExpandedRegionLayoutOptions AST#object_type#Left { /** * The ratio of the widths of two areas in the horizontal direction. * * @type { ?number } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice ...
export interface ExpandedRegionLayoutOptions { horizontalSplitRatio?: number; verticalSplitRatio?: number; isExtraRegionPerpendicular?: boolean; extraRegionPosition?: ExtraRegionPosition; }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L75-L119
be6a0c4e2cc3a7b610a496b4cde6b3ab69e78952
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/CommonTypes.ets
arkts
触觉反馈类型枚举
export enum HapticFeedbackType { LIGHT = 'light', MEDIUM = 'medium', HEAVY = 'heavy', SUCCESS = 'success', WARNING = 'warning', ERROR = 'error' }
AST#export_declaration#Left export AST#enum_declaration#Left enum HapticFeedbackType AST#enum_body#Left { AST#enum_member#Left LIGHT = AST#expression#Left 'light' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left MEDIUM = AST#expression#Left 'medium' AST#expression#Right AST#enum_member#Right , AST#enum...
export enum HapticFeedbackType { LIGHT = 'light', MEDIUM = 'medium', HEAVY = 'heavy', SUCCESS = 'success', WARNING = 'warning', ERROR = 'error' }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L243-L250
751608d0622c9c9960ad286b5969f777c47db92c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/FileUtil.ets
arkts
getBufferByURI
从给定的uri中获取文件二进制流 @param uri 如picker返回的uri @returns 文件的ArrayBuffer
static getBufferByURI(uri: string): ArrayBuffer { //创建文件信息 let fileUriObject = new fileUri.FileUri(uri); //获取文件名 let name = fileUriObject.name; //打开文件 let file = fs.openSync(uri, fs.OpenMode.READ_ONLY); //读取文件大小 let info = fs.statSync(file.fd); //缓存照片数据 let bufferImg: ArrayBuffer...
AST#method_declaration#Left static getBufferByURI AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#prim...
static getBufferByURI(uri: string): ArrayBuffer { let fileUriObject = new fileUri.FileUri(uri); let name = fileUriObject.name; let file = fs.openSync(uri, fs.OpenMode.READ_ONLY); let info = fs.statSync(file.fd); let bufferImg: ArrayBuffer = new ArrayBuffer(info.size); ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/FileUtil.ets#L254-L271
eba313437ec1db4cc7c90a51ad91807497a2ad7e
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
监听通知传入的want @param want @param launchParam
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { NotificationUtil.readOrRemoveNotice(want); }
AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abi...
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { NotificationUtil.readOrRemoveNotice(want); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/entry/src/main/ets/entryability/EntryAbility.ets#L56-L58
3584ff1df0ce1b36d8b4e3c101c4bb37f48e39b9
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/src/main/ets/JhCommon/components/JhToast.ets
arkts
showTextLong
/ 文字长弹框
public static showTextLong(loadingText: ResourceStr) { JhToast._showToast(loadingText, _ToastType.TextLong) }
AST#method_declaration#Left public static showTextLong 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_sta...
public static showTextLong(loadingText: ResourceStr) { JhToast._showToast(loadingText, _ToastType.TextLong) }
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhToast.ets#L44-L46
465fbb73cced6d27b82b3cdf0152368568224ecf
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/EventTrack/Tags.ets
arkts
包管理日志TAG集合
export class Tags { //---------包管理模块-------- //包管理根日志 static BUNDLE = "[bundle]" //加载本地包日志 static LOAD_LOCAL_BUNDLE = Tags.BUNDLE + "[loadLocal]" //加载远程包日志 static LOAD_REMOTE_BUNDLE = Tags.BUNDLE + "[loadRemote]" //加载gift包日志 static LOAD_GIFT_BUNDLE = Tags.BUNDLE + "[loadGift]" //加载debugUrl包日志 sta...
AST#export_declaration#Left export AST#class_declaration#Left class Tags AST#class_body#Left { //---------包管理模块-------- //包管理根日志 AST#property_declaration#Left static BUNDLE = AST#expression#Left "[bundle]" AST#expression#Right //加载本地包日志 AST#property_declaration#Right AST#property_declaration#Left static LOAD_LOCAL_BUN...
export class Tags { static BUNDLE = "[bundle]" static LOAD_LOCAL_BUNDLE = Tags.BUNDLE + "[loadLocal]" static LOAD_REMOTE_BUNDLE = Tags.BUNDLE + "[loadRemote]" static LOAD_GIFT_BUNDLE = Tags.BUNDLE + "[loadGift]" static LOAD_DEBUG_BUNDLE = Tags.BUNDLE + "[loadDebug]" static LOAD_CACHE_C...
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/EventTrack/Tags.ets#L2-L64
8d278921a87cfadf8ada3a4def7dfe5dc991227b
github
gracienewd/openharmony-App-YunmoAi.git
181952ab00aab5025a81b7b3a6b88d2a5258c76a
entry/src/main/ets/common/net/RequestUtils.ets
arkts
传输参数token
export const TOKEN_KEY: string = 'token' //请求网络的基底址
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TOKEN_KEY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'token' AST#expression#Right AST#variable_declarator#Right //请求网络的基底址 AST#variable...
export const TOKEN_KEY: string = 'token'
https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/common/net/RequestUtils.ets#L4-L5
ad62a4a567849e621ccac8ce1e9d5cdaeb383e29
github
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alicon/2.0.0/package/index.ets
arkts
base64Encode
实现Base64编码(替换Buffer)
function base64Encode(str: string): string { const encoder = new TextEncoder(); const bytes = encoder.encode(str); let binary = ''; bytes.forEach((b) => binary += String.fromCharCode(b)); return btoa(binary); }
AST#function_declaration#Left function base64Encode 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_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary...
function base64Encode(str: string): string { const encoder = new TextEncoder(); const bytes = encoder.encode(str); let binary = ''; bytes.forEach((b) => binary += String.fromCharCode(b)); return btoa(binary); }
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alicon/2.0.0/package/index.ets#L24-L30
7bda8da991b98cc34c9e4a87b0f4e2c53b300c97
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderRefundPage.ets
arkts
构建订单退款页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.order_refund"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(); ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.order_re...
build() { AppNavDestination({ title: $r("app.string.order_refund"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(); ...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderRefundPage.ets#L42-L54
232e3a6463a7a8fd1733ed54cd3bbfd1618efacf
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets
arkts
getNewsData
Get data
getNewsData(context: common.UIAbilityContext): Array<NewsData> { // Get data from a local file let value: Uint8Array | null = null; try { value = context?.resourceManager.getRawFileContentSync(this.jsonFileDir); } catch (error) { let err = error as BusinessError; hilog.warn(0x000, 'tes...
AST#method_declaration#Left getNewsData AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#t...
getNewsData(context: common.UIAbilityContext): Array<NewsData> { let value: Uint8Array | null = null; try { value = context?.resourceManager.getRawFileContentSync(this.jsonFileDir); } catch (error) { let err = error as BusinessError; hilog.warn(0x000, 'testTag', `setColorMode failed, ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets#L345-L369
54ebcf55d87664b1aa94e58cc742a377c16fb6fb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/calendar/CalendarApiService.ets
arkts
calculateLunarLocally
本地农历计算(基于已知的重要日期)
private calculateLunarLocally(date: Date): LunarDate { const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); // 2025年的重要农历日期对照表(基于天文台数据) const lunarDates2025: Record<string, LunarDateKnown> = { '2025-01-29': { year: 2025, month: 1, day: 1, monthText: ...
AST#method_declaration#Left private calculateLunarLocally AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left LunarDate AST...
private calculateLunarLocally(date: Date): LunarDate { const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); const lunarDates2025: Record<string, LunarDateKnown> = { '2025-01-29': { year: 2025, month: 1, day: 1, monthText: '正月', dayText: '初一' }, ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/CalendarApiService.ets#L289-L369
0463fa2c24cb30504516bcd38976aa711b21d6d8
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/constants/DrmConstants.ets
arkts
KeySession 回调事件
export enum KeySessionEvents { KEY_REQUIRED = 'keyRequired', KEY_EXPIRED = 'keyExpired', VENDOR_DEFINED = 'vendorDefined', EXPIRATION_UPDATE = 'expirationUpdate', KEYS_CHANGED = 'keysChange', }
AST#export_declaration#Left export AST#enum_declaration#Left enum KeySessionEvents AST#enum_body#Left { AST#enum_member#Left KEY_REQUIRED = AST#expression#Left 'keyRequired' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left KEY_EXPIRED = AST#expression#Left 'keyExpired' AST#expression#Right AST#enum_mem...
export enum KeySessionEvents { KEY_REQUIRED = 'keyRequired', KEY_EXPIRED = 'keyExpired', VENDOR_DEFINED = 'vendorDefined', EXPIRATION_UPDATE = 'expirationUpdate', KEYS_CHANGED = 'keysChange', }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/common/constants/DrmConstants.ets#L33-L39
16fc4560bdfcb156f6653aaf7e445d3f59060ab3
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CartRepository.ets
arkts
removeFromCart
从购物车删除商品 @param {number} goodsId 商品ID @returns {Promise<void>} Promise<void>
removeFromCart(goodsId: number): Promise<void> { return this.dataSource.removeFromCart(goodsId); }
AST#method_declaration#Left removeFromCart AST#parameter_list#Left ( AST#parameter#Left goodsId : 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 AST#generic_type#Left P...
removeFromCart(goodsId: number): Promise<void> { return this.dataSource.removeFromCart(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CartRepository.ets#L56-L58
d63e52699272a3e0413a68594ddac5f681f6cef6
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
init
初始化上下文 @param context - UIAbility上下文 类似SwiftUI中的EnvironmentObject或Kotlin中的Context注入
static init(context: common.UIAbilityContext): void { ShareUtils.context = context; }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#t...
static init(context: common.UIAbilityContext): void { ShareUtils.context = context; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L38-L40
b8de6d7c48686a016a6e8acbf27a52582f468b54
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets
arkts
auto_backups_onClick
自动备份开关
auto_backups_onClick(isOn:boolean){ this.auto_backups_status=isOn }
AST#method_declaration#Left auto_backups_onClick AST#parameter_list#Left ( AST#parameter#Left isOn : 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#builder_function_body#Left { AST#expression_statement#Left AST#e...
auto_backups_onClick(isOn:boolean){ this.auto_backups_status=isOn }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets#L228-L230
0135db39eed34b5f76b0b2df2b89180bfa1c5a43
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Card/MovieCard/entry/src/main/ets/common/utils/GlobalContext.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.insta...
AST#export_declaration#Left export AST#class_declaration#Left class GlobalContext AST#class_body#Left { AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right AST#property_declarat...
export class GlobalContext { private constructor() { } private static instance: GlobalContext; private _objects = new Map<string, Object>(); public static getContext(): GlobalContext { if (!GlobalContext.instance) { GlobalContext.instance = new GlobalContext(); } return GlobalContext.insta...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/common/utils/GlobalContext.ets#L16-L37
7a8c6cd8dfeb02e68581203d2e888475ba5255a3
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/SearchHistoryRepository.ets
arkts
getSearchHistoryByKeyword
根据关键词获取搜索历史记录 @param {string} keyword 搜索关键词 @returns {Promise<SearchHistory | undefined>} 匹配到的搜索历史
getSearchHistoryByKeyword(keyword: string): Promise<SearchHistory | undefined> { return this.dataSource.getSearchHistoryByKeyword(keyword); }
AST#method_declaration#Left getSearchHistoryByKeyword 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_...
getSearchHistoryByKeyword(keyword: string): Promise<SearchHistory | undefined> { return this.dataSource.getSearchHistoryByKeyword(keyword); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/SearchHistoryRepository.ets#L88-L90
28f048571e68c994d82a22e4f33f75eaa2f9ea2c
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/media/MediaManager.ets
arkts
capturePhoto
拍照
async capturePhoto(): Promise<string> { if (!this.cameraManager) { throw new Error('相机管理器未初始化'); } try { // 获取相机列表 const cameras = this.cameraManager.getSupportedCameras(); if (cameras.length === 0) { throw new Error('没有可用的相机'); } // 使用第一个相机 const camera =...
AST#method_declaration#Left async capturePhoto 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 string AST#primary_type#Right AST#type_annotation#Right > AST#type_a...
async capturePhoto(): Promise<string> { if (!this.cameraManager) { throw new Error('相机管理器未初始化'); } try { const cameras = this.cameraManager.getSupportedCameras(); if (cameras.length === 0) { throw new Error('没有可用的相机'); } const camera = cameras[0]; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/media/MediaManager.ets#L182-L241
3cc02beeeb45af98d08d9e099559e6fd00a9f31d
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
unregisterNavStack
从ZRouter解注册路由栈,通常情况使用不上 @param stackName
public static unregisterNavStack(stackName: string) { ZRouter.getRouterMgr().unregisterNavStack(stackName) }
AST#method_declaration#Left public static unregisterNavStack AST#parameter_list#Left ( AST#parameter#Left stackName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stat...
public static unregisterNavStack(stackName: string) { ZRouter.getRouterMgr().unregisterNavStack(stackName) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L235-L237
c580c81724bdf2aa346f89428cee23e6a229b218
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets
arkts
removeItemFromDeskTop
remove item from desktop @param item
async removeItemFromDeskTop(item: GridLayoutItemInfo) { if (CheckEmptyUtils.isEmpty(item)) { return; } Logger.info(TAG, 'removeCardFromDeskTop start'); let pageInfos = this.layoutInfo; searchCircle:for (let i = 0;i < pageInfos.length; i++) { Logger.info(TAG, `removeCardFromDeskTop pageIn...
AST#method_declaration#Left async removeItemFromDeskTop AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left GridLayoutItemInfo AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#...
async removeItemFromDeskTop(item: GridLayoutItemInfo) { if (CheckEmptyUtils.isEmpty(item)) { return; } Logger.info(TAG, 'removeCardFromDeskTop start'); let pageInfos = this.layoutInfo; searchCircle:for (let i = 0;i < pageInfos.length; i++) { Logger.info(TAG, `removeCardFromDeskTop pageIn...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/desktop/src/main/ets/default/model/DesktopLayoutModel.ets#L462-L482
ddf1aedd0a892706760547bdc4cc36e36c44e5c0
gitee
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/demo/entry/src/main/ets/views/FocusAreaPage.ets
arkts
FocusAreaPage
对焦区域
@Component export struct FocusAreaPage { @Link focusPointBol: boolean; @Link focusPointVal: Array<number>; // 刻度、焦距值 和 对焦框不能共存的显示 @Link exposureBol: boolean; // 曝光值 @Link exposureNum: number; @Prop xComponentWidth: number; @Prop xComponentHeight: number; // 对焦区域显示框定时器 private areaTimer: number = -1;...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FocusAreaPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#typ...
@Component export struct FocusAreaPage { @Link focusPointBol: boolean; @Link focusPointVal: Array<number>; @Link exposureBol: boolean; @Link exposureNum: number; @Prop xComponentWidth: number; @Prop xComponentHeight: number; private areaTimer: number = -1; private panOption: PanGestureOption...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/demo/entry/src/main/ets/views/FocusAreaPage.ets#L22-L105
f2039639b89abbb146436a3647da9f818988b1c5
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets
arkts
SlideToHideAndDisplaceComponent
滑动页面改变顶部个人信息栏显示效果 效果:上滑页面,用户头像逐渐缩小并移动到返回文字的后方,原本展示的用户名/选择身份/设置/客服的文本和图标渐隐,顶部用户名文本渐显 下滑页面,用户头像逐渐放大并向下移动,顶部用户名文本渐隐,下方用户名/选择身份/设置/客服的文本和图标渐显
@Component export struct SlideToHideAndDisplaceComponent { // 用户头像图片后方个人信息相关组件(用户名/选择身份/满意度调查)的透明度 @State userRowOpacity: number = 1; // 返回文字后方的用户名的透明度(进入页面时处于隐藏状态) @State userNameOpacity: number = 0; // 用户头像图片高度 @State userImageHeight: number = 50; // Scroll组件顶部与上方Row组件(个人信息栏)的上边距 @State scrollMarginTo...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct SlideToHideAndDisplaceComponent AST#component_body#Left { // 用户头像图片后方个人信息相关组件(用户名/选择身份/满意度调查)的透明度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right userRowOpacity : AST#type_annotation#Left ...
@Component export struct SlideToHideAndDisplaceComponent { @State userRowOpacity: number = 1; @State userNameOpacity: number = 0; @State userImageHeight: number = 50; @State scrollMarginTop: number = 0; @State userImageMarginTop: number = 0; @State userImageMarginLeft: number = 0; ord...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/slidetohideanddisplace/src/main/ets/view/SlideToHideAndDisplace.ets#L39-L371
fb0289a65b76f2bc0de1d7317bd5925ff7dcc3f7
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets
arkts
calcImageDefaultSize
根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 @param imageWHRatio:图片原始宽高比 @param size:窗口大小{with:number,height:number} @returns image.Size
calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width: number = 0; let height: number = 0; if (imageWHRatio > windowSize.width / windowSize.height) { // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 width = windowSize.width; height = windowSize.width / imageWHRatio; ...
AST#method_declaration#Left calcImageDefaultSize AST#parameter_list#Left ( AST#parameter#Left imageWHRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left windowSize : AST#type_annotation#Left AST#primary_type#Left AST#qua...
calcImageDefaultSize(imageWHRatio: number, windowSize: window.Size): image.Size { let width: number = 0; let height: number = 0; if (imageWHRatio > windowSize.width / windowSize.height) { width = windowSize.width; height = windowSize.width / imageWHRatio; } else { height = windo...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ImageViewer/entry/src/main/ets/view/PicturePreviewImage.ets#L113-L125
a1da896d19d816f9ee1dabe26d0b9c8ae8c53365
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.base.d.ets
arkts
In ArkTS static typing, for literals where the hierarchy and the number of attributes per level are uncertain, you can use RecordData for initialization. @typedef RecordData @syscap SystemCapability.Base @since 20 @example import { RecordData } from '@kit.BasicServiceKit'; const param: RecordData = { "key": { "a": 1 } ...
export type RecordData = undefined | null | Object | Record<string, RecordData> | Array<RecordData>;
AST#export_declaration#Left export AST#type_declaration#Left type RecordData = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left Object AST#primary_type#Right | AST#primary_type#Left AST#generic...
export type RecordData = undefined | null | Object | Record<string, RecordData> | Array<RecordData>;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.base.d.ets#L199-L199
a075e1638107ad231dedf1d654a067989f913bbd
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/notification/NotificationUtil.ets
arkts
export
通知渠道管理
export namespace Channel { /** * 创建指定类型的通知渠道 * @param {notificationManager.SlotType} type 要创建的通知渠道的类型 * @returns {Promise<void>} void */ export async
AST#export_declaration#Left export AST#ERROR#Left namespace Channel AST#ERROR#Right { /** * 创建指定类型的通知渠道 * @param {notificationManager.SlotType} type 要创建的通知渠道的类型 * @returns {Promise<void>} void */ export as ync AST#export_declaration#Right
export namespace Channel { export async
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L367-L373
865b8f269c37317f17c8b4efe499ed86c5ed7f67
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/common/src/main/ets/navigation/AboutNav.ets
arkts
AboutNav
@file 关于我们页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function AboutNav(): void { AboutPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function AboutNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_compo...
@Builder export function AboutNav(): void { AboutPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/navigation/AboutNav.ets#L8-L11
448eb2cf9dc95e8c576c1e864f19eed9e75d6790
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/parentchildcomponentsync/parentchildpartialcontentsync/ParentChildPartialContentSyncCode.ets
arkts
ClassObject
数组中元素的类,使用@Observed修饰
@Observed export class ClassObject { public elementType: Resource; public attributeType: Resource | string; constructor(elementType: Resource, attributeType: Resource | string) { this.elementType = elementType; this.attributeType = attributeType; } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ClassObject AST#class_body#Left { AST#property_declaration#Left public elementType : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Ri...
@Observed export class ClassObject { public elementType: Resource; public attributeType: Resource | string; constructor(elementType: Resource, attributeType: Resource | string) { this.elementType = elementType; this.attributeType = attributeType; } }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkUI/StateManagement/entry/src/main/ets/pages/pagelevelstagemanagement/multicompomentssync/parentchildcomponentsync/parentchildpartialcontentsync/ParentChildPartialContentSyncCode.ets#L20-L29
ff4df8091aebd1e82c65ae83fa8ac0b656a416e2
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/TypeUtil.ets
arkts
isDate
检查是否为Date类型。 @param value @returns
static isDate(value: Object): boolean { return new util.types().isDate(value); }
AST#method_declaration#Left static isDate AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#R...
static isDate(value: Object): boolean { return new util.types().isDate(value); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/TypeUtil.ets#L135-L137
ca123cb36a0bc724c641801c00073fc43be06dc7
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets
arkts
如果想退出考试重新进入后将已做题回显,打开这个方法 aboutToAppear(): void { // 已经答过的题数据回显 if (this.isReDisplay) { for (let i = 0; i < this.item.options.length; i++) { if (this.item.selected.includes(this.item.options[i])) { this.selectIndexList.push(i) } if (this.item.answer.includes(this.item.options[i])) { this.ansIndexList.push(i); } } } }
build() { Scroll() { Column({ space: 12 }) { // 问题类型 this.questionType(); // 问题 this.question(); // 选项 this.option() if (this.showAnswer) { Column({ space: 12 }) { this.answer(); this.problemAnalysis(); this...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Scroll ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#component_...
build() { Scroll() { Column({ space: 12 }) { this.questionType(); this.question(); this.option() if (this.showAnswer) { Column({ space: 12 }) { this.answer(); this.problemAnalysis(); this.videoAnalysis();...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/components/exam/src/main/ets/components/SelectComponent.ets#L45-L69
c456fe0f07dd5d4bed8b77c3ccfb61aa425dda8f
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/ComponentFactory.ets
arkts
getContent
获取tab项内容 @param name - tab项标题 @returns: tab项内容
public getContent(name: string): WrappedBuilder<[ESObject]> | undefined { return this.tabsInfo.get(name)?.contentBuilder; }
AST#method_declaration#Left public getContent AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST...
public getContent(name: string): WrappedBuilder<[ESObject]> | undefined { return this.tabsInfo.get(name)?.contentBuilder; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CustomAnimationTab/customanimationtab/src/main/ets/model/ComponentFactory.ets#L50-L52
136fd30b8deece7b094083b8a70522d8d87c7742
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
HapAndHarDependHar/entry/oh_modules/har_library/src/main/ets/components/mainpage/MainPage.ets
arkts
MainPage
[End func_result]
@Component export struct MainPage { @State message: string = 'HAR MainPage' + funcResult; build() { Column() { Row() { Text(this.message) .fontSize(32) .fontWeight(FontWeight.Bold) } } } }
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio...
@Component export struct MainPage { @State message: string = 'HAR MainPage' + funcResult; build() { Column() { Row() { Text(this.message) .fontSize(32) .fontWeight(FontWeight.Bold) } } } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/HapAndHarDependHar/entry/oh_modules/har_library/src/main/ets/components/mainpage/MainPage.ets#L25-L37
389fdbbd7f3e03ff6f4b2a6b4ba0b9c674214a8d
gitee
kinghy949/kinghy_zufang.git
471cc1273fbea66b88a4b7803e3f08c83a2de7ce
entry/src/main/ets/constants/size.ets
arkts
圆角
export const BORDER_RADIUS_S = 4;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BORDER_RADIUS_S = AST#expression#Left 4 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const BORDER_RADIUS_S = 4;
https://github.com/kinghy949/kinghy_zufang.git/blob/471cc1273fbea66b88a4b7803e3f08c83a2de7ce/entry/src/main/ets/constants/size.ets#L7-L7
8b383001ea81a44a317dbc78c82dc1c80c9b73a1
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/controller/MapController.ets
arkts
panUpdate
Panning gestures. @param event Events when panning.
panUpdate(event: GestureEvent, callBack: Function): void { let panX = Number.parseInt(event.offsetX.toFixed(0)); let panY = Number.parseInt(event.offsetY.toFixed(0)); if ((this.panX !== panX) || (this.panY !== panY)) { let mapPanX = panX - this.panX; let mapPanY = panY - this.panY; callBac...
AST#method_declaration#Left panUpdate AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_...
panUpdate(event: GestureEvent, callBack: Function): void { let panX = Number.parseInt(event.offsetX.toFixed(0)); let panY = Number.parseInt(event.offsetY.toFixed(0)); if ((this.panX !== panX) || (this.panY !== panY)) { let mapPanX = panX - this.panX; let mapPanY = panY - this.panY; callBac...
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L98-L108
a93ba35fa5a0c86cb82ba7aeca8feeac3eeca0ef
github
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleOfflineManager.ets
arkts
getNetworkStatus
获取网络状态
getNetworkStatus(): NetworkStatus { return this.networkStatus; }
AST#method_declaration#Left getNetworkStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NetworkStatus 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_...
getNetworkStatus(): NetworkStatus { return this.networkStatus; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L91-L93
5733eceb7e950c1b31563a5850154296f71f198e
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
根据ID获取用户信息 @param userId 用户ID @returns 用户信息
export function getUserById(userId: number): Promise<UserInfo> { try { console.info(`获取用户信息, userId: ${userId}`); return request<UserInfo>(RequestMethod.GET, `/users/${userId}`); } catch (error) { console.error(`获取用户信息失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`...
AST#export_declaration#Left export AST#function_declaration#Left function getUserById AST#parameter_list#Left ( AST#parameter#Left userId : 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...
export function getUserById(userId: number): Promise<UserInfo> { try { console.info(`获取用户信息, userId: ${userId}`); return request<UserInfo>(RequestMethod.GET, `/users/${userId}`); } catch (error) { console.error(`获取用户信息失败: ${error instanceof Error ? error.message : String(error)}`); throw new Error(`...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L1503-L1511
5c317692ed2a186bb29eef3934170665f8690a54
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/blendmode/src/main/ets/view/BlendModeView.ets
arkts
pendantBuilder
自定义组件 @param item 挂件数据 @param index 下标
@Builder pendantBuilder(item: PendantType, index: number) { Column() { Column() { Image(item.pendantImage) .width($r('app.integer.blend_mode_image_size')) .height($r('app.integer.blend_mode_image_size')) .borderRadius($r('app.integer.blend_mode_image_border_radius')) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right pendantBuilder AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left PendantType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation...
@Builder pendantBuilder(item: PendantType, index: number) { Column() { Column() { Image(item.pendantImage) .width($r('app.integer.blend_mode_image_size')) .height($r('app.integer.blend_mode_image_size')) .borderRadius($r('app.integer.blend_mode_image_border_radius')) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/blendmode/src/main/ets/view/BlendModeView.ets#L82-L104
3f97d7de83c2d9329e62f4749b135c823ffb12e4
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
init
设置默认统一样式 @param configs 配置
static init(configs: (config: DialogConfig) => void): void { if (DialogHub.isInit) { // 后续有监听,这边要开启,如:多端适配监听屏幕变化xs、md、lg等 return } configs(DialogHub.config); DialogHub.isInit = true //TODO: 是否根据 xs md lg 各自保存一份DialogConfig,即:<'xs'|'md'|'lg', DialogConfig> }
AST#method_declaration#Left static init AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left DialogConfig AST#primary_type#Right AST#type_annotation#Right AST#parameter#...
static init(configs: (config: DialogConfig) => void): void { if (DialogHub.isInit) { return } configs(DialogHub.config); DialogHub.isInit = true }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L43-L51
9572982fe5f75a9def89bef8e38d6ea8e764b1a8
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
example/BasicUsage.ets
arkts
scale
============================================================ 硬解硬编(零配置) ============================================================ 视频缩放
scale(): void { const cmd = FFmpegFactory.scale('/input.mp4', '/720p.mp4', 1280, 720); this.run(cmd); }
AST#method_declaration#Left scale 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 cmd = AST#expressio...
scale(): void { const cmd = FFmpegFactory.scale('/input.mp4', '/720p.mp4', 1280, 720); this.run(cmd); }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L43-L46
90358523d2435e59b3d39a66c56b25e0bf622e16
github