nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
toLocaleString
Converts a number to a string by using the current or specified locale. @param { Intl.LocalesArgument } [locales] A string with a BCP 47 language tag, or an array of such strings. @param { BigIntToLocaleStringOptions } [options] An object with some or all of the properties of the Intl.NumberFormat options. @returns { s...
public toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string { const numFmtOptions = BigInt.toNumberFormatOptions(options) const formatter = new Intl.NumberFormat(Intl.intlLocalesToLanguageTags(locales), numFmtOptions) return formatter.format(this) ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#L...
public toLocaleString(locales?: Intl.LocalesArgument, options?: BigIntToLocaleStringOptions): string { const numFmtOptions = BigInt.toNumberFormatOptions(options) const formatter = new Intl.NumberFormat(Intl.intlLocalesToLanguageTags(locales), numFmtOptions) return formatter.format(this) ...
https://gitcode.com/iop123123/arkts-static-skills
ac75039ce93a842707884b2f644651b1569867b2
gitcode
openharmony/applications_mms
entry/src/main/ets/pages/transmitmsg/transmitMsgController.ets
arkts
queryAllMessages
Queries all list information.
queryAllMessages() { let actionData: LooseObject = {}; actionData.page = this.page; actionData.limit = this.limit; actionData.orderByTimeDesc = true; ConversationListService.getInstance().querySessionList(actionData, result => { if (result.code == common.int.SUCCE...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryAllMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
queryAllMessages() { let actionData: LooseObject = {}; actionData.page = this.page; actionData.limit = this.limit; actionData.orderByTimeDesc = true; ConversationListService.getInstance().querySessionList(actionData, result => { if (result.code == common.int.SUCCE...
https://gitee.com/openharmony/applications_mms.git
ab20ad328059a35dec2ffb63536ad18107847de5
gitee
wodekouwei/qlog
qloglib/src/main/ets/qlog/xlog/CommonUtils.ets
arkts
deleteFile
同步删除文件 @param path 待删除目录的绝对路径
public static deleteFile(path: string): string { try { if (CommonUtils.existFile(path)) { fileIo.unlinkSync(path); } } catch (err) { Logg.e(TAG, 'delete file is error') } finally { return path } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:...
public static deleteFile(path: string): string { try { if (CommonUtils.existFile(path)) { fileIo.unlinkSync(path); } } catch (err) { Logg.e(TAG, 'delete file is error') } finally { return path } }
https://gitcode.com/wodekouwei/qlog
59edac6fa09ede3d4494c4063d1a98d8f8340111
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
isIsoDate
Regular Expression to Check if a String is an ISO Date Format @param dateStr Date in string format @returns If the string is in ISO date format, return true; otherwise, return false.
private static isIsoDate(dateStr: String): boolean { return Date.isoDateRegExp.test(dateStr); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isIsoDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateStr AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
private static isIsoDate(dateStr: String): boolean { return Date.isoDateRegExp.test(dateStr); }
https://gitcode.com/iop123123/arkts-static-skills
2c8e5dea8d61f50f1070c7492942f3d45e0a812f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Float64Array. @param arr array to copy data from
public set(arr: double[]): void { this.set(arr, 0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: double[]): void { this.set(arr, 0) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1f3712e505a9c73142d5e42fe31d8c0772a2fa9d
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/19.multiplicative_expressions/01.multiplication_operator/integer_mul.ets
arkts
main
--- desc: Multiplication of integer numbers params: {{ni.x}} * {{ni.y}} == {{ni.result}} ---
function main(): void { assert {{ni.x}} * {{ni.y}} == {{ni.result}};
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#function_expression#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters...
function main(): void { assert {{ni.x}} * {{ni.y}} == {{ni.result}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2bf330c51fa6174263fc9c2832290afe4c1df723
gitee
chendi126/harmonyOS-TCP
entry/src/main/ets/common/GlassStyles.ets
arkts
getSecondaryTitleColor
获取次标题颜色
static getSecondaryTitleColor(): string { return '#34495E'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSecondaryTitleColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left str...
static getSecondaryTitleColor(): string { return '#34495E'; }
https://github.com/chendi126/harmonyOS-TCP
4865a292852f3066c6dca9128814cbab9f05096c
github
the-wwyang/kids-learning-app
src/main/ets/services/QuestionCacheService.ets
arkts
difficultyToScore
难度转分数
private difficultyToScore(difficulty: Difficulty): number { const scoreMap: Record<Difficulty, number> = { [Difficulty.EASY]: 1, [Difficulty.MEDIUM]: 2, [Difficulty.HARD]: 3 }; return scoreMap[difficulty]; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left difficultyToScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private difficultyToScore(difficulty: Difficulty): number { const scoreMap: Record<Difficulty, number> = { [Difficulty.EASY]: 1, [Difficulty.MEDIUM]: 2, [Difficulty.HARD]: 3 }; return scoreMap[difficulty]; }
https://github.com/the-wwyang/kids-learning-app
7c19f0e082daf6fbfb50c3b409fcf90bc4062061
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
toArray
Converts the LightWeightSet to an array @returns an array containing all values in the LightWeightSet
toArray(): Array<T> { const res: Array<T> = new Array<T>(); this.iteratorForEach<T>(this.values(), (value: T): void => res.push(value)); return res; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left toArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AS...
toArray(): Array<T> { const res: Array<T> = new Array<T>(); this.iteratorForEach<T>(this.values(), (value: T): void => res.push(value)); return res; }
https://gitcode.com/iop123123/arkts-static-skills
e669850c019ac631707b5331b616c1bbb8d4722d
gitcode
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/crypto/CryptoService.ets
arkts
parseEncryptedData
===== 内部工具 =====
private static parseEncryptedData(value: string): EncryptedData | null { try { const parsed = JSON.parse(value) as EncryptedData if (parsed.salt.length === 0 || parsed.iv.length === 0 || parsed.data.length === 0) { return null } return parsed } catch (_err) { return null ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseEncryptedData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#...
private static parseEncryptedData(value: string): EncryptedData | null { try { const parsed = JSON.parse(value) as EncryptedData if (parsed.salt.length === 0 || parsed.iv.length === 0 || parsed.data.length === 0) { return null } return parsed } catch (_err) { return null ...
https://github.com/encorexin/WordPressCMS
0308cb48da06cae4d1dbb0069b6ac7d27a4d9c8b
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
updateAllCategoryCovers
更新所有分类的封面
private async updateAllCategoryCovers(): Promise<void> { for (const category of this.bookshelfCategories) { await this.updateCategoryCoversAuto(category.id); } await this.refreshCategories(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left updateAllCategoryCovers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async updateAllCategoryCovers(): Promise<void> { for (const category of this.bookshelfCategories) { await this.updateCategoryCoversAuto(category.id); } await this.refreshCategories(); }
https://github.com/DaLongZhuaZi/manxia
763d2eda37f915149b9d70cf1d736aacdc701ad6
github
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets
arkts
Test001
===== 测试用例 ===== E2E_001: DrawableDescriptor release() -> isReleased() 返回 true
Test001() { const id = 'E2E_001' try { let drawable = this.CreateDrawableFromRes() if (!drawable) { this.Fail(id, '无法创建 DrawableDescriptor') return } // release 前应为 false let beforeRelease = drawable.isReleased() drawable.release() let afterRelease = d...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Test001 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#...
Test001() { const id = 'E2E_001' try { let drawable = this.CreateDrawableFromRes() if (!drawable) { this.Fail(id, '无法创建 DrawableDescriptor') return } // release 前应为 false let beforeRelease = drawable.isReleased() drawable.release() let afterRelease = d...
https://gitcode.com/openharmony/arkui_ace_engine
e379d0e8b24ba7c67dc3cb4c5c34cc34d4d589f5
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/RectF.ets
arkts
getCenterY
获取矩形中心点Y轴坐标 @returns Y坐标
public getCenterY(): number { this.check(this.left, this.top, this.right, this.bottom); return this.top + (this.bottom - this.top) / 2; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCenterY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numb...
public getCenterY(): number { this.check(this.left, this.top, this.right, this.bottom); return this.top + (this.bottom - this.top) / 2; }
https://github.com/wuba/omni-ui
039cae3076eba74437c830c669e7227885271386
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint32 with all elements. @returns a new Uint32Array with elements of current Uint32Array
public slice(): Uint32Array { return new Uint32Array(this) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public slice(): Uint32Array { return new Uint32Array(this) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
44ec07d61914cb136504e8f02417ce73c6f0c7ba
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
getAllSourceConfigs
获取所有图源的缓存配置 扫描永久缓存目录,返回所有有缓存的图源配置
async getAllSourceConfigs(): Promise<SourceCacheConfig[]> { const configs: SourceCacheConfig[] = []; try { if (!this.ensureCachePathsReady('getAllSourceConfigs')) { return configs; } if (!SafeFileUtils.accessSync(this.permanentCachePath)) { return configs; } ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllSourceConfigs AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
async getAllSourceConfigs(): Promise<SourceCacheConfig[]> { const configs: SourceCacheConfig[] = []; try { if (!this.ensureCachePathsReady('getAllSourceConfigs')) { return configs; } if (!SafeFileUtils.accessSync(this.permanentCachePath)) { return configs; } ...
https://github.com/DaLongZhuaZi/manxia
8d574dd7fdefb895e9c513906e434b6b45423166
github
2763981847/Clock-Alarm
entry/src/main/ets/view/BackContainer.ets
arkts
build
定义组件的渲染函数
build() { Row() { // 创建返回按钮 Button() { // 设置按钮的图像,如果未设置 backImgRes,则使用默认图像 "app.media.ic_public_back" Image(this.backImgRes == null ? $r('app.media.ic_public_back') : this.backImgRes).objectFit(ImageFit.Fill) } // 设置按钮的背景颜色为透明 .backgroundColor($r('app.color.trans_pare...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row() { // 创建返回按钮 Button() { // 设置按钮的图像,如果未设置 backImgRes,则使用默认图像 "app.media.ic_public_back" Image(this.backImgRes == null ? $r('app.media.ic_public_back') : this.backImgRes).objectFit(ImageFit.Fill) } // 设置按钮的背景颜色为透明 .backgroundColor($r('app.color.trans_pare...
https://github.com/2763981847/Clock-Alarm
b687f273ff5ff65faf6dee07f31cd597ec1d05c0
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
drawGridBackground
draws the grid background
protected drawGridBackground(c: CanvasRenderingContext2D): void { if (this.mDrawGridBackground) { if (this.mGridBackgroundPaint) { Utils.resetContext2DWithoutFont(c, this.mGridBackgroundPaint); } c.beginPath(); let rect = this.mViewPortHandler.getContentRect(); c.rect(rect.l...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawGridBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
protected drawGridBackground(c: CanvasRenderingContext2D): void { if (this.mDrawGridBackground) { if (this.mGridBackgroundPaint) { Utils.resetContext2DWithoutFont(c, this.mGridBackgroundPaint); } c.beginPath(); let rect = this.mViewPortHandler.getContentRect(); c.rect(rect.l...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
784d75b98fc7b92eda97426c10b6a9e1d5abb8a5
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/ModelCapabilityMatcher.ets
arkts
findEntry
按优先级查找匹配的模型条目
private findEntry(modelId: string): ModelsDevEntry | null { // 1. 精确匹配 const exact = this.cache.get(modelId) if (exact !== undefined) { return exact } // 2. 去供应商前缀:取最后一个 / 后的内容,兼容聚合商多层路径 // 如 deepseek-ai/deepseek-v3.2 → deepseek-v3.2 const slashIndex = modelId.lastIndexOf('/') ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left modelId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
private findEntry(modelId: string): ModelsDevEntry | null { // 1. 精确匹配 const exact = this.cache.get(modelId) if (exact !== undefined) { return exact } // 2. 去供应商前缀:取最后一个 / 后的内容,兼容聚合商多层路径 // 如 deepseek-ai/deepseek-v3.2 → deepseek-v3.2 const slashIndex = modelId.lastIndexOf('/') ...
https://github.com/LongLiveY96/chatcube
97ed77339ed30cb8883a46f884ce966dd2704ee8
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
setSystemBarsVisible
设置系统栏(状态栏 + 导航栏)可见性
private async setSystemBarsVisible(win: window.Window, visible: boolean): Promise<void> { try { await win.setSpecificSystemBarEnabled('status', visible); await win.setSpecificSystemBarEnabled('navigation', visible); if (!visible) { await win.setSpecificSystemBarEnabled('navigationIndicat...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setSystemBarsVisible AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#:#L...
private async setSystemBarsVisible(win: window.Window, visible: boolean): Promise<void> { try { await win.setSpecificSystemBarEnabled('status', visible); await win.setSpecificSystemBarEnabled('navigation', visible); if (!visible) { await win.setSpecificSystemBarEnabled('navigationIndicat...
https://github.com/AlkaidLab/moonlight-harmony
a6ad764d8c30ff1e3fd9361954f9d4738bd942d0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/NotificationManager.ets
arkts
sendTransferUploadCompleteNotification
发送局域网传书上传完成通知
public async sendTransferUploadCompleteNotification( taskId: string, fileName: string ): Promise<boolean> { const config: NotificationConfig = { id: this.getNotificationId(taskId), title: '传书文件已保存', text: fileName, additionalText: '文件已在设备上,可到收件箱继续导入', type: NotificationType...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left sendTransferUploadCompleteNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identi...
public async sendTransferUploadCompleteNotification( taskId: string, fileName: string ): Promise<boolean> { const config: NotificationConfig = { id: this.getNotificationId(taskId), title: '传书文件已保存', text: fileName, additionalText: '文件已在设备上,可到收件箱继续导入', type: NotificationType...
https://github.com/DaLongZhuaZi/manxia
3890afc182f344179867ed4a9211738739056322
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/AVSessionManager.ets
arkts
RegisterControlCommand
注册控制命令
RegisterControlCommand() { this.session?.on("play", () => { avPlayerManage.stopOrContinueSong() }) this.session?.on("pause", () => { avPlayerManage.stopOrContinueSong() }) this.session?.on("playNext", () => { avPlayerManage.nextSong() }) this.session?.on("playPrevious",...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left RegisterControlCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_b...
RegisterControlCommand() { this.session?.on("play", () => { avPlayerManage.stopOrContinueSong() }) this.session?.on("pause", () => { avPlayerManage.stopOrContinueSong() }) this.session?.on("playNext", () => { avPlayerManage.nextSong() }) this.session?.on("playPrevious",...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/AVSessionManager.ets#L76-L98
5a0f4a3151a12319eb2548953a4578d4a223e6ca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TabConfig.ets
arkts
parseFilterConfig
解析筛选配置
function parseFilterConfig(configDef: Record<string, Object>): FilterConfig | undefined { if (!configDef || typeof configDef !== 'object') { return undefined; } const groups: FilterGroup[] = []; const groupsDef = configDef['groups'] as Record<string, Object>[] | undefined; if (groupsDef && Array.isArr...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseFilterConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left configDef AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function parseFilterConfig(configDef: Record<string, Object>): FilterConfig | undefined { if (!configDef || typeof configDef !== 'object') { return undefined; } const groups: FilterGroup[] = []; const groupsDef = configDef['groups'] as Record<string, Object>[] | undefined; if (groupsDef && Array.isArr...
https://github.com/DaLongZhuaZi/manxia
c6e156b364ab5f5132f73151644b3214fc95dd9f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
sendVirtualControllerInput
发送虚拟手柄输入(供 CustomKeyManager 使用) 与直接调用 MoonBridge 不同,此方法会先确保 controllerArrival 已发送, 并使用正确的 activeGamepadMask。对应 Android ControllerHandler 的流程。
sendVirtualControllerInput( buttonFlags: number, leftTrigger: number, rightTrigger: number, leftStickX: number, leftStickY: number, rightStickX: number, rightStickY: number, ): void { if (!this.isRunning) return; const controllerIndex = 0; this.ensureVirtualControllerArrival(controllerIndex)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left sendVirtualControllerInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buttonFlags AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left nu...
sendVirtualControllerInput( buttonFlags: number, leftTrigger: number, rightTrigger: number, leftStickX: number, leftStickY: number, rightStickX: number, rightStickY: number, ): void { if (!this.isRunning) return; const controllerIndex = 0; this.ensureVirtualControllerArrival(controllerIndex)...
https://github.com/AlkaidLab/moonlight-harmony
6d84c38b2c37953ac41a1444cca17fd278826799
github
Gramony/Gramony
features/home/src/main/ets/utils/push.ets
arkts
unregisterPush
取消注册推送
async unregisterPush(nickname: string): Promise<string> { let token = generatePushEndpoint(nickname); try { const result = await nativeUnregisterPush(10, token); Logger.warn(`PushService unregisterPush: ` + JSON.stringify(result)); token = generatePushEndpoint(nickname, true); await n...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left unregisterPush AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nickname AST#identifier#Right AST#type_annotation#Left ...
async unregisterPush(nickname: string): Promise<string> { let token = generatePushEndpoint(nickname); try { const result = await nativeUnregisterPush(10, token); Logger.warn(`PushService unregisterPush: ` + JSON.stringify(result)); token = generatePushEndpoint(nickname, true); await n...
https://github.com/Gramony/Gramony
0049ea2f2639d1ca703965498bff1ae47a7e6620
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an BigInt64Array from FixedArray<int> @param { FixedArray<int> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: FixedArray<int>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, numbers[i].toLong()) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public constructor(numbers: FixedArray<int>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, numbers[i].toLong()) } }
https://gitcode.com/iop123123/arkts-static-skills
8c3fd0ab17331cf0163dbc17762549c5171528ec
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/MultiShopping/common/src/main/ets/utils/LocalDataManager.ets
arkts
updateOrder
Update order data. @param props: update props @returns Order[]
updateOrder(props: updateOrderProps) { const result: Order = this.orderData.filter(item => item.orderId === props.orderId)[0]; const newOrder: Order = { orderId: props.orderId, commodityId: result.commodityId, price: result.price, count: result.count, specifications: result.speci...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateOrder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left props AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left updateOrderProps AST#identif...
updateOrder(props: updateOrderProps) { const result: Order = this.orderData.filter(item => item.orderId === props.orderId)[0]; const newOrder: Order = { orderId: props.orderId, commodityId: result.commodityId, price: result.price, count: result.count, specifications: result.speci...
https://gitee.com/harmonyos/codelabs.git
9e2761a0633f774ff2ea3077dd35d154de841609
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/RomConfigManager.ets
arkts
getConfig
获取游戏配置,不存在则返回默认配置
public getConfig(romPath: string): RomConfig { return this.configCache.get(romPath) ?? defaultRomConfig(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left romPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right...
public getConfig(romPath: string): RomConfig { return this.configCache.get(romPath) ?? defaultRomConfig(); }
https://github.com/richshaw2015/nds
a1230e71975ebd386d042658f488bedba44d0bac
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets
arkts
searchRepositorySources
搜索仓库中的图源
async searchRepositorySources(keyword: string): Promise<SourceRepositoryEntry[]> { const allSources = await this.getRepositorySources(); const lowerKeyword = keyword.toLowerCase(); return allSources.filter(source => source.name.toLowerCase().includes(lowerKeyword) || source.pkg.toLowerCa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchRepositorySources AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left A...
async searchRepositorySources(keyword: string): Promise<SourceRepositoryEntry[]> { const allSources = await this.getRepositorySources(); const lowerKeyword = keyword.toLowerCase(); return allSources.filter(source => source.name.toLowerCase().includes(lowerKeyword) || source.pkg.toLowerCa...
https://github.com/DaLongZhuaZi/manxia
afeb0b345ebba0cc514e0fb810a4283f0e854844
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
find
Finds the first element in the Uint8ClampedArray that satisfies the condition @param fn the condition to apply for each element @returns the first element that satisfies fn TODO: return number | undefined as in JS
public find(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): number { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return val } } throw new Error("Uint8ClampedArray.find: not imple...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public find(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): number { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return val } } throw new Error("Uint8ClampedArray.find: not imple...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ec6ea93400050673dd12c641017632694b9a8122
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
constructor
`Date` constructor. @param year @param month @see ECMA-262, 21.4.2.1
constructor(year: double, month: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, 1.0), ecmaMakeTime(0.0, 0.0, 0.0, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right A...
constructor(year: double, month: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, 1.0), ecmaMakeTime(0.0, 0.0, 0.0, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8271f28e4a8460f15390e6a0658e328f8463f562
gitee
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
initDeviceList
Initialize the device list.
initDeviceList(): void { this.deviceList = []; if (this.localDevice !== undefined) { this.addToDeviceList(this.localDevice) } this.trustedDeviceList.forEach((item: deviceManager.DeviceInfo) => { this.addToDeviceList(item); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initDeviceList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
initDeviceList(): void { this.deviceList = []; if (this.localDevice !== undefined) { this.addToDeviceList(this.localDevice) } this.trustedDeviceList.forEach((item: deviceManager.DeviceInfo) => { this.addToDeviceList(item); }) }
https://gitee.com/openharmony/codelabs.git
85f80a1a0b5fad99309c54cabfb7ef29e9e08a32
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
from
Creates an array from an array of the same type. @param { Uint16Array } arr - An array to convert to a new array. @returns { Uint16Array } - A new Uint16Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Uint16Array): Uint16Array { let result = new Uint16Array(arr.length) result.set(arr) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: Uint16Array): Uint16Array { let result = new Uint16Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
3034cf5f2752fba17385aca191d90f0ba3244db1
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets
arkts
getRetentionDays
获取数据保留天数
public getRetentionDays(): number { return this.settings.retentionDays; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRetentionDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS...
public getRetentionDays(): number { return this.settings.retentionDays; }
https://github.com/DaLongZhuaZi/manxia
5754c428e4e0a95edaf9a806d13c736f6d37b150
github
openharmony/applications_mms
entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets
arkts
jumpToManageSimPage
The Manage SIM Card page is displayed.
jumpToManageSimPage(index) { if (this.simCount == 0) { return; } router.push({ uri: 'pages/manage_sim/manage_sim', params: { idx: index, countOfSim: this.simCount } }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToManageSimPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AS...
jumpToManageSimPage(index) { if (this.simCount == 0) { return; } router.push({ uri: 'pages/manage_sim/manage_sim', params: { idx: index, countOfSim: this.simCount } }); }
https://gitee.com/openharmony/applications_mms.git
3b03a53534e1ce97569a22ecaec128a6041851f7
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/SettingSlider.ets
arkts
linearToLog
将线性滑块位置 (0-100) 转换为对数分布的实际值 @param linearValue 滑块的线性位置 (0-100) @param min 最小实际值 @param max 最大实际值 @returns 对数缩放后的实际值
static linearToLog(linearValue: number, min: number, max: number): number { if (linearValue <= 0 || min <= 0) return min; if (linearValue >= 100) return max; const minLog = Math.log(min); const maxLog = Math.log(max); const logRange = maxLog - minLog; // 线性位置 (0-100) -> 对数值 const normali...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left linearToLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left linearValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number...
static linearToLog(linearValue: number, min: number, max: number): number { if (linearValue <= 0 || min <= 0) return min; if (linearValue >= 100) return max; const minLog = Math.log(min); const maxLog = Math.log(max); const logRange = maxLog - minLog; // 线性位置 (0-100) -> 对数值 const normali...
https://github.com/AlkaidLab/moonlight-harmony
1667b91bf7186646e4d611547028c4c1aea1ab8e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
$_get
Returns an instance of BigInt at passed index. @param { int } i - index to look at @returns { BigInt } - a primitive at index @syscap SystemCapability.Utils.Lang @FaAndStageModel
public $_get(i: int): BigInt { return BigInt.fromULong(this.getLong(i)) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public $_get(i: int): BigInt { return BigInt.fromULong(this.getLong(i)) }
https://gitcode.com/iop123123/arkts-static-skills
edaf3ef2ba841a466d423e8bbe23e12c894e48f5
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/DownloadsViewModel.ets
arkts
isSelected
判断是否选中
isSelected(task_id: string): boolean { return this.selectedIds.has(task_id); // O(1) 复杂度 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left task_id AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig...
isSelected(task_id: string): boolean { return this.selectedIds.has(task_id); // O(1) 复杂度 }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L72-L74
4d49bf7822faf2d517dae76977761b7709da227f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineDataSet.ets
arkts
isDrawCubicEnabled
@Deprecated
public isDrawCubicEnabled(): boolean { return this.mMode == Mode.CUBIC_BEZIER; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawCubicEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolea...
public isDrawCubicEnabled(): boolean { return this.mMode == Mode.CUBIC_BEZIER; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
73ef41b5cf5170fb864c1d9923fb5659a6c3faa8
gitee
Vsolon0401/MallShopping
product/phone/src/main/ets/pages/CollectionPage.ets
arkts
aboutToAppear
@State pageOption: PageOption = new PageOption(1, 5)
aboutToAppear() { collectionService.fetchCollectionList(1,10).then(res => { this.collectionList = res.data.list }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { collectionService.fetchCollectionList(1,10).then(res => { this.collectionList = res.data.list }) }
https://github.com/Vsolon0401/MallShopping
dbfe682122f6eb8f9d950b298169d78c36e33617
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/BarLineChartTouchListener.ets
arkts
performHighlightDrag
Highlights upon dragging, generates callbacks for the selection-listener. @param e
private performHighlightDrag(isTouchEvent: boolean, event: TouchEvent | GestureEvent, isLongPressed?: boolean) { let xCoordinate: number = 0; let yCoordinate: number = 0; if (isTouchEvent) { event = event as TouchEvent; if (!event.touches || event.touches.length == 0 || !event.touches[0]) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left performHighlightDrag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boo...
private performHighlightDrag(isTouchEvent: boolean, event: TouchEvent | GestureEvent, isLongPressed?: boolean) { let xCoordinate: number = 0; let yCoordinate: number = 0; if (isTouchEvent) { event = event as TouchEvent; if (!event.touches || event.touches.length == 0 || !event.touches[0]) { ...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
39ff35f75f8c0267b57d7c5af42923914638b092
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractDualSenseController.ets
arkts
reconnectPipe
恢复 usbManager 管道 (DDK 失败后回退用)
private reconnectPipe(): void { if (this.pipe) return; try { console.info(`${TAG} 恢复 usbManager 管道...`); this.pipe = usbManager.connectDevice(this.device); console.info(`${TAG} usbManager 管道已恢复`); } catch (err) { console.error(`${TAG} 恢复管道失败: ${err}`); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reconnectPipe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#vo...
private reconnectPipe(): void { if (this.pipe) return; try { console.info(`${TAG} 恢复 usbManager 管道...`); this.pipe = usbManager.connectDevice(this.device); console.info(`${TAG} usbManager 管道已恢复`); } catch (err) { console.error(`${TAG} 恢复管道失败: ${err}`); } }
https://github.com/AlkaidLab/moonlight-harmony
d72393f2c00e686ba2a62bcfec211a5243a2975a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets
arkts
searchVolumes
执行卷搜索 @param query 搜索查询 @param limit 返回数量限制
private async searchVolumes(query: string, limit: number): Promise<ScraperSearchResult> { try { logger.info(TAG, `搜索Google Books: query=${query}`); const encodedQuery = encodeURIComponent(query); let url = `${GoogleBooksScraper.BASE_URL}/volumes?q=${encodedQuery}&maxResults=${Math.min(limit, 40...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left searchVolumes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left :...
private async searchVolumes(query: string, limit: number): Promise<ScraperSearchResult> { try { logger.info(TAG, `搜索Google Books: query=${query}`); const encodedQuery = encodeURIComponent(query); let url = `${GoogleBooksScraper.BASE_URL}/volumes?q=${encodedQuery}&maxResults=${Math.min(limit, 40...
https://github.com/DaLongZhuaZi/manxia
79487774ab3084936133fb252e83ad558b8ae831
github
openharmony/codelabs
ETSUI/SimpleApp/entry/src/main/ets/pages/Index.ets
arkts
darkenColor
颜色工具函数
function darkenColor(color: string, factor: number): string { // 简单的颜色变暗实现(针对十六进制颜色) if (color.startsWith('#')) { const hex = color.slice(1); const num = parseInt(hex, 16); const amt = Math.round(2.55 * factor * 100); const R = (num >> 16) - amt; const G = (num >> 8 & 0x00FF) - amt; const B ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left darkenColor AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left color AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function darkenColor(color: string, factor: number): string { // 简单的颜色变暗实现(针对十六进制颜色) if (color.startsWith('#')) { const hex = color.slice(1); const num = parseInt(hex, 16); const amt = Math.round(2.55 * factor * 100); const R = (num >> 16) - amt; const G = (num >> 8 & 0x00FF) - amt; const B ...
https://gitcode.com/openharmony/codelabs
f1f7c9a781b9bd6b2a69667d6bf5a35a9e42a547
gitcode
OHPG/FinVideo
entry/src/main/ets/player/AppPlayerContext.ets
arkts
buildQueue
─── 内部方法 ────────────────────────────────────────────────────────────── 构建播放队列
private buildQueue(items: Array<FinItem>): Array<avSession.AVQueueItem> { let queueItems = new Array<avSession.AVQueueItem>() items.forEach((item: FinItem, i: number) => { let extra: Record<string, Object> = {} // 构建 PlaybackParams let params: PlaybackParams = {} if (item.data?.playe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
private buildQueue(items: Array<FinItem>): Array<avSession.AVQueueItem> { let queueItems = new Array<avSession.AVQueueItem>() items.forEach((item: FinItem, i: number) => { let extra: Record<string, Object> = {} // 构建 PlaybackParams let params: PlaybackParams = {} if (item.data?.playe...
https://github.com/OHPG/FinVideo
5acdd3da3da810ae9048e5dc5786ab7513cddc81
github
openharmony/applications_contacts
common/src/main/ets/util/SharedPreferencesUtils.ets
arkts
saveToPreferences
saveToPreferences @param key save to Preferences @param value save to Preferences
public async saveToPreferences(key: string, value: ValueType) { let preferences: data_preferences.Preferences = await this.getPreferences(); await preferences.put(key, value); preferences.flush() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveToPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : ...
public async saveToPreferences(key: string, value: ValueType) { let preferences: data_preferences.Preferences = await this.getPreferences(); await preferences.put(key, value); preferences.flush() }
https://gitee.com/openharmony/applications_contacts.git
b010efe73069fee650575d637ee351891b78b574
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/EntryAbility.ets
arkts
getFileTypeFromUri
根据文件URI获取文件类型
private getFileTypeFromUri(uri: string): string { const extension = this.getFileExtensionWithoutDot(uri); // AVIF图片 if (this.isExtensionIn(extension, NETWORK_FOLDER_AVIF_EXTENSIONS)) { return EntryAbility.FILE_TYPE_AVIF; } // 普通图片 if (this.isExtensionIn(extension, NETWORK_FOLDER_IM...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileTypeFromUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private getFileTypeFromUri(uri: string): string { const extension = this.getFileExtensionWithoutDot(uri); // AVIF图片 if (this.isExtensionIn(extension, NETWORK_FOLDER_AVIF_EXTENSIONS)) { return EntryAbility.FILE_TYPE_AVIF; } // 普通图片 if (this.isExtensionIn(extension, NETWORK_FOLDER_IM...
https://github.com/DaLongZhuaZi/manxia
9109b9e3922e3759c233e7055346dd8ee4d69d9a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
filterArray
Constructs new `Object[]` primitive array filtered down to just the elements from the given array that pass the test implemented by the provided function. @param fn test function, applied to each element of an array. @returns Primitive array of `Object`s, constructed from `this` and given filtering function.
private filterArray(fn: (v: T, k: int) => boolean): T[] { let resNum = 0; let indicator: boolean[] = new boolean[this.data.length]; for (let i: int = 0; i < this.data.length; i++) { if (fn(this.data[i], i)) { indicator[i] = true; resNum++; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left filterArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left :...
private filterArray(fn: (v: T, k: int) => boolean): T[] { let resNum = 0; let indicator: boolean[] = new boolean[this.data.length]; for (let i: int = 0; i < this.data.length; i++) { if (fn(this.data[i], i)) { indicator[i] = true; resNum++; ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c9608f6ea364025408a099b6d50d3bf7f28951ee
gitee
codelably/HCompass
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
窗口销毁时调用 释放窗口资源
onWindowStageDestroy(): void {}
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expre...
onWindowStageDestroy(): void {}
https://github.com/codelably/HCompass
e5c1a16eb6b7d4bc8f89cedae8e52d68b96d7fcf
github
CPF-ApplicationTPC/openharmony_tpc_samples
bc_ohos/library/src/main/ets/Padding.ets
arkts
init
初始化,启用随机填充
init(): void { this.useRandom = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS...
init(): void { this.useRandom = true; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
476e71fd72cab8db64dc03714c1ba693e5db4b0a
gitcode
openharmony-tpc/VCard
library/src/main/ets/components/VCardParserImpl_V21.ets
arkts
handleLanguage
See also Section 7.1 of RFC 1521
protected handleLanguage(propertyData: VCardProperty, langval: string) : void { let strArray: string[] = langval.split("-"); if (strArray.length != 2) { throw new Error("Invalid Language: \"" + langval + "\""); } let tmp: string = strArray[0]; let length: ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left propertyData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
protected handleLanguage(propertyData: VCardProperty, langval: string) : void { let strArray: string[] = langval.split("-"); if (strArray.length != 2) { throw new Error("Invalid Language: \"" + langval + "\""); } let tmp: string = strArray[0]; let length: ...
https://gitee.com/openharmony-tpc/VCard.git
84da49b306a27e993e48abda178338a88a140462
gitee
openharmony/applications_photos
common/src/main/ets/default/view/browserOperation/MoveOrCopyBroadCastProp.ets
arkts
getInstance
Get MoveOrCopyBroadCastProp instance
public static getInstance(): MoveOrCopyBroadCastProp { if (AppStorage.get<MoveOrCopyBroadCastProp>(Constants.INSTANCE_MOVE_OR_COPY_BROADCAST_PROP) == null) { AppStorage.setOrCreate(Constants.INSTANCE_MOVE_OR_COPY_BROADCAST_PROP, new MoveOrCopyBroadCastProp()); } return AppStorage.get<MoveOrCopyBroad...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): MoveOrCopyBroadCastProp { if (AppStorage.get<MoveOrCopyBroadCastProp>(Constants.INSTANCE_MOVE_OR_COPY_BROADCAST_PROP) == null) { AppStorage.setOrCreate(Constants.INSTANCE_MOVE_OR_COPY_BROADCAST_PROP, new MoveOrCopyBroadCastProp()); } return AppStorage.get<MoveOrCopyBroad...
https://gitee.com/openharmony/applications_photos.git
67dbe41aa783bb4f9f58beba21d1f32ecb81b322
gitee
HunZiLei/ArkTS_PokePomodoro
entry/src/main/ets/components/IndexTabPages/TaskList.ets
arkts
submitNewTask
数据库操作封装
submitNewTask(taskData: TaskData) { this.taskTable.insertData(taskData, (id: number) => { taskData.id = id taskData.setDDLState() this.tasks.push(taskData) }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left submitNewTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TaskData AST#identifier...
submitNewTask(taskData: TaskData) { this.taskTable.insertData(taskData, (id: number) => { taskData.id = id taskData.setDDLState() this.tasks.push(taskData) }) }
https://github.com/HunZiLei/ArkTS_PokePomodoro
1892475bb3fb5349fcb91823f9153db240e9ec7f
github
openharmony/applications_photos
common/src/main/ets/default/model/common/HistogramManager.ets
arkts
initializePixelArray
接收worker返回的数据
private initializePixelArray(): void { Log.info(TAG, 'get pixel array by deserialize'); let serializedBuffer = AppStorage.get<string>(Constants.HISTOGRAM_ARRAY_BUFFER_KEY); if (!serializedBuffer) { Log.error(TAG, 'initializePixelArray: serializedBuffer is undefined'); return; } // 反序列化...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializePixelArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private initializePixelArray(): void { Log.info(TAG, 'get pixel array by deserialize'); let serializedBuffer = AppStorage.get<string>(Constants.HISTOGRAM_ARRAY_BUFFER_KEY); if (!serializedBuffer) { Log.error(TAG, 'initializePixelArray: serializedBuffer is undefined'); return; } // 反序列化...
https://gitee.com/openharmony/applications_photos.git
94e3f0e7016bdce097eea26ef4aad9450c1e1e82
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test52_original_index.ets
arkts
slidingMax
--- Sliding window max ---
function slidingMax(arr: number[], k: number): number[] { let result: number[] = []; for (let i: number = 0; i <= arr.length - k; i++) { let max: number = arr[i]; for (let j: number = 1; j < k; j++) { if (arr[i + j] > max) { max = arr[i + j]; } } result.push(max); } return re...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left slidingMax AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function slidingMax(arr: number[], k: number): number[] { let result: number[] = []; for (let i: number = 0; i <= arr.length - k; i++) { let max: number = arr[i]; for (let j: number = 1; j < k; j++) { if (arr[i + j] > max) { max = arr[i + j]; } } result.push(max); } return re...
https://github.com/miaochiahao/ark-ghidra
46bdeb9b070421ee0e60bfed8d2fd58dc87115fb
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
currentTabSearchNext
Go to next search result on current tab.
currentTabSearchNext() { if (!this.currentTab) { meow(`No current tab found!`, 'meowTabBunch][currentTabSearchNext', meowLevel.WARN); return; } this.currentTab.searchNext(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left currentTabSearchNext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo...
currentTabSearchNext() { if (!this.currentTab) { meow(`No current tab found!`, 'meowTabBunch][currentTabSearchNext', meowLevel.WARN); return; } this.currentTab.searchNext(); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
45f954b24fb72daa0ce5c59df3abbdec323c0888
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets
arkts
markNotFirstLaunch
标记为非首次启动
public async markNotFirstLaunch(): Promise<void> { try { if (!this.isInitialized) { await this.initialize(); } this.isFirstLaunch = false; await this.saveGuideState(); logger.info(TAG, '已标记为非首次启动'); } catch (error) { logger.error(TAG, '标记非首次启动失败', String(error)); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left markNotFirstLaunch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public async markNotFirstLaunch(): Promise<void> { try { if (!this.isInitialized) { await this.initialize(); } this.isFirstLaunch = false; await this.saveGuideState(); logger.info(TAG, '已标记为非首次启动'); } catch (error) { logger.error(TAG, '标记非首次启动失败', String(error)); ...
https://github.com/DaLongZhuaZi/manxia
2ba8f50d812f49bb5344b2e733c15a1417ecc3c9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getParentElement
获取父元素
private getParentElement(element: string, tag: string, fullContent: string): string[] { const elementIndex = fullContent.indexOf(element); if (elementIndex === -1) return []; // 向前查找最近的未闭合标签 let depth = 0; let i = elementIndex - 1; while (i >= 0) { const beforeContent = fullContent....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getParentElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
private getParentElement(element: string, tag: string, fullContent: string): string[] { const elementIndex = fullContent.indexOf(element); if (elementIndex === -1) return []; // 向前查找最近的未闭合标签 let depth = 0; let i = elementIndex - 1; while (i >= 0) { const beforeContent = fullContent....
https://github.com/DaLongZhuaZi/manxia
63f222ab0890ede4445462c925b66cf4085baf1a
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/UserListViewModel.ets
arkts
initUsers
初始化数据
initUsers() { console.info('UserListViewModel: initUsers') let url: string //根据类型来选择API switch (this.userListType) { case UserListType.AuthorizationFollowing: url = UserAPI.GetAuthorizedFollowing() break case UserListType.AuthorizationFollower: url = UserAPI.GetAu...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
initUsers() { console.info('UserListViewModel: initUsers') let url: string //根据类型来选择API switch (this.userListType) { case UserListType.AuthorizationFollowing: url = UserAPI.GetAuthorizedFollowing() break case UserListType.AuthorizationFollower: url = UserAPI.GetAu...
https://gitee.com/openharmony-sig/online_event.git
0cd166a88c9e69016739a49b7ef87dcf9cab91f4
gitee
HarmonyOS_Samples/BestPracticeSnippets
ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets
arkts
buffer
[StartExclude split_buffer1]
function buffer(bufferArray: ESObject, taskNum: number, sliderValue: number, value: number) { let Workers: ESObject // [EndExclude split_buffer1] // Assign the split pixels to the Worker instance. const buffers: ArrayBuffer[] = splitArrayBuffer(bufferArray, taskNum); let messages: MessageItem[] = []; for (l...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buffer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bufferArray AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function buffer(bufferArray: ESObject, taskNum: number, sliderValue: number, value: number) { let Workers: ESObject // [EndExclude split_buffer1] // Assign the split pixels to the Worker instance. const buffers: ArrayBuffer[] = splitArrayBuffer(bufferArray, taskNum); let messages: MessageItem[] = []; for (l...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
55c8d13a4f5c3214334dc6bd47c50181e6bdadd5
gitcode
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
replaceWithDefaultAnim
将当前NavDestination替换为特定NavDestination。当前的NavDestination将被销毁。默认转场动画 解决replace()方法无动画问题 @param name
public replaceWithDefaultAnim(name: string) { const beforePath = this.getTopPathName() ?? "" this.navigation(name) setTimeout(() => { this.routerMgr.removeByName(beforePath) }, 500) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceWithDefaultAnim AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public replaceWithDefaultAnim(name: string) { const beforePath = this.getTopPathName() ?? "" this.navigation(name) setTimeout(() => { this.routerMgr.removeByName(beforePath) }, 500) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L237-L243
4e1eaabad911dfba89d916241c9117213f5cc84f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TarPackager.ets
arkts
createTarHeader
创建 tar 文件头
private createTarHeader(name: string, size: number, mtime: number): TarHeader { return { name: name, mode: '0000644', uid: '0000000', gid: '0000000', size: size.toString(8).padStart(11, '0'), mtime: Math.floor(mtime / 1000).toString(8).padStart(11, '0'), checksum: ' ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createTarHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private createTarHeader(name: string, size: number, mtime: number): TarHeader { return { name: name, mode: '0000644', uid: '0000000', gid: '0000000', size: size.toString(8).padStart(11, '0'), mtime: Math.floor(mtime / 1000).toString(8).padStart(11, '0'), checksum: ' ...
https://github.com/DaLongZhuaZi/manxia
1a5acb0264af176008c9ba372731554d344cfaba
github
openharmony/testfwk_arkxtest
jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets
arkts
isMap
是否是map对象 @param obj
static isMap<T>(obj: T): boolean { return obj !== null && typeof obj !== 'undefined' && obj instanceof Map; }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left isMap AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_par...
static isMap<T>(obj: T): boolean { return obj !== null && typeof obj !== 'undefined' && obj instanceof Map; }
https://gitee.com/openharmony/testfwk_arkxtest.git
43034d1ed222e2f50d20ff1e0108d7dbb1689a2a
gitee
openharmony-sig/knowledge_demo_entainment
FA/BombGame/entry/src/main/ets/MainAbility/pages/game.ets
arkts
judgeGame
判断游戏输赢 @param operation 点击类型
judgeGame(operation:RuleType) { this.stopCountDown() if (operation != this.ruleText) { this.gameFail() } else { prompt.showToast({ message: "finish" }) this.bombIndex = -1 this.startAbilityRandom() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left judgeGame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left RuleType AST#identifier#Right AST#ERROR#Ri...
judgeGame(operation:RuleType) { this.stopCountDown() if (operation != this.ruleText) { this.gameFail() } else { prompt.showToast({ message: "finish" }) this.bombIndex = -1 this.startAbilityRandom() } }
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
9bdfebcee5b210ac8724b6fc586c2819f4b2fc31
gitee
JQHxx/codelabs
OxHornCampus/entry/src/main/ets/common/utils/Animation.ets
arkts
controlImageScale
Control the image scale. @param pageThis @param offset @param state @returns real list offset.
public static controlImageScale(animationItem: AnimationItem, offset: number, state: ScrollState): number { if ((offset > 0) && (animationItem.imageHeight > CommonConstants.MIN_IMAGE_HEIGHT)) { // Scale down the image by offset. let offsetHeight = (Math.abs(offset) * CommonConstants.FULL_PERCENT_NUMBE...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left controlImageScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left animationItem AST#identifier#Right AS...
public static controlImageScale(animationItem: AnimationItem, offset: number, state: ScrollState): number { if ((offset > 0) && (animationItem.imageHeight > CommonConstants.MIN_IMAGE_HEIGHT)) { // Scale down the image by offset. let offsetHeight = (Math.abs(offset) * CommonConstants.FULL_PERCENT_NUMBE...
https://github.com/JQHxx/codelabs
df55c4bfc54b87cb0e853900432d93e11d9a4caa
github
openharmony-tpc/ImageKnife
entry/src/main/ets/common/CustomEngineKeyImpl.ets
arkts
generateMemoryKey
生成内存缓存key
generateMemoryKey(loadSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource, imageKnifeOption: ImageKnifeOption,isAnimator?: boolean, width?: number, height?: number): string { let key = "" if(imageKnifeOption.signature == "aaa" && typeof loadSrc == "string") { let num = loadSrc....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateMemoryKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loadSrc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left A...
generateMemoryKey(loadSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource, imageKnifeOption: ImageKnifeOption,isAnimator?: boolean, width?: number, height?: number): string { let key = "" if(imageKnifeOption.signature == "aaa" && typeof loadSrc == "string") { let num = loadSrc....
https://gitee.com/openharmony-tpc/ImageKnife.git
d05620ad67fb92d9f3b944e49bcda78c6a3acebf
gitee
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/UserHandler.ets
arkts
isPhoneNumberExists
检查手机号是否已存在 @param phoneNumber 待检查的手机号 @returns true 表示已存在,false 表示不存在
async isPhoneNumberExists(phoneNumber: string): Promise<boolean> { if (!this.store) { return false; } let predicates = new relationalStore.RdbPredicates('User'); predicates.equalTo('phoneNumber', phoneNumber); try { let resultSet = await this.store.query(predicates); let count ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left isPhoneNumberExists AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left phoneNumber AST#identifie...
async isPhoneNumberExists(phoneNumber: string): Promise<boolean> { if (!this.store) { return false; } let predicates = new relationalStore.RdbPredicates('User'); predicates.equalTo('phoneNumber', phoneNumber); try { let resultSet = await this.store.query(predicates); let count ...
https://gitcode.com/openharmony/codelabs
9c01eab8df1c824f1c8ac8762957b494199488f5
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPAuthManager.ets
arkts
autoConnectOnVMStart
VM 启动后自动连接
public async autoConnectOnVMStart(vmName: string): Promise<void> { const credential = this.credentials.get(vmName); if (!credential || !credential.autoConnect) { console.info(`[RDPAuthManager] Auto-connect disabled for ${vmName}`); return; } console.info(`[RDPAuthManager] Auto-connecting ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left autoConnectOnVMStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#L...
public async autoConnectOnVMStart(vmName: string): Promise<void> { const credential = this.credentials.get(vmName); if (!credential || !credential.autoConnect) { console.info(`[RDPAuthManager] Auto-connect disabled for ${vmName}`); return; } console.info(`[RDPAuthManager] Auto-connecting ...
https://github.com/AetheriumSimulator/qemu-hmos
1fabb094ce67c7f694879f69dc294b6c1dca46a1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Search/SearchIntentParser.ets
arkts
parsePixivUrl
解析Pixiv URL
private static parsePixivUrl(url: string, path: string): SearchIntent { // /artworks/12345 或 /i/12345 const artworkMatch = path.match(/\/(artworks|i)\/(\d+)/); if (artworkMatch) { const result: SearchIntent = { type: SearchIntentType.MANGA_ID, id: artworkMatch[2], url: url, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parsePixivUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : ...
private static parsePixivUrl(url: string, path: string): SearchIntent { // /artworks/12345 或 /i/12345 const artworkMatch = path.match(/\/(artworks|i)\/(\d+)/); if (artworkMatch) { const result: SearchIntent = { type: SearchIntentType.MANGA_ID, id: artworkMatch[2], url: url, ...
https://github.com/DaLongZhuaZi/manxia
52ffc63dfa29bb312442c4d1fe23823f570d50f0
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/third-party/hds-button/HdsMiniBarButton.ets
arkts
build
==================== UI 构建 ==================== 构建组件 UI 使用 Row 包裹 HdsTabs 实现浮动按钮效果
build() { Row() { HdsTabs({ controller: this.getController() }) { TabContent() .tabBar(this.buttonContent()) } .clip(false) .barWidth(this.barWidth) .barHeight(this.barHeight) .barOverlap(this.barOverlap) .barPosition(this.barPosition) .barFloating...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row() { HdsTabs({ controller: this.getController() }) { TabContent() .tabBar(this.buttonContent()) } .clip(false) .barWidth(this.barWidth) .barHeight(this.barHeight) .barOverlap(this.barOverlap) .barPosition(this.barPosition) .barFloating...
https://github.com/ZestBox-18/kitebook-frontend
2c03a6979eb4899263a70cbc791f3d89ba9dc072
github
cpdd5201314/harmonyOS-music-app
common/mediaCommon/src/main/ets/utils/request.ets
arkts
createPost
创建帖子 - 使用 JSON 格式(不包含图片)
static async createPost(postData: CreatePostRequest): Promise<Post> { // 使用已声明的接口创建对象 const requestData: CreatePostData = { title: postData.title, content: postData.content }; console.log('发送的JSON数据:', requestData); return request<Post>('/posts', http.RequestMethod.POST, requestData);...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left createPost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left postData AST#identifier#Right AST#:#Left : AS...
static async createPost(postData: CreatePostRequest): Promise<Post> { // 使用已声明的接口创建对象 const requestData: CreatePostData = { title: postData.title, content: postData.content }; console.log('发送的JSON数据:', requestData); return request<Post>('/posts', http.RequestMethod.POST, requestData);...
https://github.com/cpdd5201314/harmonyOS-music-app
346c230489ac8d1c14d112a1898de581f3d123c7
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/ReviewEventRepository.ets
arkts
getReviewEventCount
Get total review event count
async getReviewEventCount(): Promise<number> { this.ensureInitialized(); const sql = `SELECT COUNT(1) AS cnt FROM ${TABLE_REVIEW_EVENTS}`; const rs = await this.store!.querySql(sql); let count = 0; if (rs.goToFirstRow()) { count = Number(rs.getLong(rs.getColumnIndex('cnt'))); } rs.c...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getReviewEventCount AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters...
async getReviewEventCount(): Promise<number> { this.ensureInitialized(); const sql = `SELECT COUNT(1) AS cnt FROM ${TABLE_REVIEW_EVENTS}`; const rs = await this.store!.querySql(sql); let count = 0; if (rs.goToFirstRow()) { count = Number(rs.getLong(rs.getColumnIndex('cnt'))); } rs.c...
https://github.com/CLMC2025/Vignette
09d9028478f12109ff8d24ac2663ad2a968535d7
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
getArrayBuffer
Get flattened ArrayBuffer through sync interface.
getArrayBuffer(): ArrayBuffer { return ArrayBuffer.from(this.arrBuffer as ArrayBuffer); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getArrayBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ArrayBuffer AST#identifier#Right AST#ERROR#Righ...
getArrayBuffer(): ArrayBuffer { return ArrayBuffer.from(this.arrBuffer as ArrayBuffer); }
https://gitcode.com/iop123123/arkts-static-skills
501642d68b8607434ee4611a53fc11f9f8a8ccf7
gitcode
openharmony/applications_photos
common/src/main/ets/default/view/Histogram.ets
arkts
adjustLayout
适配pc屏幕大小变化,以及phone横竖屏
adjustLayout() { Log.info(TAG, 'histogram adjustLayout'); HistogramManager.getInstance() .setWidth(this.listCardWidth - Constants.COLUMN_PADDING * Constants.NUMBER_2) .startDraw(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left adjustLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
adjustLayout() { Log.info(TAG, 'histogram adjustLayout'); HistogramManager.getInstance() .setWidth(this.listCardWidth - Constants.COLUMN_PADDING * Constants.NUMBER_2) .startDraw(); }
https://gitee.com/openharmony/applications_photos.git
dac5da26f3e750c87f22c10f209430665e980cc0
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/parking/ParkingService.ets
arkts
getParkingRecord
获取当前停车记录
async getParkingRecord(): Promise<ParkingRecord | null> { try { if (this.preferences != null) { const record: preferences.ValueType | null = await this.preferences.get(StorageConstants.CURRENT_RECORD_KEY, null); return record as ParkingRecord | null; } return null; } catch (e...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getParkingRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async getParkingRecord(): Promise<ParkingRecord | null> { try { if (this.preferences != null) { const record: preferences.ValueType | null = await this.preferences.get(StorageConstants.CURRENT_RECORD_KEY, null); return record as ParkingRecord | null; } return null; } catch (e...
https://github.com/LJ666-ui/harmony-health-care
0f0f68a30d7adfc1f19613df4133e274e5167af3
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/PairingManager.ets
arkts
getHashLength
获取哈希长度
private getHashLength(useSha256: boolean): number { return useSha256 ? 32 : 20; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getHashLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left useSha256 AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#b...
private getHashLength(useSha256: boolean): number { return useSha256 ? 32 : 20; }
https://github.com/AlkaidLab/moonlight-harmony
4c254547c8a8ecafecd43487961699fafeffb8c6
github
PollenWang6/HiXD
entry/src/main/ets/services/SchoolnetService.ets
arkts
parseZfwDetail
解析上网明细页 HTML
private parseZfwDetail(html: string): ZfwDetailResult { const entries: ZfwDetailEntry[] = []; let totalPages: number = 1; const summary: ZfwDetailSummary = { flow: '0', duration: '0', cost: '0' }; // 解析分页:找到最大页码 const pageLinkRe: RegExp = /page=(\d+)/g; let pageMatch: RegExpExecArray | null; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseZfwDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private parseZfwDetail(html: string): ZfwDetailResult { const entries: ZfwDetailEntry[] = []; let totalPages: number = 1; const summary: ZfwDetailSummary = { flow: '0', duration: '0', cost: '0' }; // 解析分页:找到最大页码 const pageLinkRe: RegExp = /page=(\d+)/g; let pageMatch: RegExpExecArray | null; ...
https://github.com/PollenWang6/HiXD
9295f9603c71eed5b25da3e41e88e484b4f7bff7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
filter
Creates a new Int8Array from current Int8Array based on a condition fn. @param fn the condition to apply for each element @returns a new Int8Array with elements from current Int8Array that satisfy condition fn
public filter(fn: (val: byte, index: int, array: Int8Array) => boolean): Int8Array { let markers = new boolean[this.length] let resLen = 0 for (let i = 0; i < this.length; ++i) { markers[i] = fn(this.at(i), i, this) if (markers[i]) { ++resLen ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public filter(fn: (val: byte, index: int, array: Int8Array) => boolean): Int8Array { let markers = new boolean[this.length] let resLen = 0 for (let i = 0; i < this.length; ++i) { markers[i] = fn(this.at(i), i, this) if (markers[i]) { ++resLen ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
77ff3d9d5afcd94ac27e4402e093f67d400ae2dc
gitee
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
playSound
播放音效 @param type 音效类型 @param volumeOverride 覆盖音量(可选)
playSound(type: SoundType, volumeOverride?: number): void { // 检查音效是否启用 if (!this.settings.soundEnabled && !this.isBackgroundMusic(type)) { return; } if (!this.settings.musicEnabled && this.isBackgroundMusic(type)) { return; } const config = this.soundConfigs.get(type); if (!...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left playSound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SoundType AST#identifier#Right AST#,#Left , AS...
playSound(type: SoundType, volumeOverride?: number): void { // 检查音效是否启用 if (!this.settings.soundEnabled && !this.isBackgroundMusic(type)) { return; } if (!this.settings.musicEnabled && this.isBackgroundMusic(type)) { return; } const config = this.soundConfigs.get(type); if (!...
https://github.com/the-wwyang/kids-learning-app
e31f340371c5e8e6d72966788a9e93e5942ac7cd
github
harmonyos/codelabs
HarmonyOS_NEXT/Preferences/entry/src/main/ets/model/PreferenceModel.ets
arkts
showToastMessage
Popup window prompt message. @param message Prompt message.
showToastMessage(message: Resource) { promptAction.showToast({ message: message, duration: CommonConstants.DURATION }); };
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToastMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifi...
showToastMessage(message: Resource) { promptAction.showToast({ message: message, duration: CommonConstants.DURATION }); };
https://gitee.com/harmonyos/codelabs.git
a1bdcccd3d82224eb09b26a2588dc89cd634f267
gitee
yang-kun-long/HarmonyAccounting
entry/src/main/ets/common/database/Rdb.ets
arkts
getRdbStore
获取RdbStore实例 @param callback 回调函数,当RdbStore实例创建完成时被调用
getRdbStore(callback: Function = () => { }) { // 检查回调函数是否有效 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'getRdbStore() has no callback!'); return; } // 如果rdbStore实例已经存在,则直接调用回调函数 if (this.rdbStore !== null) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier...
getRdbStore(callback: Function = () => { }) { // 检查回调函数是否有效 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'getRdbStore() has no callback!'); return; } // 如果rdbStore实例已经存在,则直接调用回调函数 if (this.rdbStore !== null) { ...
https://github.com/yang-kun-long/HarmonyAccounting
9044fcbd33ae47038b394bd53fbe6f5db716a4db
github
Yebingiscn/SweetVideo
entry/src/main/ets/component/PlayerComponent/FastForwardPanelBuilder.ets
arkts
getNeighborSpeeds
获取相邻倍速信息
function getNeighborSpeeds(currentSpeed: number): SpeedNeighborInterface { const speeds = VideoInfoUtil.videoSpeedListAll const currentIndex = speeds.findIndex((s: number) => Math.abs(s - currentSpeed) < 0.01) return { prev: currentIndex > 0 ? speeds[currentIndex - 1] : null, current: currentSpeed, ne...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getNeighborSpeeds AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left currentSpeed AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
function getNeighborSpeeds(currentSpeed: number): SpeedNeighborInterface { const speeds = VideoInfoUtil.videoSpeedListAll const currentIndex = speeds.findIndex((s: number) => Math.abs(s - currentSpeed) < 0.01) return { prev: currentIndex > 0 ? speeds[currentIndex - 1] : null, current: currentSpeed, ne...
https://github.com/Yebingiscn/SweetVideo
5a63e97bc66ea711cb95f487c005981a4d6481b5
github
Yebingiscn/SweetVideo
entry/src/main/ets/component/PlayerComponent/AudioTrackComponent.ets
arkts
getKey
获取唯一键
getKey(item: TrackType): string { if (this.isAudioTrack(item)) { const track = item as AudioTrack return track.name + track.index } else if (this.isMpvAudioTrack(item)) { const track = item as MpvAudioTrack return track.title + track.id } return '' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TrackType AST#identifier#Right AST#)#Left ) AST#)...
getKey(item: TrackType): string { if (this.isAudioTrack(item)) { const track = item as AudioTrack return track.name + track.index } else if (this.isMpvAudioTrack(item)) { const track = item as MpvAudioTrack return track.title + track.id } return '' }
https://github.com/Yebingiscn/SweetVideo
2644918e3a93d12afae9aef4c3bc9f7a4b09e973
github
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/components/CategoryFilter.ets
arkts
aboutToAppear
分类切换回调
aboutToAppear() { // 初始化分类列表:全部 + 预定义分类 this.categories = [Constants.ALL_CATEGORY, ...Constants.CATEGORIES]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { // 初始化分类列表:全部 + 预定义分类 this.categories = [Constants.ALL_CATEGORY, ...Constants.CATEGORIES]; }
https://gitcode.com/openharmony/codelabs
1be1fa88b6de6bd67d7c1c89a60f2873cba0c072
gitcode
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/BillListPage.ets
arkts
showClearStartDatePickerDialog
显示起始日期选择器
showClearStartDatePickerDialog() { this.showClearStartDatePicker = true; this.showClearEndDatePicker = false; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showClearStartDatePickerDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#sta...
showClearStartDatePickerDialog() { this.showClearStartDatePicker = true; this.showClearEndDatePicker = false; }
https://github.com/qiuhaotc/HarmonyOSPlayground
809d70bc65a9b492f530805304f0f4d6b77adc7c
github
openharmony-sig/fluttertpc_camerawesome
ohos/ohos/src/main/ets/components/cameraX/CameraState.ets
arkts
resumeRecordingProcess
恢复录制对应的流程
async resumeRecordingProcess() { if (this.avRecorder != undefined && this.avRecorder.state === 'paused') { // 仅在paused状态下调用resume为合理状态切换 await this.videoOutput!!.start(); // 启动相机出流 await this.avRecorder.resume(); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left resumeRecordingProcess AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left...
async resumeRecordingProcess() { if (this.avRecorder != undefined && this.avRecorder.state === 'paused') { // 仅在paused状态下调用resume为合理状态切换 await this.videoOutput!!.start(); // 启动相机出流 await this.avRecorder.resume(); } }
https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git
6ffb714397b7f51a5b0cdca467417fc9012f7b02
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/HostSyncService.ets
arkts
init
初始化: 从 CloudStore RDB 恢复数据
async init(context: common.Context): Promise<void> { try { await this.cloud.init(context); this.cloud.onCloudChange(() => { this.loadFromCloud(); }); this.cloud.onCryptoReset(() => { this.hosts.clear(); this.rdpCredentials.clear(); hilog.info(0x0001, 'CloudSync', 'HostSyn...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
async init(context: common.Context): Promise<void> { try { await this.cloud.init(context); this.cloud.onCloudChange(() => { this.loadFromCloud(); }); this.cloud.onCryptoReset(() => { this.hosts.clear(); this.rdpCredentials.clear(); hilog.info(0x0001, 'CloudSync', 'HostSyn...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
dc513ca22b26d5408cfd5592fb11515df10f606b
github
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/pages/RegisterPage.ets
arkts
performInsert
执行实际的数据库插入操作
performInsert() { if (!this.rdbHelper) return; // 创建新用户对象 let newUser = new User(this.usernameStr, this.passwordStr, this.phoneStr); // 调用数据库插入 this.rdbHelper.insertUser(newUser).then((rowId) => { if (rowId > 0) { this.showToast('注册成功!请登录'); // 【修复点 1】加上 try-catch 消除 route...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left performInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
performInsert() { if (!this.rdbHelper) return; // 创建新用户对象 let newUser = new User(this.usernameStr, this.passwordStr, this.phoneStr); // 调用数据库插入 this.rdbHelper.insertUser(newUser).then((rowId) => { if (rowId > 0) { this.showToast('注册成功!请登录'); // 【修复点 1】加上 try-catch 消除 route...
https://gitcode.com/openharmony/codelabs
f68977fa59e885a888de3a7d11e13317f998efd6
gitcode
Bistu-OSSDT-2024/16-ArkNotes
memo/entry/src/main/ets/Component/CustomSearch.ets
arkts
build
添加默认初始化值
build() { Row(){ Row(){ Image($r('app.media.search')) .width(16) .margin({left:10}) //.padding({right:6,left:2}) TextInput({ placeholder:'快速搜索关键词', text:this.keywords }) .onChange((value:string)=>{ this.keywords ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row(){ Row(){ Image($r('app.media.search')) .width(16) .margin({left:10}) //.padding({right:6,left:2}) TextInput({ placeholder:'快速搜索关键词', text:this.keywords }) .onChange((value:string)=>{ this.keywords ...
https://github.com/Bistu-OSSDT-2024/16-ArkNotes
dff1421f8be16b496d3f73459e4ac1a877406a21
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Float32Array with respect to buf and byteOffset. @param buf data initializer @param byteOffset byte offset from begin of the buf
public constructor(buf: Buffer, byteOffset: int) { this(buf, byteOffset, buf.getByteLength() / Float32Array.BYTES_PER_ELEMENT) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer, byteOffset: int) { this(buf, byteOffset, buf.getByteLength() / Float32Array.BYTES_PER_ELEMENT) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a988b94cc6e2c8786b671345c7f32219c0b4e580
gitee
richshaw2015/nds
ohos/entry/src/test/DependencyRelations.test.ets
arkts
isSettingEnabled
检查设置项是否启用 @param key 设置键名 @returns 是否启用
isSettingEnabled(key: string): boolean { const state = this.settingStates.get(key); return state?.enabled ?? true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSettingEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
isSettingEnabled(key: string): boolean { const state = this.settingStates.get(key); return state?.enabled ?? true; }
https://github.com/richshaw2015/nds
aa95772e8046b2533d8796ea632704ebc0af945f
github
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
launch
启动异步压缩
async launch(): Promise<void> { if (this.config.onStart) { this.config.onStart(); } try { // 确保目标目录存在 const targetDir = this.getTargetDirectory(); await this.ensureDirectoryExists(targetDir); // 过滤需要压缩的文件 const filteredPaths = this.filterPaths(); if (filteredPa...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left launch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Le...
async launch(): Promise<void> { if (this.config.onStart) { this.config.onStart(); } try { // 确保目标目录存在 const targetDir = this.getTargetDirectory(); await this.ensureDirectoryExists(targetDir); // 过滤需要压缩的文件 const filteredPaths = this.filterPaths(); if (filteredPa...
https://github.com/kumaleap/ArkLuban
6659f1db26ad4203f057e224d321177773ceddde
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
computePenTilt
将 ArkUI 的 tiltX + tiltY(度)转换为 Moonlight 协议的单一倾斜角度 ArkUI tiltX: 手写笔在 X 轴方向的投影角度 [-90, 90] ArkUI tiltY: 手写笔在 Y 轴方向的投影角度 [-90, 90] Moonlight tilt: 从垂直方向的偏离角度 [0, 90],0 = 垂直,90 = 水平
private computePenTilt(tiltX: number, tiltY: number): number { if (tiltX === 0 && tiltY === 0) { return 0; // 垂直于屏幕 } const tiltXRad = tiltX * Math.PI / 180; const tiltYRad = tiltY * Math.PI / 180; // 从 tiltX/tiltY 投影角合成总倾斜角 const tanTiltX = Math.tan(tiltXRad); const tanTiltY = Math....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left computePenTilt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tiltX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private computePenTilt(tiltX: number, tiltY: number): number { if (tiltX === 0 && tiltY === 0) { return 0; // 垂直于屏幕 } const tiltXRad = tiltX * Math.PI / 180; const tiltYRad = tiltY * Math.PI / 180; // 从 tiltX/tiltY 投影角合成总倾斜角 const tanTiltX = Math.tan(tiltXRad); const tanTiltY = Math....
https://github.com/AlkaidLab/moonlight-harmony
5559aa5e058add578f0aa767457550ae04f03a3d
github
openharmony-sig/ohos-beacon-library
library/src/main/ets/components/beacon/logging/LogManager.ets
arkts
v
Send a verbose log message to the logger. @param message The message you would like logged. This message may contain string formatting which will be replaced with values from args. @param args Arguments for string formatting.
public static v(message: string, ...args: Object[]): void { LogManager.sLogger.v(message, args); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left v AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right ...
public static v(message: string, ...args: Object[]): void { LogManager.sLogger.v(message, args); }
https://gitee.com/openharmony-sig/ohos-beacon-library.git
bc9832b6318ef1eb01ba2f77f1df22aec00f6e26
gitee
wuba/omni-ui
omni_component/src/main/ets/components/chart/OmniFunnelChart.ets
arkts
renderFunnelChart
实际渲染漏斗图逻辑
renderFunnelChart() { if (this.config.maxLayerWidth <= this.config.minLayerWidth) { return } let layerHeight = this.config.layerHeight ?? 40 //漏斗图的高度 let yOffset = this.config.layerMargin ?? 0 this.funnelChartHeight = layerHeight * this.config.layerCount + yOffset * (this.config.layerCou...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left renderFunnelChart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#...
renderFunnelChart() { if (this.config.maxLayerWidth <= this.config.minLayerWidth) { return } let layerHeight = this.config.layerHeight ?? 40 //漏斗图的高度 let yOffset = this.config.layerMargin ?? 0 this.funnelChartHeight = layerHeight * this.config.layerCount + yOffset * (this.config.layerCou...
https://github.com/wuba/omni-ui
9adb7282846cca96432c72f294641ee6481172a1
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_overload/user/main.ets
arkts
testByte_Float
测试 i8 与 f32
function testByte_Float() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let res = instance.overloadFunc((5).toByte(), 3.14f); arktest.assertEQ(res, 5); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testByte_Float AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decl...
function testByte_Float() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let res = instance.overloadFunc((5).toByte(), 3.14f); arktest.assertEQ(res, 5); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
0fcfdce061183102e2285147f80c3d6fcdb918b7
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets
arkts
constructor
Constructs an empty list.
public constructor() { this.buffer = new LinkedList<T>(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { this.buffer = new LinkedList<T>(); }
https://gitcode.com/iop123123/arkts-static-skills
9386330ec97ebab3f24fab391200cd9dcfa52305
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreWebViewConfigs
恢复 WebView 配置
private async restoreWebViewConfigs(configs: WebViewConfigBackup[]): Promise<void> { logger.info(TAG, `Restoring WebView configs: ${configs.length} items`); const failures: string[] = []; for (const config of configs) { try { const now = Date.now(); const updateTime = Number(config....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left restoreWebViewConfigs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left configs AST#identifier#Right AS...
private async restoreWebViewConfigs(configs: WebViewConfigBackup[]): Promise<void> { logger.info(TAG, `Restoring WebView configs: ${configs.length} items`); const failures: string[] = []; for (const config of configs) { try { const now = Date.now(); const updateTime = Number(config....
https://github.com/DaLongZhuaZi/manxia
12aa908be724a48254ffcea12153d80be934e63e
github
JackJiang2011/harmonychat
entry/src/main/ets/IMClientManager.ets
arkts
resetInitFlag
重置本类的初始化标识。
resetInitFlag(): void { this.init = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetInitFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
resetInitFlag(): void { this.init = false; }
https://github.com/JackJiang2011/harmonychat
ba8111e52478d66718530edb6a03f1525dcdbdcf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
deleteMangaCache
删除漫画缓存
async deleteMangaCache(sourceId: number, mangaId: string): Promise<boolean> { try { if (!this.ensureCachePathsReady('deleteMangaCache')) { return false; } const safeMangaId = mangaId.replace(/[^a-zA-Z0-9_-]/g, '_'); const mangaPath = `${this.permanentCachePath}/source_${sourceId}/m...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteMangaCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async deleteMangaCache(sourceId: number, mangaId: string): Promise<boolean> { try { if (!this.ensureCachePathsReady('deleteMangaCache')) { return false; } const safeMangaId = mangaId.replace(/[^a-zA-Z0-9_-]/g, '_'); const mangaPath = `${this.permanentCachePath}/source_${sourceId}/m...
https://github.com/DaLongZhuaZi/manxia
bd8ba04220bac38163d594c2a494fec2c614a2f2
github
2763981847/Accounting-app
entry/src/main/ets/pages/MainPage.ets
arkts
build
页面渲染函数
build() { Stack() { Scroll(this.scroller) { Column({ space: CommonConstants.SPACE_M }) { Row() { // 页面标题 Text($r('app.string.MainAbility_label')) .height($r('app.float.component_size_SP')) .fontSize($r('app.float.font_size_L')) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack() { Scroll(this.scroller) { Column({ space: CommonConstants.SPACE_M }) { Row() { // 页面标题 Text($r('app.string.MainAbility_label')) .height($r('app.float.component_size_SP')) .fontSize($r('app.float.font_size_L')) ...
https://github.com/2763981847/Accounting-app
3c94c028a427404bd92224c079bbbdeec1e3470c
github