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
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/view/TrainsTrack.ets
arkts
fetchStartPosition
Obtain initial position.
fetchStartPosition() { const travelDistance = TrainsMapModel.travelDistance(this.sumDistance, this.fetchStartTime(this.trainLine), this.trainLine); this.calcFirstDistance(this.trainsInfo.lineData, travelDistance); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fetchStartPosition 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...
fetchStartPosition() { const travelDistance = TrainsMapModel.travelDistance(this.sumDistance, this.fetchStartTime(this.trainLine), this.trainLine); this.calcFirstDistance(this.trainsInfo.lineData, travelDistance); }
https://gitee.com/harmonyos/codelabs.git
bc5d217c0d745ac2b14914d30bbef26482bfbc1d
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
setUIEventListener
Set UI event listener
setUIEventListener(listener: UIEventListener | null): void { this.uiEventListener = listener; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUIEventListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left UIEven...
setUIEventListener(listener: UIEventListener | null): void { this.uiEventListener = listener; }
https://github.com/tangwengang-del/freerdp-harmonyos
98027ea783f37969b4a113b4e87e20bb5fbceeb4
github
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
updateTaskByDate
update db
updateTaskByDate(task: TaskInfo): Promise<number> { return new Promise((resolve, reject) => { TaskInfoApi.updateDataByDate(task, (flag: number) => { if (!flag) { Logger.error('insertTaskSetting', 'updateTaskSetting Error!'); reject(flag); } else { resolve(flag);...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left updateTaskByDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
updateTaskByDate(task: TaskInfo): Promise<number> { return new Promise((resolve, reject) => { TaskInfoApi.updateDataByDate(task, (flag: number) => { if (!flag) { Logger.error('insertTaskSetting', 'updateTaskSetting Error!'); reject(flag); } else { resolve(flag);...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
99f43856cbad85e334d1c8a86aa164251a4bd105
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setHintFontSize
设置Loading文字大小 @param size
setHintFontSize(size?: number | string | Resource): Builder { this.popupOptions.hintFontSize = size return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHintFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#bina...
setHintFontSize(size?: number | string | Resource): Builder { this.popupOptions.hintFontSize = size return this }
https://github.com/wuba/omni-ui
2f9dabeddf1c42559f537b91a13eee00f77dad1a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
hasIndices
Gets the hasIndices flag, indicating whether to include indices of matching substrings. @return { boolean } `true` if indices are included in the match result, `false` otherwise. @syscap SystemCapability.Utils.Lang @FaAndStageModel
get hasIndices(): boolean { return this.isIndices }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left hasIndices 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 boolean AST#boolean#Rig...
get hasIndices(): boolean { return this.isIndices }
https://gitcode.com/iop123123/arkts-static-skills
c467d5cf104d8f894f83b1e43535d1feaa814b2d
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/GlobalDataManager.ets
arkts
setUserInfo
设置用户信息 @param userInfo 用户信息
async setUserInfo(userInfo: UserInfo): Promise<void> { this.userInfo = userInfo; this.isLoggedIn = true; await StorageUtil.saveUserInfo(userInfo); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setUserInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ...
async setUserInfo(userInfo: UserInfo): Promise<void> { this.userInfo = userInfo; this.isLoggedIn = true; await StorageUtil.saveUserInfo(userInfo); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
cf82b6d9d0e1877a8f853f2305e0a361bac67c25
github
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/subGattTest/gattClient.ets
arkts
string2ArrayBuffer
string to ArrayBuffer @param {*} str, the string object to @return: ArrayBuffer
function string2ArrayBuffer(str: string) { let array = new Uint8Array(str.length); for ( let i = 0 ; i < str.length ; i ++ ) { array[ i ] = str.charCodeAt(i); } return array.buffer }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left string2ArrayBuffer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left str AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function string2ArrayBuffer(str: string) { let array = new Uint8Array(str.length); for ( let i = 0 ; i < str.length ; i ++ ) { array[ i ] = str.charCodeAt(i); } return array.buffer }
https://gitee.com/openharmony/communication_bluetooth_service.git
441c5a5a7f3ba8d39543d94921f7054eb971da5d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Node.ets
arkts
remove
移除当前节点
remove(): Node { if (this.parentNode) { const children = this.parentNode.childNodes; const self = this; this.parentNode.childNodes = children.filter((child: Node): boolean => { return self !== child; }); this.parentNode = null; } return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left remove 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 Node AST#identifier#Right AST#ERROR#Right AST#statement...
remove(): Node { if (this.parentNode) { const children = this.parentNode.childNodes; const self = this; this.parentNode.childNodes = children.filter((child: Node): boolean => { return self !== child; }); this.parentNode = null; } return this; }
https://github.com/DaLongZhuaZi/manxia
695c3a47f72b93e2421410f0cf5c2093c611add5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/ReaderKitParser.ets
arkts
parse
解析电子书 注意:由于 Reader Kit API 在官方文档中信息有限,此处提供基础框架 实际使用时需要根据具体的 HarmonyOS 版本和 API 文档进行调整
public async parse(): Promise<EBook> { try { if (!isReaderKitEnabled()) { logger.warn(TAG, `Reader Kit disabled, fallback parser will be used: ${this.filePath}`); return this.parseFallback(); } logger.info(TAG, `开始使用 Reader Kit 解析电子书: ${this.filePath}, 格式: ${this.format}`); ...
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 parse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
public async parse(): Promise<EBook> { try { if (!isReaderKitEnabled()) { logger.warn(TAG, `Reader Kit disabled, fallback parser will be used: ${this.filePath}`); return this.parseFallback(); } logger.info(TAG, `开始使用 Reader Kit 解析电子书: ${this.filePath}, 格式: ${this.format}`); ...
https://github.com/DaLongZhuaZi/manxia
4708571f8c6da6b953a5d679a38d47acfbddd527
github
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/file/Files.ets
arkts
getLruListFilesArray
获取指定目录下的文件列表并按最近最少使用(LRU)策略排序 @param directory 要扫描的目录路径 @returns 返回排序后的文件路径数组,按修改时间升序排列(旧→新)
static getLruListFilesArray(directory: string): string[] { try { const files = fs.listFileSync(directory) || []; return files .map(file => `${directory}/${file}`) .sort((a, b) => { const aTime = fs.statSync(a).mtime; const bTime = fs.statSync(b).mtime; ret...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLruListFilesArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left directory AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
static getLruListFilesArray(directory: string): string[] { try { const files = fs.listFileSync(directory) || []; return files .map(file => `${directory}/${file}`) .sort((a, b) => { const aTime = fs.statSync(a).mtime; const bTime = fs.statSync(b).mtime; ret...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
1fe3f1262823a5f04b2e4a445714553decf935db
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/component/PlayerComponent/AudioTrackComponent.ets
arkts
shouldShowAv3aIcon
检查是否显示 AV3A 图标
shouldShowAv3aIcon(item: TrackType): boolean { if (this.isAudioTrack(item)) { const track = item as AudioTrack return track?.mime?.split('/')[1] === 'av3a' } return false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldShowAv3aIcon 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#)#...
shouldShowAv3aIcon(item: TrackType): boolean { if (this.isAudioTrack(item)) { const track = item as AudioTrack return track?.mime?.split('/')[1] === 'av3a' } return false }
https://github.com/Yebingiscn/SweetVideo
a1f7d8e04e70301996cef0b69e74d8c9358c6e1f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
getControllerFriendlyName
获取控制器友好名称
private getControllerFriendlyName(vendorId: number, productId: number): string { if (vendorId === VendorId.MICROSOFT) { return 'Xbox Controller'; } if (vendorId === VendorId.SONY) { if (productId === ProductId.DUALSENSE || productId === ProductId.DUALSENSE_EDGE) { return 'DualSense Con...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getControllerFriendlyName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left vendorId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left num...
private getControllerFriendlyName(vendorId: number, productId: number): string { if (vendorId === VendorId.MICROSOFT) { return 'Xbox Controller'; } if (vendorId === VendorId.SONY) { if (productId === ProductId.DUALSENSE || productId === ProductId.DUALSENSE_EDGE) { return 'DualSense Con...
https://github.com/AlkaidLab/moonlight-harmony
ede9e5b2883a305a758c9ef0ae90daaaa136af47
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets
arkts
byteOffset
byteOffset @returns { int } return the dateview's byteoffset @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get byteOffset(): int { return this.byteOffset_ }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left byteOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
public get byteOffset(): int { return this.byteOffset_ }
https://gitcode.com/iop123123/arkts-static-skills
67c97cc68c8f89519896e1fb7c8fcd70de84b445
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets
arkts
deleteRemoteBackup
删除云端备份
async deleteRemoteBackup(remoteBackupInfo: RemoteBackupInfo): Promise<void> { if (!this.client && !this.nativeClient) { const errorMsg = 'WebDAV未配置'; throw new Error(errorMsg); } try { const safeFileName = this.sanitizeBackupFileName(remoteBackupInfo.fileName); const safeRemotePat...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteRemoteBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remoteBackupInfo AST#ident...
async deleteRemoteBackup(remoteBackupInfo: RemoteBackupInfo): Promise<void> { if (!this.client && !this.nativeClient) { const errorMsg = 'WebDAV未配置'; throw new Error(errorMsg); } try { const safeFileName = this.sanitizeBackupFileName(remoteBackupInfo.fileName); const safeRemotePat...
https://github.com/DaLongZhuaZi/manxia
ba3a26e65883a989613eaf0c2b745deb239f3d5b
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/ThreadPaginationManager.ets
arkts
commitPrefetchedPrev
提交反向预取缓存,前置合并进 posts。 @returns 实际新增的帖子
commitPrefetchedPrev(): PostInfo[] { if (!this.isPrefetchedPrevReady()) return [] const added: PostInfo[] = this.prependPosts( this.prefetchedPrevPosts, this.prefetchedPrevPage ) this.prefetchedPrevPosts = [] this.prefetchedPrevPage = 0 return added }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left commitPrefetchedPrev 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 : AST#:#Right AST#identifier#Left PostInfo AST#identifier#Ri...
commitPrefetchedPrev(): PostInfo[] { if (!this.isPrefetchedPrevReady()) return [] const added: PostInfo[] = this.prependPosts( this.prefetchedPrevPosts, this.prefetchedPrevPage ) this.prefetchedPrevPosts = [] this.prefetchedPrevPage = 0 return added }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L194-L203
1875be7eef649ca4e08d4ef45451390db65ba98e
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/CheatManager.ets
arkts
toggleCheat
切换金手指启用状态并持久化
toggleCheat(gameCode: string, checksum: string, folderName: string, cheatName: string, enabled: boolean, folders: MergedCheatFolder[]): void { // 更新内存中的状态 for (const folder of folders) { if (folder.name === folderName) { for (const cheat of folder.cheats) { if (cheat.name === cheat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleCheat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gameCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R...
toggleCheat(gameCode: string, checksum: string, folderName: string, cheatName: string, enabled: boolean, folders: MergedCheatFolder[]): void { // 更新内存中的状态 for (const folder of folders) { if (folder.name === folderName) { for (const cheat of folder.cheats) { if (cheat.name === cheat...
https://github.com/richshaw2015/nds
065fe136591bd78f3dcd35d1dc6835beb3dbe3aa
github
aimilin6688/KeePassHO
entry/src/main/ets/services/otp/parsers/KeeTrayTotpParser.ets
arkts
parse
解析指定字段的 OTP 数据 @param fieldName 字段名称 @param fieldValue 字段值(TOTP Seed 的值) @param entry KeePass 条目 @returns OTPURL 数组
parse(fieldName: string, fieldValue: string, entry: KdbxEntry): string[] { if (!fieldValue) { return []; } // 解析配置(格式:30;6,表示步长和位数) const settings = this.getFieldValue(entry, 'TOTP Settings') || '30;6'; const parts = settings.split(';'); const period = parts[0] || '30'; const digits...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fieldName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left...
parse(fieldName: string, fieldValue: string, entry: KdbxEntry): string[] { if (!fieldValue) { return []; } // 解析配置(格式:30;6,表示步长和位数) const settings = this.getFieldValue(entry, 'TOTP Settings') || '30;6'; const parts = settings.split(';'); const period = parts[0] || '30'; const digits...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/parsers/KeeTrayTotpParser.ets#L33-L51
e89b0a8c620d0ebbbd19dbc6beda729ef385da57
github
openharmony-sig/applications_calculator
common/src/main/ets/util/DateUtil.ets
arkts
refreshLocalStr
Updates the internationalization object in the mobile phone cache.
public refreshLocalStr(): void { this.localStr = new Intl.Locale().toString(); this.relativeTimeFormat = new Intl.RelativeTimeFormat(this.localStr, { numeric: 'auto' }); this.today = this.relativeTimeFormat.format(0, 'day'); this.yesterday = this.relativeTimeFormat.format(-1, 'day'); this.monthDay...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left refreshLocalStr 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#expres...
public refreshLocalStr(): void { this.localStr = new Intl.Locale().toString(); this.relativeTimeFormat = new Intl.RelativeTimeFormat(this.localStr, { numeric: 'auto' }); this.today = this.relativeTimeFormat.format(0, 'day'); this.yesterday = this.relativeTimeFormat.format(-1, 'day'); this.monthDay...
https://gitee.com/openharmony-sig/applications_calculator.git
00256cc83a6b1b6588d2e18815a1480e5d82e7bb
gitee
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.ArcButton.ets
arkts
calculateDistance
计算两点间距离 @param point1 点1 @param point2 点2 @returns 距离
calculateDistance(point1: ArcButtonPoint, point2: ArcButtonPoint): number { return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left point1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArcButtonPoint AST#identifier#Right ...
calculateDistance(point1: ArcButtonPoint, point2: ArcButtonPoint): number { return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2)); }
https://gitcode.com/openharmony/arkui_ace_engine
b14f9986199741ba8036f414b4653d68632215c0
gitcode
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
markFormUrlEncoded
Mark a method as form url encoded
static markFormUrlEncoded(target: Object, propertyKey: string | symbol): void { this.defineMetadata('retrofit:isFormEncoded', true, target, propertyKey); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left markFormUrlEncoded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static markFormUrlEncoded(target: Object, propertyKey: string | symbol): void { this.defineMetadata('retrofit:isFormEncoded', true, target, propertyKey); }
https://github.com/killetom/ktretrofit
486fded492a86cea92949bc7f4cfa61d1618fd13
github
openharmony-sig/flutter_packages
packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/FileChooserParamsFlutterApiImpl.ets
arkts
create
Stores the FileChooserParams instance and notifies Dart to create a new FileChooserParams instance that is attached to this one.
create(instance: FileSelectorParam, callback: Reply<void>) { if (!this.instanceManager.containsInstance(instance)) { super.tCreate( this.instanceManager.addHostCreatedInstance(instance), instance.isCapture(), instance.getAcceptType(), this.toFileChooserEnumData(instance.getMo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FileSelectorParam AST#identifi...
create(instance: FileSelectorParam, callback: Reply<void>) { if (!this.instanceManager.containsInstance(instance)) { super.tCreate( this.instanceManager.addHostCreatedInstance(instance), instance.isCapture(), instance.getAcceptType(), this.toFileChooserEnumData(instance.getMo...
https://gitee.com/openharmony-sig/flutter_packages.git
c61aa3be09646a4b1972f5b67b87f428ca2c72fb
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test30_original_index.ets
arkts
describeValue
--- typeof type guard with narrowing ---
function describeValue(value: number | string): string { if (typeof value === 'number') { return 'num:' + String(value * 2); } return 'str:' + value; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left describeValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function describeValue(value: number | string): string { if (typeof value === 'number') { return 'num:' + String(value * 2); } return 'str:' + value; }
https://github.com/miaochiahao/ark-ghidra
ad3ee668c2a33ee0479c0cc4ccf6bd536764a350
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
filterEventsByAggregate
根据聚合类型获取事件列表 @param events 所有事件 @param aggregateType 聚合类型 @param aggregateId 聚合ID
static filterEventsByAggregate( events: DomainEvent[], aggregateType: string, aggregateId: number ): DomainEvent[] { const filtered: DomainEvent[] = []; for (let i = 0; i < events.length; i++) { const event = events[i]; if (event.aggregateType === aggregateType && event.aggregateId =...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left filterEventsByAggregate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left events AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr...
static filterEventsByAggregate( events: DomainEvent[], aggregateType: string, aggregateId: number ): DomainEvent[] { const filtered: DomainEvent[] = []; for (let i = 0; i < events.length; i++) { const event = events[i]; if (event.aggregateType === aggregateType && event.aggregateId =...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e193e289ea6afb1d4977e2e13867af662613dca5
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/StatisticsPage.ets
arkts
showDataTooltip
显示数据提示
showDataTooltip(date: string, income: number, expense: number) { this.tooltipDate = date; this.tooltipIncome = income; this.tooltipExpense = expense; this.tooltipBalance = income - expense; this.showTooltip = true; // 3秒后自动隐藏 setTimeout(() => { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showDataTooltip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Rig...
showDataTooltip(date: string, income: number, expense: number) { this.tooltipDate = date; this.tooltipIncome = income; this.tooltipExpense = expense; this.tooltipBalance = income - expense; this.showTooltip = true; // 3秒后自动隐藏 setTimeout(() => { ...
https://github.com/qiuhaotc/HarmonyOSPlayground
f7125e6b93409df9e7338df0c688088826e0446d
github
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
redirectDetailPage
redirect detail page. @param item List Information.
redirectDetailPage(item: ListItemData): void { let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + item.name; router.pushUrl({ url: CommonConstants.PAGE_DETAIL_URL, params: { key: contactsKey } }).catch((err: BusinessError) => { Logger.error(TAG, `pushUrl failed, erro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redirectDetailPage 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 ListItemData AST#identifier#Right AST...
redirectDetailPage(item: ListItemData): void { let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + item.name; router.pushUrl({ url: CommonConstants.PAGE_DETAIL_URL, params: { key: contactsKey } }).catch((err: BusinessError) => { Logger.error(TAG, `pushUrl failed, erro...
https://gitee.com/harmonyos/codelabs.git
decd9c5ff430a9797d718c76beffa6dd89745885
gitee
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsProcessor.ets
arkts
deleteRepeatReminders
删除重复的Reminder @param rdbStore RdbStore
async function deleteRepeatReminders(rdbStore: data_rdb.RdbStore) { Log.info(TAG, 'deleteRepeatReminders start.'); let arraysList: number[] = []; let predicates = new dataSharePredicates.DataSharePredicates(); try { let resultSet = await rdbStore.querySql(SINGLE_REMINDERS_SELECTOR); if (resultSet === nu...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left deleteRepeatReminders AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Rig...
async function deleteRepeatReminders(rdbStore: data_rdb.RdbStore) { Log.info(TAG, 'deleteRepeatReminders start.'); let arraysList: number[] = []; let predicates = new dataSharePredicates.DataSharePredicates(); try { let resultSet = await rdbStore.querySql(SINGLE_REMINDERS_SELECTOR); if (resultSet === nu...
https://gitee.com/openharmony/applications_calendar_data.git
459baac6076d83f7f90005baac93b3a78d061ed9
gitee
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.SegmentButtonV2.ets
arkts
<arrow>
todo number to int
(_: SegmentButtonV2Item, index: int) => this.itemRects.get(index)!
AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left _ AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left SegmentButtonV2Item AST#type_identifier#Right AST#t...
(_: SegmentButtonV2Item, index: int) => this.itemRects.get(index)!
https://gitcode.com/openharmony/arkui_ace_engine
8dab548a2bd8015ba67de1eaee92e7bdffeb6187
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/constants/GridRowColSetting.ets
arkts
getWindowColumn
获取窗口断点栅格数 @param bp @returns
public static getWindowColumn(bp: BreakpointNameEnum | string): number { return Reflect.get(GridRowColSetting.GRID_ROW_OPTIONS_COLUMNS, bp); }
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 getWindowColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AS...
public static getWindowColumn(bp: BreakpointNameEnum | string): number { return Reflect.get(GridRowColSetting.GRID_ROW_OPTIONS_COLUMNS, bp); }
https://github.com/xblLab/HarmonyProjectTemplate
65b462cb0ba3b4621360663f14dfbe48e79686a7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ThemeAware.ets
arkts
setThemeTransitioning
设置主题过渡状态
public setThemeTransitioning(transitioning: boolean): void { this.isThemeTransitioning = transitioning; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setThemeTransitioning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transitioning AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left bool...
public setThemeTransitioning(transitioning: boolean): void { this.isThemeTransitioning = transitioning; }
https://github.com/DaLongZhuaZi/manxia
ba0138aaab5540155b7da2dda04cec06f3e45675
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
sendMessageWithTools
发送消息并使用 Function Calling 工具
async sendMessageWithTools( content: string, providerId: string, providerType: ProviderType, apiStyle: ApiStyle, apiKey: string, baseUrl: string, modelId: string, modelName: string, messages: ChatMessage[], onUserMessageAdded: (message: ChatMessage) => void, onAIMessageAdde...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sendMessageWithTools AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#type_annotation#Left AST#...
async sendMessageWithTools( content: string, providerId: string, providerType: ProviderType, apiStyle: ApiStyle, apiKey: string, baseUrl: string, modelId: string, modelName: string, messages: ChatMessage[], onUserMessageAdded: (message: ChatMessage) => void, onAIMessageAdde...
https://github.com/LongLiveY96/chatcube
fc7585c7a2d49b3b783caca197c2f9cc1c747b9a
github
offlinecat-dev/OCNetORM
src/main/ets/query/WhereCondition.ets
arkts
between
创建 BETWEEN 条件 @param column 列名 @param min 最小值 @param max 最大值 @returns WhereCondition 实例
static between(column: string, min: ValueType, max: ValueType): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.BETWEEN condition.value = min condition.secondValue = max return condition }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left between AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static between(column: string, min: ValueType, max: ValueType): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.BETWEEN condition.value = min condition.secondValue = max return condition }
https://github.com/offlinecat-dev/OCNetORM
56f9bb37f495ae9c883d08e03bc561c3d719d23f
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/arkts/class/Function.ets
arkts
f4
允许在函数参数列表和调用时使用尾随逗号(这个逗号没有实际意义,只是为了可以方便地添加或删除参数)
function f4(x:number, y:number, ) { }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left f4 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predef...
function f4(x:number, y:number, ) { }
https://github.com/webabcd/HarmonyDemo
42a06eb1d20ac60094a4cce9d60e559aba9dd948
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
addToLibrary
添加漫画到库
public async addToLibrary(mangaId: string): Promise<boolean> { const query = ` mutation AddToLibrary($id: Int!) { updateManga(input: { id: $id, patch: { inLibrary: true } }) { manga { id inLibrary } } } `; const variables: UpdateManga...
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 addToLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async addToLibrary(mangaId: string): Promise<boolean> { const query = ` mutation AddToLibrary($id: Int!) { updateManga(input: { id: $id, patch: { inLibrary: true } }) { manga { id inLibrary } } } `; const variables: UpdateManga...
https://github.com/DaLongZhuaZi/manxia
359c37c3917927263adaa280dca4219d4b40fe29
github
openharmony/applications_contacts
entry/src/main/ets/feature/sim/SimManager.ets
arkts
recycle
recycle
public recycle() { if (this.supportSimCount > 1) { // support muti sim spn.unsubscribeSpnObserver(); } simCardState.removeSimChangeListener(); voLteState.removeVoLteListeners(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recycle 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#{...
public recycle() { if (this.supportSimCount > 1) { // support muti sim spn.unsubscribeSpnObserver(); } simCardState.removeSimChangeListener(); voLteState.removeVoLteListeners(); }
https://gitee.com/openharmony/applications_contacts.git
3136c1da7399413c0614262ebd0c833724503226
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
sortMangaList
对漫画列表进行排序
private sortMangaList(list: Manga[]): Manga[] { const sorted = list.slice(); switch (this.customShelfSortType) { case 'name_asc': return sorted.sort((a, b) => a.title.localeCompare(b.title, 'zh-CN')); case 'name_desc': return sorted.sort((a, b) => b.title.localeCompare(a.title, 'zh...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sortMangaList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
private sortMangaList(list: Manga[]): Manga[] { const sorted = list.slice(); switch (this.customShelfSortType) { case 'name_asc': return sorted.sort((a, b) => a.title.localeCompare(b.title, 'zh-CN')); case 'name_desc': return sorted.sort((a, b) => b.title.localeCompare(a.title, 'zh...
https://github.com/DaLongZhuaZi/manxia
6ce33449f41975b00c7c34bd2e41604f6e9a367e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
isCancelled
检查是否已取消
isCancelled(): boolean { return this._isCancelled; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCancelled 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 boolean AST#boolean#Right AST#ERROR#Right AST#stateme...
isCancelled(): boolean { return this._isCancelled; }
https://github.com/DaLongZhuaZi/manxia
2e9a938a3b89ea7832601b786f85cc88db0801d2
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/AccessibilityUtils.ets
arkts
generateHighContrastPair
生成高对比度颜色对 @param baseColor 基础颜色 @returns 颜色对(前景色和背景色)
public static generateHighContrastPair(baseColor: string): { foreground: string; background: string } { const isDark = this.isDarkColor(baseColor); return { foreground: isDark ? '#FFFFFF' : '#000000', background: baseColor }; }
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 generateHighContrastPair AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseColor AST#identifier#Right AST#ERROR#Left...
public static generateHighContrastPair(baseColor: string): { foreground: string; background: string } { const isDark = this.isDarkColor(baseColor); return { foreground: isDark ? '#FFFFFF' : '#000000', background: baseColor }; }
https://github.com/LJ666-ui/harmony-health-care
5b0fc68b5c9d31827694378cdb0bfb85c3803625
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/animation/PageTransitionDemo.ets
arkts
pageTransition
pageTransition() - 用于设置当前页面移入和移出时的转场动画 PageTransitionEnter() - 页面移入时的转场动画 delay - 动画的延迟播放时间(单位:毫秒) duration - 动画时长(单位:毫秒) curve - 动画曲线,即动画的缓动类型(参见 AnimationDemo.ets 中的说明) type - 触发 onEnter() 回调的类型(RouteType 枚举) Push - 页面移入是因为此页面被 push 了,则会调用 onEnter() 回调 Pop - 页面移入是因为其他页面被 pop 了,则会调用 onEnter() 回调 None - 以上两种情况都会调用 onEn...
pageTransition() { PageTransitionEnter({ delay: 0, duration: 1500, curve: Curve.Ease, type: RouteType.None }) // 根据移入动画进度,自定义当前的页面的状态 .onEnter((type: RouteType, progress: number) => { if (type == RouteType.Push || type == RouteType.Pop) { this.myScale = pr...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition 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#Lef...
pageTransition() { PageTransitionEnter({ delay: 0, duration: 1500, curve: Curve.Ease, type: RouteType.None }) // 根据移入动画进度,自定义当前的页面的状态 .onEnter((type: RouteType, progress: number) => { if (type == RouteType.Push || type == RouteType.Pop) { this.myScale = pr...
https://github.com/webabcd/HarmonyDemo
f21bcd4916e7498d48b962537d1467ca2766d9af
github
openharmony-tpc/ohos_coap
libcoap/src/main/ets/components/mainpage/CoapClient.ets
arkts
setObsSecond
客户端设置连接持续观察等待时间 @param obsSecond 持续观察等待时间
setObsSecond(obsSecond: number) { this.coapClient.setObsSecond(obsSecond, this.classId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setObsSecond AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left obsSecond AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST...
setObsSecond(obsSecond: number) { this.coapClient.setObsSecond(obsSecond, this.classId); }
https://gitee.com/openharmony-tpc/ohos_coap.git
ed54cb82014d7795d781e80210b6fcbda3583656
gitee
arkui-x/samples
CodeLab/Cases/feature/clickanimation/src/main/ets/model/BasicDataSource.ets
arkts
totalCount
获取数组长度
public totalCount(): number { return this.originDataArray.length; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left totalCount 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 totalCount(): number { return this.originDataArray.length; }
https://gitcode.com/arkui-x/samples
3d45300320aeeeca43bdc69972d0fe4ac055f350
gitcode
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
pause
Pause Playing.
pause() { if (this.avPlayer !== null) { this.avPlayer.pause(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pause 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#if_statement#Left AST#if#Left i...
pause() { if (this.avPlayer !== null) { this.avPlayer.pause(); } }
https://gitee.com/openharmony/codelabs.git
7448485afa91dd247d3f0a4ecb6b9ea6c848e3fb
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setClipValuesToContent
When enabled, the values will be clipped to contentRect, otherwise they can bleed outside the content rect. @param enabled
public setClipValuesToContent(enabled: boolean): void { this.mClipValuesToContent = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setClipValuesToContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
public setClipValuesToContent(enabled: boolean): void { this.mClipValuesToContent = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f20d085d1695d6aac97c14b4290fe1df1c7fa49e
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
getBytes
Gets the byte sequence that is representing the part of this string between begin and end indexes. The range is a half-interview [begin, end). @param begin index to start from @param end past the ending index @throws StringIndexOutOfBoundsException if begin is negative or >= length @throws StringIndexOutOfBoundsExcepti...
public getBytes(begin: int, end: int): byte[] { assert begin <= end: "Begin idx must be less then end idx"; let resChars: char[] = this.getChars(begin, end); let resBytes: byte[] = new byte[resChars.length]; for (let i: int = 0; i < resChars.length; i++) { resBytes[i] = r...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig...
public getBytes(begin: int, end: int): byte[] { assert begin <= end: "Begin idx must be less then end idx"; let resChars: char[] = this.getChars(begin, end); let resBytes: byte[] = new byte[resChars.length]; for (let i: int = 0; i < resChars.length; i++) { resBytes[i] = r...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5023689fffdf951d8f676b7eaa6646e59f54a5a2
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getElementType
Returns element type of this array @returns {Type} element type @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getElementType(): Type { return Type.resolve(this.elemTD, this.getContextLinker())! }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getElementType 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 Type AS...
public getElementType(): Type { return Type.resolve(this.elemTD, this.getContextLinker())! }
https://gitcode.com/iop123123/arkts-static-skills
d4758f66ebf0f90744397993d8769f27d587f69a
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
splice
Changes the contents of an array by removing or replacing existing elements and/or adding new elements in place. @param start index @param delete number of items after start index @returns an Array with deleted elements
public splice(start: number, delete: number): Array<T> { return this.splice(start as int, delete as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left splice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A...
public splice(start: number, delete: number): Array<T> { return this.splice(start as int, delete as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5f6a48dc468ae1a47de7763b7cedc00f357e3150
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
syncHosts
手动触发主机表同步
syncHosts(userId: string, callback?: () => void): void { if (!this.store) { return; } this.store.cloudSync( relationalStore.SyncMode.SYNC_MODE_TIME_FIRST, ['remotehosts'], (progress: Object) => { const pd = progress as Record<string, Object>; hilog.info(0x0001, 'CloudSync', ...
AST#program#Left AST#ERROR#Left AST#identifier#Left syncHosts AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#member...
syncHosts(userId: string, callback?: () => void): void { if (!this.store) { return; } this.store.cloudSync( relationalStore.SyncMode.SYNC_MODE_TIME_FIRST, ['remotehosts'], (progress: Object) => { const pd = progress as Record<string, Object>; hilog.info(0x0001, 'CloudSync', ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
f44eb99f4d7367c35b38d3a785ba0a7f1c278dbf
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ai/AIOrchestrator.ets
arkts
handleEmergency
处理紧急情况
private async handleEmergency(request: AIRequest): Promise<AIResponse> { console.warn(`[AI-Orch] ⚠️ 紧急情况处理!`); const emergencyType = request.data?.type || 'sos'; switch (emergencyType) { case 'fall_detected': return { success: true, voiceResponse: '检测到跌倒!正在通知紧急联系人并拨打急救电...
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 handleEmergency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Le...
private async handleEmergency(request: AIRequest): Promise<AIResponse> { console.warn(`[AI-Orch] ⚠️ 紧急情况处理!`); const emergencyType = request.data?.type || 'sos'; switch (emergencyType) { case 'fall_detected': return { success: true, voiceResponse: '检测到跌倒!正在通知紧急联系人并拨打急救电...
https://github.com/LJ666-ui/harmony-health-care
4a2b6a8698033163695e90b9049145ba818defb9
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
setNamespace
Sets the namespace for the current XML element. @param {string} prefix - The namespace prefix to be set. @param {string} namespace - The namespace URI associated with the prefix. @throws {BusinessError} Throws an error if the `prefix` or `name` parameter is an empty string.
public setNamespace(prefix: string, namespace: string): void { this.checkEmptyParameter(prefix); this.checkEmptyParameter(namespace); let stringBuilder = new StringBuilder(); if (this.type === XmlDynamicType.START_AND_ATTRIBUTES) { this.spliceName...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
public setNamespace(prefix: string, namespace: string): void { this.checkEmptyParameter(prefix); this.checkEmptyParameter(namespace); let stringBuilder = new StringBuilder(); if (this.type === XmlDynamicType.START_AND_ATTRIBUTES) { this.spliceName...
https://gitcode.com/iop123123/arkts-static-skills
8efac51f6c3848d158017ca4e49c2c1461029334
gitcode
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioRendererPlayer.ets
arkts
startTimeUpdate
启动时间更新定时器 @param intervalMs - 更新间隔(毫秒),默认 250ms @private
private startTimeUpdate(intervalMs: number = 250): void { this.stopTimeUpdate(); this.timeUpdateTimerId = setInterval(() => { if (this.decoder && this.onTimeUpdateCallback) { const position = this.decoder.getPosition(); this.onTimeUpdateCallback(position); } }, intervalMs); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startTimeUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left intervalMs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignm...
private startTimeUpdate(intervalMs: number = 250): void { this.stopTimeUpdate(); this.timeUpdateTimerId = setInterval(() => { if (this.decoder && this.onTimeUpdateCallback) { const position = this.decoder.getPosition(); this.onTimeUpdateCallback(position); } }, intervalMs); }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L373-L381
6ab0ef927b9ba447cac2a28b80b5958200c34771
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/component/OmniFilterGridGroup.ets
arkts
notifyObservers
通知所有观察者
notifyObservers() { this.observerList.forEach((observer) => observer()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left notifyObservers 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#Le...
notifyObservers() { this.observerList.forEach((observer) => observer()); }
https://github.com/wuba/omni-ui
1b100fce8b3c30d40efe3f2c061d99a122f9d0e9
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test25_original_index.ets
arkts
isString
--- Type predicate guard ---
function isString(val: Object): boolean { return typeof val === 'string'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left val AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function isString(val: Object): boolean { return typeof val === 'string'; }
https://github.com/miaochiahao/ark-ghidra
b29f1a1bd31a4b2383a2287f4cdd37caca554a8a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets
arkts
getDetail
获取书籍详情 @param volumeId Google Books Volume ID
public async getDetail(volumeId: string): Promise<ScraperDetailResult> { try { logger.info(TAG, `获取Google Books书籍详情: ${volumeId}`); let url = `${GoogleBooksScraper.BASE_URL}/volumes/${volumeId}`; if (this.config.apiKey) { url += `?key=${this.config.apiKey}`; } const ...
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 getDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left volumeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
public async getDetail(volumeId: string): Promise<ScraperDetailResult> { try { logger.info(TAG, `获取Google Books书籍详情: ${volumeId}`); let url = `${GoogleBooksScraper.BASE_URL}/volumes/${volumeId}`; if (this.config.apiKey) { url += `?key=${this.config.apiKey}`; } const ...
https://github.com/DaLongZhuaZi/manxia
5b470a8c773d36f0d8d435cc3aa55b7427355348
github
openharmony/base_location
services/location_ui/entry/src/main/ets/common/PermissionUtils.ets
arkts
checkBluetoothShareCallerSceneboardPermission
校验蓝牙分享UI ability调用方权限:大桌面应用允许作为调用方拉起
checkBluetoothShareCallerSceneboardPermission(want: Want): boolean { const callerBundleName = want?.parameters?.[this.WANT_PARA_KEY_CALLER_BUNDLE_NAME] as string; const callerUid = want?.parameters?.[this.WANT_PARA_KEY_CALLER_UID] as number; console.info(TAG, `checkSceneboardPermission calle...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkBluetoothShareCallerSceneboardPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#i...
checkBluetoothShareCallerSceneboardPermission(want: Want): boolean { const callerBundleName = want?.parameters?.[this.WANT_PARA_KEY_CALLER_BUNDLE_NAME] as string; const callerUid = want?.parameters?.[this.WANT_PARA_KEY_CALLER_UID] as number; console.info(TAG, `checkSceneboardPermission calle...
https://gitee.com/openharmony/base_location.git
49ee054b2dbbfcc2f6763a257900852ad6698a8a
gitee
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
arkts
onRequestSuccess
请求成功回调 @param {T} data - 成功数据 @returns {void} 无返回值
protected onRequestSuccess(data: T): void { this.data = data; this.setSuccessState(); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left onRequestSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#...
protected onRequestSuccess(data: T): void { this.data = data; this.setSuccessState(); }
https://github.com/Joker-x-dev/CoolMallArkTS
d2012c0d5ebb1fab9bd4ffabb42d25d37a72d943
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets
arkts
findByLegadoRule
使用 Legado 规则语法查询元素 支持: class.xxx, id.xxx, tag.xxx, text.xxx
findByLegadoRule(rule: string): HTMLElement[] { if (!this.root) return []; if (rule.startsWith('class.')) { const className = rule.substring(6); return this.root.querySelectorAll(`.${className}`); } else if (rule.startsWith('id.')) { const idName = rule.substring(3); const elem = ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left findByLegadoRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Ri...
findByLegadoRule(rule: string): HTMLElement[] { if (!this.root) return []; if (rule.startsWith('class.')) { const className = rule.substring(6); return this.root.querySelectorAll(`.${className}`); } else if (rule.startsWith('id.')) { const idName = rule.substring(3); const elem = ...
https://github.com/DaLongZhuaZi/manxia
58eda9f10b9772e73b44079d12fa29b0ac89a2ff
github
aimilin6688/KeePassHO
entry/src/main/ets/services/TypeDefined.ets
arkts
isKeyfileOnly
判断认证方式是否为仅密钥文件模式 @param authType 认证方式 @returns 是否为仅密钥文件模式
public static isKeyfileOnly(authType: AuthTypeInfo): boolean { if (!authType) { return false; } return authType.type === AuthType.KEYFILE.type; }
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 isKeyfileOnly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left authType AST#identifier#Right AST#:#Left ...
public static isKeyfileOnly(authType: AuthTypeInfo): boolean { if (!authType) { return false; } return authType.type === AuthType.KEYFILE.type; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TypeDefined.ets#L294-L299
1ecdced96873c969a418f165b224c917f08fa1ee
github
codelably/HCompass
packages/demo/src/main/ets/viewmodel/NetworkRequestViewModel.ets
arkts
requestGoodsList
发起 POST 请求(商品列表)
requestGoodsList() { const params: GoodsSearchRequest = new GoodsSearchRequest(); params.page = 1; params.size = 20; RequestHelper.from<NetworkPageData<Goods>>(this.repository.getGoodsPage(params)) .start((): void => { this.postLoading = true; }) .execute() .then((): vo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestGoodsList 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...
requestGoodsList() { const params: GoodsSearchRequest = new GoodsSearchRequest(); params.page = 1; params.size = 20; RequestHelper.from<NetworkPageData<Goods>>(this.repository.getGoodsPage(params)) .start((): void => { this.postLoading = true; }) .execute() .then((): vo...
https://github.com/codelably/HCompass
942adeb91d1a8481f8e24ec99f09b650fa89df77
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/SettingsUtil.ets
arkts
saveNurseInfo
保存护士信息
async saveNurseInfo(nurseInfo: object): Promise<void> { if (this.dataPreferences === null) { return; } try { const jsonStr: string = JSON.stringify(nurseInfo); await this.dataPreferences.put('nurse_info', jsonStr); await this.dataPreferences.flush(); } catch (e) { console...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveNurseInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nurseInfo AST#identifier#Right ...
async saveNurseInfo(nurseInfo: object): Promise<void> { if (this.dataPreferences === null) { return; } try { const jsonStr: string = JSON.stringify(nurseInfo); await this.dataPreferences.put('nurse_info', jsonStr); await this.dataPreferences.flush(); } catch (e) { console...
https://github.com/LJ666-ui/harmony-health-care
b635e0bdbae44120d48ccaf56e81a032cbb5c59e
github
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
deviceFound
Discover the device. @param data Device information.
deviceFound(data: DeviceInfoInterface): void { for (let i: number = 0; i < this.discoverList.length; i++) { if (this.discoverList[i].deviceId === data.device.deviceId) { Logger.info('RemoteDeviceModel', `deviceFound device exist=${JSON.stringify(data)}`); return; } } this.disco...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deviceFound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DeviceInfoInterface AST#identifier#Right AST...
deviceFound(data: DeviceInfoInterface): void { for (let i: number = 0; i < this.discoverList.length; i++) { if (this.discoverList[i].deviceId === data.device.deviceId) { Logger.info('RemoteDeviceModel', `deviceFound device exist=${JSON.stringify(data)}`); return; } } this.disco...
https://gitee.com/openharmony/codelabs.git
de1001be6fbcfc3d78860272e699ee7246208564
gitee
honjow/Next2V
shared/src/main/ets/utils/DateUtils.ets
arkts
toDateString
Convert Unix second timestamp to formatted date
static toDateString(unixSeconds: number): string { const date = new Date(unixSeconds * MS_PER_SECOND) const y = date.getFullYear() const m = String(date.getMonth() + 1).padStart(2, '0') const d = String(date.getDate()).padStart(2, '0') const h = String(date.getHours()).padStart(2, '0') const m...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toDateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left unixSeconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
static toDateString(unixSeconds: number): string { const date = new Date(unixSeconds * MS_PER_SECOND) const y = date.getFullYear() const m = String(date.getMonth() + 1).padStart(2, '0') const d = String(date.getDate()).padStart(2, '0') const h = String(date.getHours()).padStart(2, '0') const m...
https://github.com/honjow/Next2V
216bba17eb181988a7608ea0e0d918d0fa712785
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/models/HolidayCalendar.ets
arkts
isAdjustedWorkday
Returns true if the given month/day is an adjusted working day (调休, typically a weekend).
public isAdjustedWorkday(month: number, day: number): boolean { const key: string = `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}` return this.adjustedWorkdays.has(key) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAdjustedWorkday AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left month AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public isAdjustedWorkday(month: number, day: number): boolean { const key: string = `${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}` return this.adjustedWorkdays.has(key) }
https://github.com/OMGCA/sakipay
1e04a16d4308d7789bbcf47fa69b07bdc1e09fde
github
bhengubv/aether-protocol
arkts/src/main/ets/protocol/Ed25519Provider.ets
arkts
getPublicKey
The 32-byte public key derived from this signer's seed.
getPublicKey(): Uint8Array { return this.publicKey.slice(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPublicKey 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 Uint8Array AST#identifier#Right AST#ERROR#Right A...
getPublicKey(): Uint8Array { return this.publicKey.slice(); }
https://github.com/bhengubv/aether-protocol
a60a82fe4d2dea054f67e3d98c6c15aa54152e6a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/microphone/MicrophoneManager.ets
arkts
startMicrophone
启动麦克风
async startMicrophone(): Promise<boolean> { if (!this.microphoneStream) { if (!await this.initializeMicrophoneStream()) { return false; } } if (this.microphoneStream) { await this.microphoneStream.resume(); return true; } return false; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startMicrophone AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left...
async startMicrophone(): Promise<boolean> { if (!this.microphoneStream) { if (!await this.initializeMicrophoneStream()) { return false; } } if (this.microphoneStream) { await this.microphoneStream.resume(); return true; } return false; }
https://github.com/AlkaidLab/moonlight-harmony
5d19923d1fe57b2c2a71abab4eb9f226684e6cee
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
commons/componentuxexamplesbase/src/main/ets/model/BreakpointModel.ets
arkts
isMiddleScreen
Checks if the current device is considered a middle screen. A screen is considered middle if the width breakpoint is WIDTH_MD. @returns {boolean} True if the current screen is middle, false otherwise.
public isMiddleScreen(): boolean { return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_MD; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isMiddleScreen 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 boolean AS...
public isMiddleScreen(): boolean { return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_MD; }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
6e6a56a0e795a06f2ded5ea6cba6e4b7b407e01d
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/MyAbilityStage.ets
arkts
onMemoryLevel
内存占用级别发生变化时的回调 注:在 UIAbility 中也有此回调
onMemoryLevel(level: AbilityConstant.MemoryLevel): void { // MEMORY_LEVEL_MODERATE - 内存占用适中 // MEMORY_LEVEL_LOW - 内存占用低 // MEMORY_LEVEL_CRITICAL - 内存占用高 MyLog.d(`AbilityStage onMemoryLevel ${level}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMemoryLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left AbilityConstan...
onMemoryLevel(level: AbilityConstant.MemoryLevel): void { // MEMORY_LEVEL_MODERATE - 内存占用适中 // MEMORY_LEVEL_LOW - 内存占用低 // MEMORY_LEVEL_CRITICAL - 内存占用高 MyLog.d(`AbilityStage onMemoryLevel ${level}`); }
https://github.com/webabcd/HarmonyDemo
bfa8e432a7f73eb1e9e1ef120028af727b132081
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/db/MusicMemoryStore.ets
arkts
buildSongRow
Builds a {@link SongRow} with the given fields. @param id Song id. @param title Title string or resource. @param singer Artist string or resource. @param mark Badge resource. @param label Cover resource. @param src Asset file name or path. @param index List index. @param lyric Lyric file path.
private buildSongRow( id: number, title: string | Resource, singer: string | Resource, mark: Resource, label: Resource, src: string, index: number, lyric: string ): SongRow { const row = new SongRow(); row.id = id; row.title = title; row.singer = singer; row.mark ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildSongRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
private buildSongRow( id: number, title: string | Resource, singer: string | Resource, mark: Resource, label: Resource, src: string, index: number, lyric: string ): SongRow { const row = new SongRow(); row.id = id; row.title = title; row.singer = singer; row.mark ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
58e866a254236467a7cf8f720488b11256030543
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
loadCustomFonts
加载自定义字体列表
private async loadCustomFonts(): Promise<void> { if (!this.preferences) return; try { const fontsJson = await this.preferences.get('custom_fonts', '') as string; if (fontsJson) { this.customFonts = SafeUtils.parseArr(fontsJson) as CustomFont[]; logger.info(TAG, `加载了 ${this.customF...
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 loadCustomFonts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async loadCustomFonts(): Promise<void> { if (!this.preferences) return; try { const fontsJson = await this.preferences.get('custom_fonts', '') as string; if (fontsJson) { this.customFonts = SafeUtils.parseArr(fontsJson) as CustomFont[]; logger.info(TAG, `加载了 ${this.customF...
https://github.com/DaLongZhuaZi/manxia
4c59244fe6cf6d3c137cafd95a985e753db5356b
github
openharmony-sig/flutter_packages
packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets
arkts
takeVideoWithCamera
唤起相机录像
takeVideoWithCamera(options: VideoSelectionOptions, result: Result<ArrayList<string>>): void { if (!this.setPendingOptionsAndResult(null, options, result)) { this.finishWithAlreadyActiveError(result); return; } Log.i(ImagePickerDelegate.TAG, "launchTakeVideoWithCameraWant duration: " + option...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left takeVideoWithCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left VideoSelectionOptions AST#identif...
takeVideoWithCamera(options: VideoSelectionOptions, result: Result<ArrayList<string>>): void { if (!this.setPendingOptionsAndResult(null, options, result)) { this.finishWithAlreadyActiveError(result); return; } Log.i(ImagePickerDelegate.TAG, "launchTakeVideoWithCameraWant duration: " + option...
https://gitee.com/openharmony-sig/flutter_packages.git
e4be0af2752ce5d058573421fb9d587c41d54755
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
updateComicChapters
更新漫画章节列表
public async updateComicChapters(comicId: string, chapters: ChapterInfo[]): Promise<string[]> { try { const chapterData = chapters.map(chapter => { const chapterWithComicId: ChapterInfo = { id: chapter.id, comicId: comicId, title: chapter.title, index: chapter...
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 updateComicChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#L...
public async updateComicChapters(comicId: string, chapters: ChapterInfo[]): Promise<string[]> { try { const chapterData = chapters.map(chapter => { const chapterWithComicId: ChapterInfo = { id: chapter.id, comicId: comicId, title: chapter.title, index: chapter...
https://github.com/DaLongZhuaZi/manxia
f98b383324e52d7f16b0956278fbd080e0ed0bfc
github
wuba/omni-ui
omni_component/src/main/ets/components/calendar/OmniCalendar.ets
arkts
_isIconEnable
判断图标是否可用
_isIconEnable(isPre: boolean): boolean { if (isPre) { if (this.dateList[0].getFullYear() < this.minDate.getFullYear()) { return false; } if (this.dateList[0].getFullYear() == this.minDate.getFullYear()) { if (this.displayMode == DisplayMode.week) { if (this.dateList[0]....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left _isIconEnable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isPre AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left )...
_isIconEnable(isPre: boolean): boolean { if (isPre) { if (this.dateList[0].getFullYear() < this.minDate.getFullYear()) { return false; } if (this.dateList[0].getFullYear() == this.minDate.getFullYear()) { if (this.displayMode == DisplayMode.week) { if (this.dateList[0]....
https://github.com/wuba/omni-ui
7612ccb0a57da77aeeab475dfea49613b7f6f1ef
github
dingzhilin1990/zhilinclaw
src/skills/SkillRegistry.ets
arkts
matchSkills
根据输入匹配技能 @param input 用户输入
public matchSkills(input: string): Skill[] { const matched: Skill[] = []; this.skills.forEach(wrapper => { if (wrapper.skill.match(input)) { matched.push(wrapper.skill); } }); // 按触发器匹配度排序(更长的触发器优先) matched.sort((a, b) => { const aScore = Math.max(...a.metadata.triggers...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left matchSkills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
public matchSkills(input: string): Skill[] { const matched: Skill[] = []; this.skills.forEach(wrapper => { if (wrapper.skill.match(input)) { matched.push(wrapper.skill); } }); // 按触发器匹配度排序(更长的触发器优先) matched.sort((a, b) => { const aScore = Math.max(...a.metadata.triggers...
https://github.com/dingzhilin1990/zhilinclaw
bdfa7684dfcb80b02808d9c77c0c28fd9eecfd42
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
constructor
Constructs a new RegExp by other RegExp. It uses other RegExp's flags if flags aren't provided @param { RegExp } regexp other regexp @param { String } [flags] description of flags to be used @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(regexp: RegExp, flags?: String) { RegExp.init(this, regexp.pattern_, flags === undefined ? regexp.flags : flags!) }
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 regexp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Re...
public constructor(regexp: RegExp, flags?: String) { RegExp.init(this, regexp.pattern_, flags === undefined ? regexp.flags : flags!) }
https://gitcode.com/iop123123/arkts-static-skills
33e971f5ecae6b0b7ca75c0f04191211c0eb1a75
gitcode
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/empty/Empty.ets
arkts
build
构建缺省页视图 @returns {void} 无返回值
build(): void { Column() { IBestEmpty({ description: this.description, defaultBuilder: () => this.buildAction(), emptyImgBuilder: () => this.buildImage() }); } .width(P100) .height(P100) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center); ...
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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { Column() { IBestEmpty({ description: this.description, defaultBuilder: () => this.buildAction(), emptyImgBuilder: () => this.buildImage() }); } .width(P100) .height(P100) .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center); ...
https://github.com/Joker-x-dev/CoolMallArkTS
595df5f1402501a395cf6f99352e2b4ca1b03823
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/components/parts/Homepage/frame/MeowShortcuts.ets
arkts
getLabel
Get the item's label (name). @returns The label of the item.
getLabel() { this.refreshFlag; return `${this.item.isFolder ? (this.showingChildren ? '󰃛 ' : '󰃅 ') : ''}${this.item.title}`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLabel 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#expression_statement#Left AS...
getLabel() { this.refreshFlag; return `${this.item.isFolder ? (this.showingChildren ? '󰃛 ' : '󰃅 ') : ''}${this.item.title}`; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
269799abbbd1fba34095806921181aa5029b5da7
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
encrypt
加密明文 → 格式化密文 @param plaintext 明文字符串 @returns "1:base64(iv):base64(ciphertext+tag)" 格式的密文 加密明文 → 格式化密文 失败时抛出异常,绝不静默返回明文 @throws {Error} 加密失败或 DEK 未就绪
encrypt(plaintext: string): string { if (!this.ready || !this.dek) { throw new Error('[DataCrypto] encrypt: DEK 未就绪,请先解锁'); } if (!plaintext || plaintext.length === 0) { return plaintext; } try { // 1. 生成随机 IV (12 bytes) const iv = this.generateRandomSync(this.IV_LENGTH); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left encrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left plaintext AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ...
encrypt(plaintext: string): string { if (!this.ready || !this.dek) { throw new Error('[DataCrypto] encrypt: DEK 未就绪,请先解锁'); } if (!plaintext || plaintext.length === 0) { return plaintext; } try { // 1. 生成随机 IV (12 bytes) const iv = this.generateRandomSync(this.IV_LENGTH); ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
0fe1885f46b5d18b919b062df970d3f5eee9c825
github
erosTeam/NextE
shared/src/main/ets/network/EhApiService.ets
arkts
addUserTag
Add one new usertag (eros_fe actionNewUserTag: usertag_action=add).
async addUserTag(update: MyTagsAddUpdate): Promise<void> { const tagName: string = update.tagName.trim() if (tagName.length === 0) { throw new Error('mytags add: missing tag') } const base: string = EhConstants.baseUrl(update.isEx) const params: string[] = [] if (update.tagset.length > 0...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addUserTag AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left update AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async addUserTag(update: MyTagsAddUpdate): Promise<void> { const tagName: string = update.tagName.trim() if (tagName.length === 0) { throw new Error('mytags add: missing tag') } const base: string = EhConstants.baseUrl(update.isEx) const params: string[] = [] if (update.tagset.length > 0...
https://github.com/erosTeam/NextE
46f67a9c91e5feb3e680eec22771f3b7009fd253
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
writeUInt32BE
Writes an unsigned 32-bit integer to the buffer at the specified offset using big-endian format @param {long} value - Value to write @param {int} [offset=0] - Number of bytes to skip before writing @returns {int} Offset plus the number of bytes written
public writeUInt32BE(value: long, offset: int = 0): int { this.checkOffset(offset, 4); this.checkValue(value, 0, (Math.pow(2, 32).toLong() - 1), "0", (Math.pow(2, 32) - 1).toString()); this.getDataView().setUint32(offset, value, false); return offset + 4; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeUInt32BE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifi...
public writeUInt32BE(value: long, offset: int = 0): int { this.checkOffset(offset, 4); this.checkValue(value, 0, (Math.pow(2, 32).toLong() - 1), "0", (Math.pow(2, 32) - 1).toString()); this.getDataView().setUint32(offset, value, false); return offset + 4; ...
https://gitcode.com/iop123123/arkts-static-skills
a2b46e6ed9ff1d54311e72f16e5e1e5a4e500a48
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/ImageProcessing/JinmantiantangDescrambler.ets
arkts
getRows
根据章节ID和图片索引计算分割行数
private async getRows(aid: number, imgIndex: string): Promise<number> { const rules = this.getModulusRules(); // 根据章节ID确定模数 let modulus = 10; for (const rule of rules) { if (aid >= rule.minAid) { modulus = rule.modulus; break; } } // 计算分割行数 const hashCode = aw...
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 getRows AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aid AST#identifier#Right AST#:#Left : AST#:#R...
private async getRows(aid: number, imgIndex: string): Promise<number> { const rules = this.getModulusRules(); // 根据章节ID确定模数 let modulus = 10; for (const rule of rules) { if (aid >= rule.minAid) { modulus = rule.modulus; break; } } // 计算分割行数 const hashCode = aw...
https://github.com/DaLongZhuaZi/manxia
efc907c0b4f2d6e0aa297a4e9106674a64c7338e
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/SubtitleUtil.ets
arkts
parseAssFile
解析ASS文件
static async parseAssFile(filePath: string) { try { const parser = new ParseAss(filePath) const parserAdapter = new ParserAdapter<AssEvent>( async () => await parser.init(), async () => await parser.readEvents() ) const items = await SubtitleUtil.parseSubtitleFile<AssEvent>...
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 parseAssFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
static async parseAssFile(filePath: string) { try { const parser = new ParseAss(filePath) const parserAdapter = new ParserAdapter<AssEvent>( async () => await parser.init(), async () => await parser.readEvents() ) const items = await SubtitleUtil.parseSubtitleFile<AssEvent>...
https://github.com/Yebingiscn/SweetVideo
9c329945fcef331257a2dfca8f25fdc07b8a9939
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/MangaDataLoader.ets
arkts
loadOnlineChapterPages
加载在线章节的页面
private async loadOnlineChapterPages( chapter: OnlineChapter, manga: OnlineManga, cachedPages: PageInfo[] ): Promise<ChapterPagesLoadResult> { // 如果章节已下载,使用本地文件 if (chapter.downloadStatus === OnlineChapterDownloadStatus.DOWNLOADED) { logger.info(TAG, `章节已下载,使用本地文件: ${cachedPages.length}页`)...
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 loadOnlineChapterPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapter AST#identifier#Right A...
private async loadOnlineChapterPages( chapter: OnlineChapter, manga: OnlineManga, cachedPages: PageInfo[] ): Promise<ChapterPagesLoadResult> { // 如果章节已下载,使用本地文件 if (chapter.downloadStatus === OnlineChapterDownloadStatus.DOWNLOADED) { logger.info(TAG, `章节已下载,使用本地文件: ${cachedPages.length}页`)...
https://github.com/DaLongZhuaZi/manxia
5facf58f16c1a9497ffe1571992b8ab08d294985
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
onVMStatusChange
============================================================ 状态回调管理 ============================================================ 注册虚拟机状态变化回调
onVMStatusChange(vmId: string, callback: (status: string) => void) { this.vmStatusCallbacks.set(vmId, callback) }
AST#program#Left AST#ERROR#Left AST#identifier#Left onVMStatusChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#m...
onVMStatusChange(vmId: string, callback: (status: string) => void) { this.vmStatusCallbacks.set(vmId, callback) }
https://github.com/AetheriumSimulator/qemu-hmos
cc670c3a897d556f2edcfc62867119b9649b866b
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/PopupManager.ets
arkts
wrapShow
自定义显示,有外层包裹,可控制总体圆角等参数 @param config @param popupConfig @param builder @param args
async wrapShow<T extends object>(config: promptAction.BaseDialogOptions, popupConfig: PopupConfig, builder: WrappedBuilder<T[]>, args?: T) { try { const windowClass = await window.getLastWindow(getContext()) const uiContext = windowClass.getUIContext() let bean = new PopupBean(new CustomNode...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left wrapShow AST#identifier#Right AST#ERROR#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#constraint#Left AST#extends#Left extend...
async wrapShow<T extends object>(config: promptAction.BaseDialogOptions, popupConfig: PopupConfig, builder: WrappedBuilder<T[]>, args?: T) { try { const windowClass = await window.getLastWindow(getContext()) const uiContext = windowClass.getUIContext() let bean = new PopupBean(new CustomNode...
https://github.com/wuba/omni-ui
f48343edd92a24a2ee9d81b91df428c4e3486ceb
github
openharmony/applications_app_samples
code/BasicFeature/FileManagement/FileShare/SandboxShare/entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
0 indicates scrolling to the top of the list, 1 indicates scrolling to the middle of the list, and 2 indicates scrolling to the bottom of the list.
aboutToAppear() { this.fileFs.readyFilesToTestDir(this.filesDir); this.fileFs.readyFilesToCurDir(this.filesDir); }
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.fileFs.readyFilesToTestDir(this.filesDir); this.fileFs.readyFilesToCurDir(this.filesDir); }
https://github.com/openharmony/applications_app_samples
81f5acc09a9e5e4dd72fea652914763cbaaa28e1
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
updateComputer
更新电脑信息(用于配对成功后更新 serverCert 等) @param uuid 电脑 UUID @param updates 要更新的字段
async updateComputer(uuid: string, updates: Partial<ComputerInfo>): Promise<void> { const computer = this.computers.get(uuid); if (!computer) { console.warn(`ComputerManager: updateComputer 未找到电脑 ${uuid}`); return; } // 更新指定字段 if (updates.pairState !== undefined) { computer....
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateComputer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uuid AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async updateComputer(uuid: string, updates: Partial<ComputerInfo>): Promise<void> { const computer = this.computers.get(uuid); if (!computer) { console.warn(`ComputerManager: updateComputer 未找到电脑 ${uuid}`); return; } // 更新指定字段 if (updates.pairState !== undefined) { computer....
https://github.com/AlkaidLab/moonlight-harmony
5d6bda974810b663433060de7464344cdcb553cc
github
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/pages/StatisticsPage.ets
arkts
getControlPoints
生成贝塞尔曲线控制点
static getControlPoints(x1: number, y1: number, x2: number, y2: number, x3?: number, y3?: number): ControlPoints { const tension = 0.3; const d1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); const d2 = (x3 !== undefined && y3 !== undefined) ? Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getControlPoints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static getControlPoints(x1: number, y1: number, x2: number, y2: number, x3?: number, y3?: number): ControlPoints { const tension = 0.3; const d1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); const d2 = (x3 !== undefined && y3 !== undefined) ? Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, ...
https://gitcode.com/openharmony/codelabs
72881989ba385661b73168326b19367d361090c7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Network/ProxyManager.ets
arkts
getHttpsProxyUrl
获取HTTPS代理URL
getHttpsProxyUrl(): string | undefined { if (!this.config.enabled) { return undefined; } if (this.config.protocol === ProxyProtocol.SOCKS5) { const bridgePort = this.localBridge.getPort(); if (bridgePort > 0) { return `http://127.0.0.1:${bridgePort}`; } return undefin...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getHttpsProxyUrl 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 : AST#:#Right AST#stri...
getHttpsProxyUrl(): string | undefined { if (!this.config.enabled) { return undefined; } if (this.config.protocol === ProxyProtocol.SOCKS5) { const bridgePort = this.localBridge.getPort(); if (bridgePort > 0) { return `http://127.0.0.1:${bridgePort}`; } return undefin...
https://github.com/DaLongZhuaZi/manxia
ae9c55f091add53b94fb5f89d15589f47c9639b9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
isCompactLayout
判断是否是紧凑布局(手机竖屏)
public static isCompactLayout(): boolean { return ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint() === Breakpoint.XS; }
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 isCompactLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public static isCompactLayout(): boolean { return ResponsiveLayoutHelper.deviceManager.getCurrentBreakpoint() === Breakpoint.XS; }
https://github.com/DaLongZhuaZi/manxia
67e209f6d9e28b66702c83e6d2291528e94d0b87
github
LJ666-ui/harmony-health-care
entry/src/main/ets/coze/CozeApiClient.ets
arkts
consultOphthalmology
调用眼科智能体
async consultOphthalmology(eyeSymptoms: string, visionData?: object): Promise<string> { const prompt = `眼部症状:${eyeSymptoms} ${visionData ? `视力数据:${JSON.stringify(visionData)}` : ''} 请作为眼科专家进行分析: 1. 眼部问题初步判断 2. 视力状况评估 3. 用眼建议 4. 就医建议`; return this.sendMessage(prompt, 'ophthalmology_bot', this.getBotId('ophth...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left consultOphthalmology AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left eyeSymptoms AST#identifier#Right AST#type_annotation#Left ...
async consultOphthalmology(eyeSymptoms: string, visionData?: object): Promise<string> { const prompt = `眼部症状:${eyeSymptoms} ${visionData ? `视力数据:${JSON.stringify(visionData)}` : ''} 请作为眼科专家进行分析: 1. 眼部问题初步判断 2. 视力状况评估 3. 用眼建议 4. 就医建议`; return this.sendMessage(prompt, 'ophthalmology_bot', this.getBotId('ophth...
https://github.com/LJ666-ui/harmony-health-care
238395944358c1b81868f5cb1de75c1ec630a98d
github
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/components/AIChatPanel.ets
arkts
useQuickAction
使用快捷操作
useQuickAction(prompt: string) { this.inputText = prompt; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left useQuickAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prompt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Ri...
useQuickAction(prompt: string) { this.inputText = prompt; }
https://github.com/electronicminer/Harmony-Markdown-Editor
bfcf223b40229bd13a4d38016b1dd3ef55496c33
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
get
============================================================================ 设置读取 ============================================================================ 获取设置值 Requirements: 12.3, 12.5 @param key 设置键名 @param defaultValue 默认值(如果未提供,使用定义中的默认值) @returns 设置值
public async get<T extends SettingValue>(key: string, defaultValue?: T): Promise<T> { // 优先从缓存获取 if (this.settingsCache.has(key)) { return this.settingsCache.get(key) as T; } // 获取定义中的默认值 const definedDefault = getDefaultValue(key); const finalDefault = defaultValue !== undefined ? defa...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left get AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type_identifier#...
public async get<T extends SettingValue>(key: string, defaultValue?: T): Promise<T> { // 优先从缓存获取 if (this.settingsCache.has(key)) { return this.settingsCache.get(key) as T; } // 获取定义中的默认值 const definedDefault = getDefaultValue(key); const finalDefault = defaultValue !== undefined ? defa...
https://github.com/richshaw2015/nds
a96975e51a534f51c9d53cfc4f298142d32cf41f
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets
arkts
onSearchSubmit
搜索提交 @returns {void} 无返回值
onSearchSubmit(): void { this.onSearch(this.searchValue); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSearchSubmit 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...
onSearchSubmit(): void { this.onSearch(this.searchValue); }
https://github.com/Joker-x-dev/CoolMallArkTS
4a53cfc1a5a2ec4a9a36da48bb57745d9ff717af
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock.ets
arkts
generateDeviceStatus
生成设备状态
public generateDeviceStatus(deviceInfo: DeviceInfo): DeviceStatus { const properties: Map<string, any> = new Map(); switch (deviceInfo.deviceType) { case DeviceType.SMART_LIGHT: properties.set('brightness', { key: 'brightness', value: Math.floor(Math.random() * 100), unit: '%', min: 0, max: 100...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deviceInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public generateDeviceStatus(deviceInfo: DeviceInfo): DeviceStatus { const properties: Map<string, any> = new Map(); switch (deviceInfo.deviceType) { case DeviceType.SMART_LIGHT: properties.set('brightness', { key: 'brightness', value: Math.floor(Math.random() * 100), unit: '%', min: 0, max: 100...
https://github.com/LJ666-ui/harmony-health-care
69270b03e97bc6e5a1e3eaddc0f731d04cd8a1fd
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment9.ets
arkts
build
[Start usercard_list1]
build() { Stack() { this.renderChildren() } .width(this.descriptor.layoutMetrics.frame.size.width) .height(this.descriptor.layoutMetrics.frame.size.height) .backgroundColor(convertColorSegmentsToString(this.descriptor.props.backgroundColor)) .position({ y: this.descriptor.layoutMetrics.f...
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() { this.renderChildren() } .width(this.descriptor.layoutMetrics.frame.size.width) .height(this.descriptor.layoutMetrics.frame.size.height) .backgroundColor(convertColorSegmentsToString(this.descriptor.props.backgroundColor)) .position({ y: this.descriptor.layoutMetrics.f...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
d1eff0c63845e7ef4241b9461f57df3388b3724a
gitcode
OSpark-Team/Free-PCM
entry/src/main/ets/pages/components/FftSpectrum.ets
arkts
computeBars
Compute bars from latest FFT window. Call at ~30fps from UI/timer.
public computeBars(): void { if (this.ringFilled < this.fftSize) { return; } // gather latest fftSize samples into window (oldest->newest) const ringLen = this.ring.length; let start = this.ringWrite - this.fftSize; if (start < 0) start += ringLen; for (let i = 0; i < this.fftSize;...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left computeBars 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#Ri...
public computeBars(): void { if (this.ringFilled < this.fftSize) { return; } // gather latest fftSize samples into window (oldest->newest) const ringLen = this.ring.length; let start = this.ringWrite - this.fftSize; if (start < 0) start += ringLen; for (let i = 0; i < this.fftSize;...
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/entry/src/main/ets/pages/components/FftSpectrum.ets#L370-L472
62834615f38ba0c448b70ac8cb0bead667875fb3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
$_iterator
Iterator over object properties if jsonType == JsonType.JsonObject on type error `JsonTypeError` is raised @returns {IterableIterator<[string, JsonElement]>} An iterator over the object properties
$_iterator(): IterableIterator<[string, JsonElement]> { if (this.jsonType != JsonType.JsonObject) { throw new JsonTypeError("This value's ValueKind is not Object.") } return new JsonObjectIteratorEntries(this.maybeObjectValues!) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left $_iterator 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#instantiation_expression#Left AST#identifier#Left IterableIterator ...
$_iterator(): IterableIterator<[string, JsonElement]> { if (this.jsonType != JsonType.JsonObject) { throw new JsonTypeError("This value's ValueKind is not Object.") } return new JsonObjectIteratorEntries(this.maybeObjectValues!) }
https://gitcode.com/iop123123/arkts-static-skills
0a678c9b3c6ad02510a5b10d7e50ff5301028b3d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataConverter.ets
arkts
toDownloadStatus
转换状态字符串为DownloadStatus枚举 @param status - 状态字符串 @returns DownloadStatus枚举值
static toDownloadStatus(status: string | undefined | null): DownloadStatus { if (!status) { logger.warn(TAG, '下载状态值为空,使用默认值 pending'); return DownloadStatus.PENDING; } const normalizedStatus = status.toLowerCase().trim(); switch (normalizedStatus) { case 'pending': return Do...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toDownloadStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expres...
static toDownloadStatus(status: string | undefined | null): DownloadStatus { if (!status) { logger.warn(TAG, '下载状态值为空,使用默认值 pending'); return DownloadStatus.PENDING; } const normalizedStatus = status.toLowerCase().trim(); switch (normalizedStatus) { case 'pending': return Do...
https://github.com/DaLongZhuaZi/manxia
0390e95a7f74a8bd9b1c375c146da47ab890a4c6
github
openharmony/vendor_unionman
unionpi_tiger/sample_api11/app/ble_app/entry/src/main/ets/pages/Index.ets
arkts
foundDevices
搜索BLE蓝牙设备
foundDevices() { // BLE设备发现上报事件,data为蓝牙设备集合 bluetoothManager.BLE.on('BLEDeviceFind', (data) => { logger.info(TAG, `Begin to start foundDevices`) if (data !== null && data.length > 0) { // 创建临时存储BLE设备信息 let BleTmpInfo: BleFoundInformation = new BleFoundInformation() BleTmpIn...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left foundDevices 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 ...
foundDevices() { // BLE设备发现上报事件,data为蓝牙设备集合 bluetoothManager.BLE.on('BLEDeviceFind', (data) => { logger.info(TAG, `Begin to start foundDevices`) if (data !== null && data.length > 0) { // 创建临时存储BLE设备信息 let BleTmpInfo: BleFoundInformation = new BleFoundInformation() BleTmpIn...
https://gitee.com/openharmony/vendor_unionman.git
b35d559ca8acbb79e9d7e28aadd382cfa40177bb
gitee
richshaw2015/nds
ohos/entry/src/test/BiosValidatorProperty.test.ets
arkts
checkFileMock
Mock checkFile - replicates BiosValidator.checkFile logic exactly, but reads from mockFs instead of fileIo.statSync.
function checkFileMock(filePath: string, fileName: string, expectedSizes: number[]): BiosFileResult { const entry = mockFs[filePath]; if (!entry || !entry.exists) { return { fileName, status: BiosFileStatus.MISSING }; } if (!entry.isFile) { return { fileName, status: BiosFileStatus.MISSING }; } // N...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkFileMock AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function checkFileMock(filePath: string, fileName: string, expectedSizes: number[]): BiosFileResult { const entry = mockFs[filePath]; if (!entry || !entry.exists) { return { fileName, status: BiosFileStatus.MISSING }; } if (!entry.isFile) { return { fileName, status: BiosFileStatus.MISSING }; } // N...
https://github.com/richshaw2015/nds
af8a5ad8ffd985f7bdc369225d5aa9cca12efe11
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
interceptForMouseEmulation
手柄状态拦截:鼠标模拟时委托给 MouseEmulationService @returns true 表示已拦截(鼠标模拟模式),false 表示正常手柄处理
private interceptForMouseEmulation(slot: number, state: GamepadState): boolean { return this.mouseEmulationService.intercept(state, () => { if (this.listener) { this.listener.onGamepadInput(slot, this.createEmptyState()); } }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left interceptForMouseEmulation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slot AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private interceptForMouseEmulation(slot: number, state: GamepadState): boolean { return this.mouseEmulationService.intercept(state, () => { if (this.listener) { this.listener.onGamepadInput(slot, this.createEmptyState()); } }); }
https://github.com/AlkaidLab/moonlight-harmony
cf095b5514b4873f37995f0e9f04b9a2eb8a60c6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array-like or iterable object. @param { ArrayLike<T> } arrayLike - An array-like or iterable object to convert to an array. @param { function } mapfn - A mapping function to call on every element of the array. @returns { Float32Array } - A new Float32Array @static @syscap SystemCapability.Utils...
public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Float32Array { let res = new Float32Array(arrayLike.length) // NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by un...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_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#<#Left < AST#<#Right AST#identifier#Left T AST#identif...
public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Float32Array { let res = new Float32Array(arrayLike.length) // NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by un...
https://gitcode.com/iop123123/arkts-static-skills
f43c171f6215f597c61aae81e4ad9a91c0db79a2
gitcode