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
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
setGameVibration
设置串流游戏震动 @param enabled 是否启用串流游戏震动反馈 @param strength 串流游戏震动强度 (0-200, 100=原始强度) @param mode 震动模式:自动/仅手柄/仅设备/同时
setGameVibration( enabled: boolean, strength: number, mode: string ): void { this.vibrationService.setSettings(enabled, strength, mode); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setGameVibration 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#identifier#Left boolean AST#identifier#Right AST#,#L...
setGameVibration( enabled: boolean, strength: number, mode: string ): void { this.vibrationService.setSettings(enabled, strength, mode); }
https://github.com/AlkaidLab/moonlight-harmony
1016a8874c44d79743ef585943f1813effed0646
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/bean/Conversation.ets
arkts
toObject
Convert to plain object.
toObject(): IConversation { return { conversationId: this.conversationId, otherUsername: this.otherUsername, lastMessage: this.lastMessage, lastMessageTime: this.lastMessageTime, unreadCount: this.unreadCount }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toObject 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 IConversation AST#identifier#Right AST#ERROR#Right AS...
toObject(): IConversation { return { conversationId: this.conversationId, otherUsername: this.otherUsername, lastMessage: this.lastMessage, lastMessageTime: this.lastMessageTime, unreadCount: this.unreadCount }; }
https://github.com/Harrisonls2004/WaterFlow
2f32a4e23dbb3b35906753203b2b2dcc59b228cb
github
OHPG/FinSdk
emby/src/main/ets/api/UserApi.ets
arkts
getPublicUsers
getPublicUsers @summary Gets a list of publicly visible users for display on a login screen. @throws {RequiredError} @memberof UserApi
public async getPublicUsers(): Promise<Array<UserDto>> { return this.apiClient.get({ path: "/Users/Public" }) }
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 getPublicUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async getPublicUsers(): Promise<Array<UserDto>> { return this.apiClient.get({ path: "/Users/Public" }) }
https://github.com/OHPG/FinSdk
78a68cdd8e6464208f4111930ca67edaf44661bd
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets
arkts
onStartExecution
Register a callback and call it before the task execution @param { CallbackFunction } callback Callback to be registered and executed before the task execution @throws Error if task is executed. It does not support the registration of listeners
onStartExecution(callback: CallbackFunction): void { this.throwIfCallbackCannotBeAdded(); InternalTask.of(this).onStartCallback = callback; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onStartExecution AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CallbackFunction AST#identifier#Rig...
onStartExecution(callback: CallbackFunction): void { this.throwIfCallbackCannotBeAdded(); InternalTask.of(this).onStartCallback = callback; }
https://gitcode.com/iop123123/arkts-static-skills
30d244177fff5ee8d40d3c54c812bf83f7b28ba5
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WordPackCache.ets
arkts
read
Returns just the pack body (envelope or bare). Empty string when the slot is empty, the value can't be parsed, or the parsed body doesn't have a `words` array.
async read(): Promise<string> { if (this.prefs === undefined) { return ''; } const raw: string = await this.prefs.getString(PACK_KEY); if (raw.length === 0) { return ''; } const env: WordPackCacheRecord | undefined = WordPackCache.tryParseEnvelope(raw); if (env !== undefined) {...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left read AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left...
async read(): Promise<string> { if (this.prefs === undefined) { return ''; } const raw: string = await this.prefs.getString(PACK_KEY); if (raw.length === 0) { return ''; } const env: WordPackCacheRecord | undefined = WordPackCache.tryParseEnvelope(raw); if (env !== undefined) {...
https://github.com/terryma2024/happyword
3c8f1d9f1c5f2f184bacb25190afdc455c45f4ae
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/database/PrivacyNoteDB.ets
arkts
query
查询 @param id @returns 列表
async query(id?: number) { const store = await this.getStoreInstance() const predicates = new relationalStore.RdbPredicates(this.tableName) // 倒序排列 predicates.orderByDesc('id') // 如果有 id,添加 id 作为查询条件 if (id) { predicates.equalTo('id', id) } const resultSet = await store.query(pre...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left id AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_annotation#Left...
async query(id?: number) { const store = await this.getStoreInstance() const predicates = new relationalStore.RdbPredicates(this.tableName) // 倒序排列 predicates.orderByDesc('id') // 如果有 id,添加 id 作为查询条件 if (id) { predicates.equalTo('id', id) } const resultSet = await store.query(pre...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
331c8c3b0154b31191220cf7f72e1e1b739b588d
gitcode
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateRoll
滚动振动 — 渐强短振序列,模拟骰子滚动/转盘旋转
static vibrateRoll(): void { VibratorManager.logExecution('vibrateRoll'); VibratorManager.vibratePattern([40, 30, 55, 30, 70, 30, 90, 30, 110], 1, VibrationUsage.PHYSICAL_FEEDBACK); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateRoll 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...
static vibrateRoll(): void { VibratorManager.logExecution('vibrateRoll'); VibratorManager.vibratePattern([40, 30, 55, 30, 70, 30, 90, 30, 110], 1, VibrationUsage.PHYSICAL_FEEDBACK); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
409b25f2a6fec274779414b0d7de9fa4fe2b9298
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/XmlUtil.ets
arkts
getValue
从 XML 中获取指定标签的值 @param xml XML 字符串 @param tag 标签名 @param required 是否必需(如果为 true 且未找到则抛出异常) @returns 标签值,未找到返回空字符串
static getValue(xml: string, tag: string, required: boolean = false): string { const regex = new RegExp(`<${tag}>(.*?)</${tag}>`, 's'); const match = xml.match(regex); const value = match ? match[1].trim() : ''; if (required && !value) { throw new Error(`XML 中未找到必需的标签: ${tag}`); } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xml AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A...
static getValue(xml: string, tag: string, required: boolean = false): string { const regex = new RegExp(`<${tag}>(.*?)</${tag}>`, 's'); const match = xml.match(regex); const value = match ? match[1].trim() : ''; if (required && !value) { throw new Error(`XML 中未找到必需的标签: ${tag}`); } ...
https://github.com/AlkaidLab/moonlight-harmony
f3095f435bf575a960fd8fc2aae5085bfa1f0138
github
openharmony-sig/ohos_highlightguide
library/src/main/ets/highlightguide/core/Controller.ets
arkts
showPage
设置要显示的引导页页数 @param position 引导页的index,index 从0开始
public showPage(position: number): void { if (!this.isShowing()) { hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'The component is not showing.'); return; } if (this.animationRunning) { hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'The component animation is runn...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left showPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
public showPage(position: number): void { if (!this.isShowing()) { hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'The component is not showing.'); return; } if (this.animationRunning) { hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'The component animation is runn...
https://gitee.com/openharmony-sig/ohos_highlightguide.git
0c84b165a71b0d561d64c3b14cafc105036f722b
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets
arkts
updateToken
更新OAuth2令牌 @param token 新的令牌信息 @param config 存储配置
public async updateToken(token: OAuth2Token, config: OAuth2TokenStorageConfig): Promise<void> { await this.saveToken(token, config); hilog.info(DOMAIN, TAG, `Token updated for provider: ${config.provider}`); }
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 updateToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#...
public async updateToken(token: OAuth2Token, config: OAuth2TokenStorageConfig): Promise<void> { await this.saveToken(token, config); hilog.info(DOMAIN, TAG, `Token updated for provider: ${config.provider}`); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets#L167-L170
30c8745f50a28f8d7b4bd7bcc0843d406e346aa2
github
openharmony-sig/knowledge_demo_entainment
FA/BombGame/entry/src/main/ets/MainAbility/pages/game.ets
arkts
getRandomDeviceId
随机获取在线设备id
getRandomDeviceId(): string{ let onlineDeviceList = this.deviceList.filter(item => item.status == RemoteDeviceStatus.ONLINE) let randomIndex = Math.floor(Math.random() * onlineDeviceList.length) let deviceId = onlineDeviceList[randomIndex].deviceId CommonLog.info("getRandomDeviceId deviceId = " + deviceId) r...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRandomDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stat...
getRandomDeviceId(): string{ let onlineDeviceList = this.deviceList.filter(item => item.status == RemoteDeviceStatus.ONLINE) let randomIndex = Math.floor(Math.random() * onlineDeviceList.length) let deviceId = onlineDeviceList[randomIndex].deviceId CommonLog.info("getRandomDeviceId deviceId = " + deviceId) r...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
0c8a092cb692349e88874ad7c4e8005a556b918e
gitee
openharmony/codelabs
ETSUI/MediaReview/entry/src/main/ets/utils/RdbUtil.ets
arkts
registerUser
用户:注册/登录/当前用户维护
static async registerUser(context: Context, name: string, password: string, avatarKey: string): Promise<boolean> { const n = name.trim() if (n.length <= 0) return false if (password.length <= 0) return false if (RdbUtil.userMemory.has(n)) { return false } let rs: relationalStore.Result...
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 registerUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : A...
static async registerUser(context: Context, name: string, password: string, avatarKey: string): Promise<boolean> { const n = name.trim() if (n.length <= 0) return false if (password.length <= 0) return false if (RdbUtil.userMemory.has(n)) { return false } let rs: relationalStore.Result...
https://gitcode.com/openharmony/codelabs
0726ccd0425cec91af14664d8304bac48168e082
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
setMotionEventState
启用/禁用指定类型的传感器 @param motionType LI_MOTION_TYPE_ACCEL 或 LI_MOTION_TYPE_GYRO @param reportRateHz 上报频率,0 表示停止
setMotionEventState(motionType: number, reportRateHz: number): void { if (motionType === LI_MOTION_TYPE_GYRO) { this.setGyroState(reportRateHz); } else if (motionType === LI_MOTION_TYPE_ACCEL) { this.setAccelState(reportRateHz); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMotionEventState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left motionType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left...
setMotionEventState(motionType: number, reportRateHz: number): void { if (motionType === LI_MOTION_TYPE_GYRO) { this.setGyroState(reportRateHz); } else if (motionType === LI_MOTION_TYPE_ACCEL) { this.setAccelState(reportRateHz); } }
https://github.com/AlkaidLab/moonlight-harmony
a8d171e222720b9dde732da00b708e2014e640b9
github
fluttercandies/flutter_image_editor
image_editor_ohos/ohos/src/main/ets/components/plugin/util/ImageUtils.ets
arkts
parseExifRotate
1 上 左 0° 2 上 右 水平翻转 3 下 右 180° 4 下 左 垂直翻转 5 左 上 顺时针90°+水平翻转 6 右 上 顺时针90° 7 右 下 顺时针90°+垂直翻转 8 左 下 逆时针90°
static parseExifRotate(orientation: string): number { orientation = orientation.toLowerCase(); switch (orientation) { // 1 上 左 0° case 'top-left': return 0; // 2 上 右 水平翻转 case 'top-right': return 0; // 3 下 右 180° case 'bottom-right': return 180; // 4 下...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseExifRotate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orientation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
static parseExifRotate(orientation: string): number { orientation = orientation.toLowerCase(); switch (orientation) { // 1 上 左 0° case 'top-left': return 0; // 2 上 右 水平翻转 case 'top-right': return 0; // 3 下 右 180° case 'bottom-right': return 180; // 4 下...
https://github.com/fluttercandies/flutter_image_editor
2318d176712abc8f98c5cfb717e07c45fe569bc8
github
XHXYT/Pixark
entry/src/main/ets/common/utils/ResourceUtil.ets
arkts
getString
将 Resource | string | number | undefined 转换为可读的字符串 @param resource 资源、字符串、数值 @returns 解析后的字符串,失败返回空字符串 ""
getString(resource: Resource | string | number | undefined): string { if (!resource) return ''; if (typeof resource === 'string') return resource; if (typeof resource === 'number') return resource.toString() const ctx = this.ensureContext(); if (!resource.id) return ''; try { return ct...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left AST#bina...
getString(resource: Resource | string | number | undefined): string { if (!resource) return ''; if (typeof resource === 'string') return resource; if (typeof resource === 'number') return resource.toString() const ctx = this.ensureContext(); if (!resource.id) return ''; try { return ct...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/ResourceUtil.ets#L33-L47
cc9a16c1e16b80905194ed91fb312dce5eb599f3
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
navigateBack
页面返回聚合方法 @param opts
public navigateBack(opts: IPopOptions = { animated: true, toRoot: false }) { if (ObjectUtil.isEmpty(opts.name) && ObjectUtil.isNull(opts.result) && ObjectUtil.isFalse(opts.toRoot)) { // 返回上一页 this.pop(opts.animated) } else if (ObjectUtil.isTrue(opts.toRoot)) { // 返回根视图 即Navigation页面 th...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left navigateBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left opts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressi...
public navigateBack(opts: IPopOptions = { animated: true, toRoot: false }) { if (ObjectUtil.isEmpty(opts.name) && ObjectUtil.isNull(opts.result) && ObjectUtil.isFalse(opts.toRoot)) { // 返回上一页 this.pop(opts.animated) } else if (ObjectUtil.isTrue(opts.toRoot)) { // 返回根视图 即Navigation页面 th...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L370-L387
cba9b2a272829ff7605c5e35915151631b48ce99
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
getCancelReason
获取取消原因
getCancelReason(): string { return this._cancelReason; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCancelReason AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem...
getCancelReason(): string { return this._cancelReason; }
https://github.com/DaLongZhuaZi/manxia
263cde24bc5f11026bd894dd4ddf1b9832acb328
github
openharmony/applications_call
entry/src/main/ets/common/components/FuncBtnGroup.ets
arkts
btnClick
Display the buttons of the button group @param {Object} obj - object
btnClick(obj) { LogUtils.i(TAG, 'btnClick get icon type : ' + JSON.stringify(obj)); const btnName = ['record', 'video', 'mute']; const type = obj.type; const { callId } = this.callData; if (Method.includes(btnName, type)) { this.btnList.forEach((item) => { if (item.type === type) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left btnClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left obj AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_...
btnClick(obj) { LogUtils.i(TAG, 'btnClick get icon type : ' + JSON.stringify(obj)); const btnName = ['record', 'video', 'mute']; const type = obj.type; const { callId } = this.callData; if (Method.includes(btnName, type)) { this.btnList.forEach((item) => { if (item.type === type) { ...
https://gitee.com/openharmony/applications_call.git
116901cbf18d32ca1db9f0b8d23067af80957e51
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitEnum
========== 枚举字段 ========== 访问 enum 字段 JSON: number (可选:也可以是 string 枚举名)
visitEnum(value: number, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitEnum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#...
visitEnum(value: number, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
c24adb5a9f77e6fdaa1d6a007d5293796ba8d490
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedFixed64
访问 repeated fixed64 字段
visitRepeatedFixed64(value: bigint[], fieldNumber: number): void { for (const item of value) { this.visitFixed64(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedFixed64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left bigi...
visitRepeatedFixed64(value: bigint[], fieldNumber: number): void { for (const item of value) { this.visitFixed64(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
90c6d059f27e0bfc0e1366521da9eb852979fc86
gitcode
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/InputLayoutRepository.ets
arkts
localizeButtonLabel
Migrate older English labels (UP / DOWN / LEFT / RIGHT / SELECT / START) saved in input_layout.json from previous builds. Single-character keys (A/B/L/R) and already-Chinese labels are preserved as-is. This keeps existing saved layouts readable on the narrow 48px D-pad cells without forcing the user to reset.
function localizeButtonLabel(buttonId: string, rawLabel: string): string { const upper = rawLabel.trim().toUpperCase() if (buttonId === 'up' && (upper === 'UP' || upper === 'U')) { return '上' } if (buttonId === 'down' && (upper === 'DOWN' || upper === 'D')) { return '下' } if (buttonId === 'left' && ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left localizeButtonLabel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buttonId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function localizeButtonLabel(buttonId: string, rawLabel: string): string { const upper = rawLabel.trim().toUpperCase() if (buttonId === 'up' && (upper === 'UP' || upper === 'U')) { return '上' } if (buttonId === 'down' && (upper === 'DOWN' || upper === 'D')) { return '下' } if (buttonId === 'left' && ...
https://github.com/daugf2527/harmonyos-libretro-emulator
316641eeacd12a47f1641a2f95daaec566ba4463
github
azhu0001/localsend-harmony
entry/src/main/ets/eventbus/EventBus.ets
arkts
unregister
取消针对该事件ID的订阅,传入可选参数callback,并且该callback已经通过on或者once接口订阅,则取消该订阅;否则,不做任何处理。
unregister(name: number) { emitter.off(name) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS...
unregister(name: number) { emitter.off(name) }
https://gitcode.com/azhu0001/localsend-harmony
20a0a50512c8a32ad5da0a166a343d24594ea12f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
some
Checks that at least one element of BigUint64Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: BigInt, index: int) => boolean): boolean { let newF: (element: BigInt, index: int, array: BigUint64Array) => boolean = (element: BigInt, index: int, array: BigUint64Array): boolean => { return fn(element, index) } return this.some(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: BigInt, index: int) => boolean): boolean { let newF: (element: BigInt, index: int, array: BigUint64Array) => boolean = (element: BigInt, index: int, array: BigUint64Array): boolean => { return fn(element, index) } return this.some(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f512328e2757a599184b47845619bb2cf3ecdce2
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/PaginatedResult.ets
arkts
hasNextPage
检查是否有下一页 @returns 是否有下一页
hasNextPage(): boolean { return this.page < this.totalPages }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasNextPage 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...
hasNextPage(): boolean { return this.page < this.totalPages }
https://github.com/offlinecat-dev/OCNetORM
7cf86b9da247bacfac4d1dce5edf7a24f0061ee2
github
XJTUWYD/ArkDiff
entry/src/main/ets/utils/ThemeColors.ets
arkts
setMonokai
设置 Monokai 主题
setMonokai(enable: boolean): void { this._isMonokai = enable; this._darkMode = false; this._cached = null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMonokai AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) A...
setMonokai(enable: boolean): void { this._isMonokai = enable; this._darkMode = false; this._cached = null; }
https://github.com/XJTUWYD/ArkDiff
1713ed5394348601a03b8811ccc75c7262f70652
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
cornerRadius
获取组件圆角大小
static get cornerRadius(): number { try { const themeManager = ThemeManager.getInstance(); return themeManager.getUserCornerRadius(); } catch { return 12; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left cornerRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
static get cornerRadius(): number { try { const themeManager = ThemeManager.getInstance(); return themeManager.getUserCornerRadius(); } catch { return 12; } }
https://github.com/DaLongZhuaZi/manxia
e99593c8f0995dd190dc51702f7fdec81ff624ed
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
saveDatabase
保存数据库 @returns 结果信息
public static saveDatabase(callback?: SaveDatabaseCallback): void { KdbxUtils.customIconMap.clear(); KdbxSaveService.saveDatabase(callback ?? new ToastSaveDatabaseCallback()); }
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 saveDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#?#Left ?...
public static saveDatabase(callback?: SaveDatabaseCallback): void { KdbxUtils.customIconMap.clear(); KdbxSaveService.saveDatabase(callback ?? new ToastSaveDatabaseCallback()); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L576-L579
05eb98bbd0317b0244ca9c903ee00a291ff10090
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setXAxisRenderer
Sets a custom XAxisRenderer and overrides the existing (default) one. @param xAxisRenderer
public setXAxisRenderer(xAxisRenderer: XAxisRenderer): void { this.mXAxisRenderer = xAxisRenderer; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setXAxisRenderer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xAxisRenderer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
public setXAxisRenderer(xAxisRenderer: XAxisRenderer): void { this.mXAxisRenderer = xAxisRenderer; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
3c9bfa8524f8e3ba2e8d963300304a8ba4976327
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
isCounting
引擎是否正在运行计时中
get isCounting(): boolean { return this.timerId !== -1; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isCounting 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 isCounting(): boolean { return this.timerId !== -1; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L246-L248
7068b5bcd32c3275385e053fdd27c54be6e1cfc8
github
azhu0001/localsend-harmony
entry/src/main/ets/utils/FileProvider.ets
arkts
setTransferringNowSessionId
设置当前正在传输文件的sessionId @param sessionId
static setTransferringNowSessionId(sessionId: string | undefined) { AppStorage.setOrCreate(Keys.CURRENTLY_RECEIVING_SESSION, sessionId) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setTransferringNowSessionId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
static setTransferringNowSessionId(sessionId: string | undefined) { AppStorage.setOrCreate(Keys.CURRENTLY_RECEIVING_SESSION, sessionId) }
https://gitcode.com/azhu0001/localsend-harmony
dedd8272c24200b62acc1f3049e49f25d4799bbc
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/LineChartRenderer.ets
arkts
generateFilledPath
Generates a path that is used for filled drawing. @param dataSet The dataset from which to read the entries. @param startIndex The index from which to start reading the dataset @param endIndex The index from which to stop reading the dataset @param outputPath The path object that will be assigned the chart data. @...
private generateFilledPath(dataSet: ILineDataSet, startIndex: number, endIndex: number, outputPath: Path2D): Path2D { if (!this.mChart) { return new Path2D(); } const fillMin: number = dataSet.getFillFormatter().getFillLinePosition(dataSet, this.mChart); const phaseY: number = this.mAnimator ? t...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateFilledPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private generateFilledPath(dataSet: ILineDataSet, startIndex: number, endIndex: number, outputPath: Path2D): Path2D { if (!this.mChart) { return new Path2D(); } const fillMin: number = dataSet.getFillFormatter().getFillLinePosition(dataSet, this.mChart); const phaseY: number = this.mAnimator ? t...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
dca5f6d186ab7be78b0eb6890f06322669e993ba
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_plus/unary_plus_int.ets
arkts
main
--- desc: check unary plus operation for integer operand ---
function main(): void { const v: int = {{v.value}} assert +(v) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const v: int = {{v.value}} assert +(v) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9309ba4b2c6a5b10414dc51a7ce463acee12686d
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/ForumPage.ets
arkts
onTabShow
Tab切换时的处理(当ForumPage作为TabContent时)
onTabShow() { console.log('ForumPage onTabShow - Tab切换显示,开始刷新帖子'); this.checkLoginStatus().then(() => { this.loadPosts(); }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTabShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
onTabShow() { console.log('ForumPage onTabShow - Tab切换显示,开始刷新帖子'); this.checkLoginStatus().then(() => { this.loadPosts(); }); }
https://github.com/cpdd5201314/harmonyOS-music-app
259bbecc20e3f3ca9f3d69dbe7a262b6fa95db2b
github
YANGZX22/Voot
entry/src/main/ets/pages/ApiConfigPage.ets
arkts
PromptContent
Global Builder for PromptContent (needed because of the switch case in the previous code) Ideally this should also be a @Component or a method inside the class.
@Builder function PromptContent(props: ApiConfigPageProps) { Column() { Image($r('app.media.Prompt')) .width(48) .height(48) .margin({ bottom: 8 }) .fillColor(Color.White) Text('翻译提示词') .fontColor(Color.White) .fontSize(20) .fontWeight(FontWeight.Bold) .margin({...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left PromptContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#req...
@Builder function PromptContent(props: ApiConfigPageProps) { Column() { Image($r('app.media.Prompt')) .width(48) .height(48) .margin({ bottom: 8 }) .fillColor(Color.White) Text('翻译提示词') .fontColor(Color.White) .fontSize(20) .fontWeight(FontWeight.Bold) .margin({...
https://github.com/YANGZX22/Voot
f0f002a164c414e0495b01b65c562320eca5f92f
github
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/PopViewUtils.ets
arkts
showPopView
打开弹窗 @param contentView @param args @param options
public static showPopView<T extends Object>(contentView: WrappedBuilder<[T]> | WrappedBuilder<[]>, options?: promptAction.BaseDialogOptions, args?: T): void { PopViewUtils.showDialog(PopViewShowType.OPEN, contentView, args, options); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left showPopView 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_id...
public static showPopView<T extends Object>(contentView: WrappedBuilder<[T]> | WrappedBuilder<[]>, options?: promptAction.BaseDialogOptions, args?: T): void { PopViewUtils.showDialog(PopViewShowType.OPEN, contentView, args, options); }
https://github.com/xblLab/HarmonyProjectTemplate
81fa71b830ac26292d5a397c9457dcfb01d0cfcb
github
LongLiveY96/chatcube
entry/src/main/ets/pages/ChatPage.ets
arkts
handleSend
同步包装方法,用于 onSend 回调
handleSend(): void { if (this.showAttachmentPicker) { this.closeAttachmentPanel() } this.sendMessage() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleSend 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...
handleSend(): void { if (this.showAttachmentPicker) { this.closeAttachmentPanel() } this.sendMessage() }
https://github.com/LongLiveY96/chatcube
1cf15605ffe3181b7c5e98f76661490408494fef
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnBadgeViewModel.ets
arkts
incrementValue
增加徽标数值
incrementValue(): void { this.badgeValue = this.badgeValue + 1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left incrementValue 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...
incrementValue(): void { this.badgeValue = this.badgeValue + 1; }
https://github.com/codelably/tuniao-ui
0cc7f24f6eafb6f4ab3773b7f0eb547626e7bd19
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleRemoteConfig.ets
arkts
enrollIntoABTestsForKeys
-- A/B testing -- Enroll the user in every A/B experiment that touches `keys`. Sends `/o/sdk?method=ab&keys=[...]`. No-op in temporary-id mode or under revoked RC consent; invalid / empty keys are filtered with a warning.
public async enrollIntoABTestsForKeys(keys: string[] | null): Promise<void> { if (this.rejectIfHalted('ModuleRemoteConfig', 'enrollIntoABTestsForKeys')) return; const filtered: string[] = ModuleRemoteConfig.filterKeys(keys); if (filtered.length === 0) { this.config.logger.w('[ModuleRemoteConfig] enr...
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 enrollIntoABTestsForKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#:...
public async enrollIntoABTestsForKeys(keys: string[] | null): Promise<void> { if (this.rejectIfHalted('ModuleRemoteConfig', 'enrollIntoABTestsForKeys')) return; const filtered: string[] = ModuleRemoteConfig.filterKeys(keys); if (filtered.length === 0) { this.config.logger.w('[ModuleRemoteConfig] enr...
https://github.com/Countly/countly-sdk-hos
50491c642f1a26d3031d5b9ff082ee4dc44c3b2d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setShadowColorSameAsCandle
Sets shadow color to be the same color as the candle color @param shadowColorSameAsCandle
public setShadowColorSameAsCandle(shadowColorSameAsCandle: boolean): void { this.mShadowColorSameAsCandle = shadowColorSameAsCandle; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setShadowColorSameAsCandle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shadowColorSameAsCandle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#bo...
public setShadowColorSameAsCandle(shadowColorSameAsCandle: boolean): void { this.mShadowColorSameAsCandle = shadowColorSameAsCandle; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2ba4305bef3e7b3383e55eb01b5e9a4d77eeddbf
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets
arkts
ensureBackupDirectory
确保备份目录存在 Native客户端支持MKCOL方法,可以直接创建目录
private async ensureBackupDirectory(): Promise<void> { if (!this.client && !this.nativeClient) return; try { // Native客户端支持直接创建目录 if (this.nativeClient) { const existsResult = await this.nativeClient.exists('backups'); if (!existsResult) { const createResult = await this...
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 ensureBackupDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private async ensureBackupDirectory(): Promise<void> { if (!this.client && !this.nativeClient) return; try { // Native客户端支持直接创建目录 if (this.nativeClient) { const existsResult = await this.nativeClient.exists('backups'); if (!existsResult) { const createResult = await this...
https://github.com/DaLongZhuaZi/manxia
cbb2328b932dc4259c2f64601224d785442da754
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
currentTabSearchCancel
Cancel search on current tab.
currentTabSearchCancel() { if (!this.currentTab) { meow(`No current tab found!`, 'meowTabBunch][currentTabSearchCancel', meowLevel.WARN); return; } this.currentTab.searchCancel(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left currentTabSearchCancel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_b...
currentTabSearchCancel() { if (!this.currentTab) { meow(`No current tab found!`, 'meowTabBunch][currentTabSearchCancel', meowLevel.WARN); return; } this.currentTab.searchCancel(); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
a1494c87e3c3bd9f459f8ff17b789795d94f0412
github
OHPG/FinSdk
jellyfin/src/main/ets/api/PlaylistsApi.ets
arkts
getPlaylistUsers
@summary Get a playlist\'s users. @param {PlaylistsApiGetPlaylistUsersRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof PlaylistsApi
public getPlaylistUsers(requestParameters: PlaylistsApiGetPlaylistUsersRequest): Promise<Array<PlaylistUserPermissions>> { return this.apiClient.get({path: `/Playlists/${requestParameters.playlistId}/Users`, parameters: requestParameters, excludeParams: ['playlistId']}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPlaylistUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
public getPlaylistUsers(requestParameters: PlaylistsApiGetPlaylistUsersRequest): Promise<Array<PlaylistUserPermissions>> { return this.apiClient.get({path: `/Playlists/${requestParameters.playlistId}/Users`, parameters: requestParameters, excludeParams: ['playlistId']}) }
https://github.com/OHPG/FinSdk
7fc0d3419d5d0f7bd44f1dbdc2d12a602671e7d4
github
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/TreeSelect.ets
arkts
showAllCitiesForProvince
查询相应省份的城市
showAllCitiesForProvince(province:string):string[]{ this.selectedCitiesNumber = 0 let result:string[] = [] this.data.forEach(element=>{ if(element.label == province){ element.children.forEach(city=>{ result.push(city.label) }) } }) return result }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left showAllCitiesForProvince AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left province AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
showAllCitiesForProvince(province:string):string[]{ this.selectedCitiesNumber = 0 let result:string[] = [] this.data.forEach(element=>{ if(element.label == province){ element.children.forEach(city=>{ result.push(city.label) }) } }) return result }
https://gitee.com/openharmony-sig/ohos_easyui.git
11ef6836c1ca850fa2b227e67c60478cada1c921
gitee
openharmony-sig/online_event
college_growth_program/homework/三期成长打卡作业/2022_0127/crusie/陈星霖-作业&笔记-0127/MyApplication6/entry/src/main/ets/MainAbility/pages/index.ets
arkts
onChangeMusicProgress
音乐进度变化
onChangeMusicProgress(value: number, mode: SliderChangeMode) { if (this.isSwitching) { CommonLog.info('onChangeMusicProgress ignored, isSwitching'); return; } this.isSwitching = true CommonLog.info('value:' + value + 'mode:' + mode.toString()) this.currentProgress = value if (this....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onChangeMusicProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identif...
onChangeMusicProgress(value: number, mode: SliderChangeMode) { if (this.isSwitching) { CommonLog.info('onChangeMusicProgress ignored, isSwitching'); return; } this.isSwitching = true CommonLog.info('value:' + value + 'mode:' + mode.toString()) this.currentProgress = value if (this....
https://gitee.com/openharmony-sig/online_event.git
b8e3b26e7558277dd0004a204027992f889bba05
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Float32Array with respect to length. @param length data initializer
public constructor(length: int) { this.length = length this.byteLength = length * Float32Array.BYTES_PER_ELEMENT this.byteOffset = 0 this.buffer = new ArrayBuffer(this.byteLength) }
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#identifier#Left length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier...
public constructor(length: int) { this.length = length this.byteLength = length * Float32Array.BYTES_PER_ELEMENT this.byteOffset = 0 this.buffer = new ArrayBuffer(this.byteLength) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
658ed3ee05966eb9e4ba6a1559e6da753fc68ed6
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test30_original_index.ets
arkts
sumAll
--- Rest parameters ---
function sumAll(...nums: number[]): number { let total: number = 0; for (let i: number = 0; i < nums.length; i++) { total = total + nums[i]; } return total; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left sumAll AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#rest_pattern#Left AST#...#Left ... AST#...#Right AST#identifier#Left nums AST#identifier#Right ...
function sumAll(...nums: number[]): number { let total: number = 0; for (let i: number = 0; i < nums.length; i++) { total = total + nums[i]; } return total; }
https://github.com/miaochiahao/ark-ghidra
39e548a62302b9ee71c2c4677cd700a47947cb5d
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/ChatPage.ets
arkts
scrollToBottom
滚动消息列表到最底部,以备显示最新消息。
scrollToBottom() { this.scroller.scrollEdge(Edge.Bottom); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left scrollToBottom 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...
scrollToBottom() { this.scroller.scrollEdge(Edge.Bottom); }
https://github.com/JackJiang2011/harmonychat
95e7779c09595ba26305d6a997be3e5f15461963
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/button/ToggleDemo.ets
arkts
buildSwitch
自定义 Switch
@Builder function buildSwitch(config: ToggleConfiguration) { /* * ToggleConfiguration - 自定义 Toggle 的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * isOn - 是否是打开状态 * triggerChange() - 触发 Toggle 的 onChange() 回调 */ Column({ space: 10 }) { Circle({ width: 150, height: 15...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left buildSwitch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requi...
@Builder function buildSwitch(config: ToggleConfiguration) { /* * ToggleConfiguration - 自定义 Toggle 的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * isOn - 是否是打开状态 * triggerChange() - 触发 Toggle 的 onChange() 回调 */ Column({ space: 10 }) { Circle({ width: 150, height: 15...
https://github.com/webabcd/HarmonyDemo
088b8544c65b313dc4227a4cf370ca98e93e7281
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebDavClient.ets
arkts
connection
重新获取连接
public connection() { if (this.config != null) { this.updateOptions(this.config); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left connection 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 { AS...
public connection() { if (this.config != null) { this.updateOptions(this.config); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L107-L111
5bf10c89b217e7fb83aa821bcdaf0763d7a62b0f
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/pages/SettingPage/Options.ets
arkts
loadColorMode
从 Preferences 加载上次保存的显示模式,默认为"跟随系统"(index=0)
loadColorMode(): void { try { const ctx = getContext(this) as common.UIAbilityContext const pref = preferences.getPreferencesSync(ctx, { name: PREF_NAME }) // 读取保存的 index,默认值 0 = 跟随系统 const savedIndex = pref.getSync(KEY_COLOR_MODE, 0) as number this.index = savedIndex this.text...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadColorMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
loadColorMode(): void { try { const ctx = getContext(this) as common.UIAbilityContext const pref = preferences.getPreferencesSync(ctx, { name: PREF_NAME }) // 读取保存的 index,默认值 0 = 跟随系统 const savedIndex = pref.getSync(KEY_COLOR_MODE, 0) as number this.index = savedIndex this.text...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
c9226c46640675509513fed85b3247117d4be442
github
CLMC2025/Vignette
entry/src/main/ets/utils/SecureStorage.ets
arkts
initialize
Initialize the secure storage
async initialize(): Promise<boolean> { if (this.isInitialized) { console.log('[SecureStorage] initialize: Already initialized'); return true; } try { console.log('[SecureStorage] initialize: Starting initialization'); // Check if abilityContext is available if (!this....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async initialize(): Promise<boolean> { if (this.isInitialized) { console.log('[SecureStorage] initialize: Already initialized'); return true; } try { console.log('[SecureStorage] initialize: Starting initialization'); // Check if abilityContext is available if (!this....
https://github.com/CLMC2025/Vignette
5ee4092bc638ee0b3eb2ffcb5270068e7cc5d527
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/db/BaseDao.ets
arkts
closeResultSet
统一关闭 ResultSet,消除各 DAO 重复的 finally 块
private static closeResultSet(resultSet: relationalStore.ResultSet | null, tableName: string): void { if (resultSet === null) { return } try { resultSet.close() } catch (closeErr) { Logger.warn('%{public}s close resultSet failed: %{public}s', tableName, String(closeErr)) } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left closeResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#...
private static closeResultSet(resultSet: relationalStore.ResultSet | null, tableName: string): void { if (resultSet === null) { return } try { resultSet.close() } catch (closeErr) { Logger.warn('%{public}s close resultSet failed: %{public}s', tableName, String(closeErr)) } }
https://github.com/encorexin/WordPressCMS
c123a8761a3eec9c9784e443d313b8daff39ff06
github
DaLongZhuaZi/manxia
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
saveFormInfo
保存卡片信息
private async saveFormInfo(formId: string, dimension: number): Promise<void> { try { const pref = await preferences.getPreferences(this.context, FORM_STORAGE); const formIdsStr = (await pref.get('formIds', '[]')) as string; const ids: string[] = SafeUtils.parseObj(formIdsStr); if (!ids.in...
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 saveFormInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left :...
private async saveFormInfo(formId: string, dimension: number): Promise<void> { try { const pref = await preferences.getPreferences(this.context, FORM_STORAGE); const formIdsStr = (await pref.get('formIds', '[]')) as string; const ids: string[] = SafeUtils.parseObj(formIdsStr); if (!ids.in...
https://github.com/DaLongZhuaZi/manxia
9a9c907247c93100e4262882803a9c3c551c1318
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
toLowerCase
Creates new string similar to this String but with all characters in lower case. @returns new string with all characters in lower case
public toLowerCase(): String { let resChars: char[] = this.getChars(); for (let i: int = 0; i < resChars.length; i++) { resChars[i] = Char.toLowerCase(resChars[i]); } return new String(resChars); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLowerCase 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 String AST...
public toLowerCase(): String { let resChars: char[] = this.getChars(); for (let i: int = 0; i < resChars.length; i++) { resChars[i] = Char.toLowerCase(resChars[i]); } return new String(resChars); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
065f243610f9bc892026c04881a603a8ab33f7ff
gitee
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
getIndexByOffset
通过偏移量获取索引
getIndexByOffset(columnIndex: number, offset: number) { return clamp(Math.round(-offset / (this.horizontal ? this.itemCalcWidth : this.itemCalcHeight)), 0, this.getColumns()[columnIndex].length - 1) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIndexByOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left columnIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Rig...
getIndexByOffset(columnIndex: number, offset: number) { return clamp(Math.round(-offset / (this.horizontal ? this.itemCalcWidth : this.itemCalcHeight)), 0, this.getColumns()[columnIndex].length - 1) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L471-L473
bded726037efc1545c5d2d89dca2476f549fb7ff
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/PaginationManager.ets
arkts
setPrefetchedRaw
将一页预取数据写入缓存(object[] 形式)。子类的 setPrefetchedPage 负责把 强类型数组(如 PostInfo[])拷贝成 object[] 后调用本方法。 @param page - 页码 @param items - 该页条目(object[]) @param totalPages - 该页响应携带的总页数
protected setPrefetchedRaw(page: number, items: object[], totalPages: number): void { const holder: PrefetchedPageHolder = new PrefetchedPageHolder() for (let i = 0; i < items.length; i++) { holder.items.push(items[i]) } holder.totalPages = totalPages this.prefetchedPages.set(page, holder) ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left setPrefetchedRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
protected setPrefetchedRaw(page: number, items: object[], totalPages: number): void { const holder: PrefetchedPageHolder = new PrefetchedPageHolder() for (let i = 0; i < items.length; i++) { holder.items.push(items[i]) } holder.totalPages = totalPages this.prefetchedPages.set(page, holder) ...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L80-L87
a39e873b236c76fe749cc36ded98e6142989a6f2
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/HomeVM.ets
arkts
refresh
全量并发刷新。返回热门/近期两个 section 的"是否还有更多",供 UI 初始化分页状态。
static async refresh(): Promise<HomeSections> { AppStorage.setOrCreate<boolean>(AppStorageKeys.HOME_LOADING, true); // 切换内容地区 / 主动刷新时先清空三个数据 key, // 强制 @StorageLink 触发一次 UI 重渲(避免数组整体替换时偶发不刷新)。 AppStorage.setOrCreate<Book[]>(AppStorageKeys.HOME_RECOMMENDED, []); AppStorage.setOrCreate<Book[]>(AppSt...
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 refresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :...
static async refresh(): Promise<HomeSections> { AppStorage.setOrCreate<boolean>(AppStorageKeys.HOME_LOADING, true); // 切换内容地区 / 主动刷新时先清空三个数据 key, // 强制 @StorageLink 触发一次 UI 重渲(避免数组整体替换时偶发不刷新)。 AppStorage.setOrCreate<Book[]>(AppStorageKeys.HOME_RECOMMENDED, []); AppStorage.setOrCreate<Book[]>(AppSt...
https://github.com/LZZLHY/hlib
9b443763075dfcd0038c6da22cf7a5b5db780609
github
arkui-x/samples
CodeLab/Cases/feature/bottomdrawerslidecase/src/main/ets/utils/WindowModel.ets
arkts
getArkuiXWindowHeight
跨平台获取主窗口高度 @returns {callback: ((arkuiXWindowHeight: number) => void)}
getArkuiXWindowHeight(callback: ((arkuiXWindowHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getArkuiXWindowHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#...
getArkuiXWindowHeight(callback: ((arkuiXWindowHeight: number) => void)): void { if (this.windowStage === undefined) { logger.error('windowStage is undefined.'); return; } this.windowStage.getMainWindow((err, windowClass: window.Window) => { if (err.code) { logger.error(`Failed to...
https://gitcode.com/arkui-x/samples
8691737235dd08b01c192cc78d3a95788e66ecc4
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
isFinite
isFinite(double) checks if double is a floating point value (not a NaN or infinity) @param { double } v the double to test @returns { boolean } true if the argument is a floating point value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static isFinite(v: double): boolean { return !(Double.isNaN(v) || (v == Double.POSITIVE_INFINITY) || (v == Double.NEGATIVE_INFINITY)); }
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 isFinite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Righ...
public static isFinite(v: double): boolean { return !(Double.isNaN(v) || (v == Double.POSITIVE_INFINITY) || (v == Double.NEGATIVE_INFINITY)); }
https://gitcode.com/iop123123/arkts-static-skills
0582d440dbbb99fb733f311d7f17b1f291026eb7
gitcode
LZZLHY/hlib
entry/src/main/ets/utils/ErrorHelper.ets
arkts
describe
把异常映射为本地化文案。 - CfBlockedError 由调用方单独处理(弹切线路对话框);这里仍兜底返回文案。 - ctxKey 是 string.json 中的 i18n 键,例如 'ctx_login' / 'ctx_load_detail'。 不传时默认 'ctx_op'(=「操作」/「Operation」)。
static describe(err: Object, ctxKey: string = 'ctx_op'): string { if (err instanceof CfBlockedError) { return I18n.ts('err_cf_blocked'); } if (err instanceof UnauthorizedError) { return I18n.ts('err_unauthorized'); } const ctx: string = I18n.ts(ctxKey); if (err instanceof HttpStatu...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left describe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object A...
static describe(err: Object, ctxKey: string = 'ctx_op'): string { if (err instanceof CfBlockedError) { return I18n.ts('err_cf_blocked'); } if (err instanceof UnauthorizedError) { return I18n.ts('err_unauthorized'); } const ctx: string = I18n.ts(ctxKey); if (err instanceof HttpStatu...
https://github.com/LZZLHY/hlib
2a99030c61a2da071be1b3738e766bc9da98b73d
github
seagazer/cclyric
lib/src/main/ets/CcLyricController.ets
arkts
setTextHighlightColor
Set the highlight text color of lyric, default is 0xffff0000. @param color The text color.
public setTextHighlightColor(color: number): CcLyricController { this._textHighlightColor = color this.invalidate() return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextHighlightColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public setTextHighlightColor(color: number): CcLyricController { this._textHighlightColor = color this.invalidate() return this }
https://github.com/seagazer/cclyric
5722b725ace27179d9e4a3ba4029d772e0e2a97a
github
LZZLHY/hlib
entry/src/main/ets/utils/DohResolver.ets
arkts
diagnoseAsync
仅做诊断日志:失败请求后台异步调一次,写入 Logger.i / Logger.w 供排查。
static async diagnoseAsync(hostname: string): Promise<void> { try { const r: DnsResolveResult = await DohResolver.resolveA(hostname); if (r.ok) { Logger.i(TAG, `diag ${hostname} → DNS ok, ips=[${r.ips.join(',')}] ${r.elapsedMs}ms (request still failed: likely IP/CDN block)`); } else { ...
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 diagnoseAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hostname AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async diagnoseAsync(hostname: string): Promise<void> { try { const r: DnsResolveResult = await DohResolver.resolveA(hostname); if (r.ok) { Logger.i(TAG, `diag ${hostname} → DNS ok, ips=[${r.ips.join(',')}] ${r.elapsedMs}ms (request still failed: likely IP/CDN block)`); } else { ...
https://github.com/LZZLHY/hlib
5542d25dd2a415ede6cfdde87fd86dcbb90136c4
github
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/LoginView.ets
arkts
handleLogin
登录主逻辑
handleLogin() { if (!this.isAgreed) { this.showToast('请先阅读并同意用户协议', false); return; } if (!this.validatePhone()) return; if (!this.password) { this.showToast(this.loginType === 0 ? '请输入密码' : '请输入验证码', false); return; } const url = this.loginType === 0 ? `$...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleLogin 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 A...
handleLogin() { if (!this.isAgreed) { this.showToast('请先阅读并同意用户协议', false); return; } if (!this.validatePhone()) return; if (!this.password) { this.showToast(this.loginType === 0 ? '请输入密码' : '请输入验证码', false); return; } const url = this.loginType === 0 ? `$...
https://github.com/luojiang001/Pulse
04b34e730e799317cabcab42fd63b2fece7b5128
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
getAdvices
获取预算建议
getAdvices(): BudgetAdvice[] { try { const parsed = JSON.parse(this.advicesJson) as BudgetAdvice[]; return parsed; } catch (e) { return []; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAdvices 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 BudgetAdvice AST#identifier#Right AST#[#Left [ AST#...
getAdvices(): BudgetAdvice[] { try { const parsed = JSON.parse(this.advicesJson) as BudgetAdvice[]; return parsed; } catch (e) { return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b789b1a56fe449014b5c4c0bf41001d6a726e004
github
the-wwyang/kids-learning-app
src/main/ets/services/AudioService.ets
arkts
playAudio
播放音频文件 @param audioFileName 音频文件名(不含路径,如 "bo.mp3") @returns Promise<boolean> 播放是否成功
public async playAudio(audioFileName: string): Promise<boolean> { if (this.avPlayer === null || this.context === null) { console.error('AudioService: 服务未初始化'); return false; } // 如果正在播放,先停止 if (this.isPlaying) { await this.stopAudio(); } try { // 构建音频文件路径 // 假设音...
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 playAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left audioFileName AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public async playAudio(audioFileName: string): Promise<boolean> { if (this.avPlayer === null || this.context === null) { console.error('AudioService: 服务未初始化'); return false; } // 如果正在播放,先停止 if (this.isPlaying) { await this.stopAudio(); } try { // 构建音频文件路径 // 假设音...
https://github.com/the-wwyang/kids-learning-app
6288acd663c8eb1ebb1d045bace59fc1f1f8c03d
github
LongLiveY96/chatcube
entry/src/main/ets/services/AttachmentStorageService.ets
arkts
ensureDirectories
确保存储目录存在
private async ensureDirectories(): Promise<void> { const attachmentsPath = `${this.baseDir}/${ATTACHMENTS_DIR}` const imagesPath = `${attachmentsPath}/${IMAGES_DIR}` const filesPath = `${attachmentsPath}/${FILES_DIR}` try { fileIo.mkdirSync(attachmentsPath) } catch (e) { // 目录创建失败或已存在...
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 ensureDirectories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async ensureDirectories(): Promise<void> { const attachmentsPath = `${this.baseDir}/${ATTACHMENTS_DIR}` const imagesPath = `${attachmentsPath}/${IMAGES_DIR}` const filesPath = `${attachmentsPath}/${FILES_DIR}` try { fileIo.mkdirSync(attachmentsPath) } catch (e) { // 目录创建失败或已存在...
https://github.com/LongLiveY96/chatcube
dbb7209bb2b34bc8c710ade9d9cc61b2ccf2163f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
buildSearchByAuthorActions
构建作者搜索操作序列 @param config 图源配置 @param authorId 作者ID @returns 操作序列,如果工作流不存在则返回空数组
buildSearchByAuthorActions(config: MangaSourceConfig, authorId: string): Action[] { const workflow = this.getWorkflow(config, 'searchByAuthor'); if (!workflow) { logger.info(TAG, 'searchByAuthor工作流不存在,返回空数组'); return []; } return this.processActions(workflow, { authorId } as Partial<Workfl...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildSearchByAuthorActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceC...
buildSearchByAuthorActions(config: MangaSourceConfig, authorId: string): Action[] { const workflow = this.getWorkflow(config, 'searchByAuthor'); if (!workflow) { logger.info(TAG, 'searchByAuthor工作流不存在,返回空数组'); return []; } return this.processActions(workflow, { authorId } as Partial<Workfl...
https://github.com/DaLongZhuaZi/manxia
4ff3fa65ffe1ab6e9a10a487a908ff48e32183ac
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
isClipDataToContentEnabled
When disabled, the data and/or highlights will not be clipped to contentRect. Disabling this option can be useful, when the data lies fully within the content rect, but is drawn in such a way (such as thick lines) that there is unwanted clipping. @return
public isClipDataToContentEnabled(): boolean { return this.mClipDataToContent; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isClipDataToContentEnabled 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#Lef...
public isClipDataToContentEnabled(): boolean { return this.mClipDataToContent; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a3b949ff91a187041f9af9621e3550f42ffc41ab
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/multiplication/multiplication_char.ets
arkts
main
--- desc: check multiplication of two chars ---
function main(): void { const a: char = {{v.left}} const b: char = {{v.right}} assert (a * b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: char = {{v.left}} const b: char = {{v.right}} assert (a * b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
18224dc4cde1ee9e54021fb960cdc5dd7ca03fb1
gitee
openharmony/codelabs
ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets
arkts
ensureDatabaseReady
确保数据库已初始化
private async ensureDatabaseReady(): Promise<void> { if (this.initPromise) { await this.initPromise; } else if (this.context) { this.initPromise = this.initDatabase(); await this.initPromise; } else { throw new Error('Context未设置,无法初始化数据库'); } }
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 ensureDatabaseReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async ensureDatabaseReady(): Promise<void> { if (this.initPromise) { await this.initPromise; } else if (this.context) { this.initPromise = this.initDatabase(); await this.initPromise; } else { throw new Error('Context未设置,无法初始化数据库'); } }
https://gitcode.com/openharmony/codelabs
2a2cc584b3c77f1bb5c4951a3b63ffc3b72575c1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/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 { int } begin index to start from @param { int } end past the ending index @throws { StringIndexOutOfBoundsError } if begin is negative or >= length, if end >= length @th...
public getBytes(begin: int, end: int): byte[] { // #24515: Need to remove the following function call after primitive type refactoring let ret : FixedArray<byte> = arkruntime.stub.toFixedArray(this.getBytesImpl(begin, end)); let tmpForceBox: Array<byte> = new Array<byte>(ret.length, (i) => {...
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[] { // #24515: Need to remove the following function call after primitive type refactoring let ret : FixedArray<byte> = arkruntime.stub.toFixedArray(this.getBytesImpl(begin, end)); let tmpForceBox: Array<byte> = new Array<byte>(ret.length, (i) => {...
https://gitcode.com/iop123123/arkts-static-skills
2933dff8c6ab081292997b7b981e90c48241ffe6
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies all elements of arr to the current Uint32Array starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<number> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inserted @...
public set(arr: FixedArray<number>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<long>): size of arr is greater than Uint32Array.length") } for (let i = 0; i < arr.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<number>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<long>): size of arr is greater than Uint32Array.length") } for (let i = 0; i < arr.length; i++) { ...
https://gitcode.com/iop123123/arkts-static-skills
340e7ae3254601a50e7f85bf5a1e7a841f587c08
gitcode
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets
arkts
unstarDocument
取消收藏 @param documentId 文档ID
async unstarDocument(documentId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/knowledge/stars/${documentId}`) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unstarDocument AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async unstarDocument(documentId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/knowledge/stars/${documentId}`) }
https://github.com/David8Idira/AI-OA
15650167e63c662e11822940823795eb4d02986b
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets
arkts
getFpsJitterScore
方法描述 计算kpi抖动率的得分(y=100*EXP(-0.458*x)) @param param param @return java.lang.Integer 得分
private static getFpsJitterScore(param: number): number { if (null == param) { return null; } return Math.round(100.0 * Math.exp(-0.458 * 100 * param)); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getFpsJitterScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#L...
private static getFpsJitterScore(param: number): number { if (null == param) { return null; } return Math.round(100.0 * Math.exp(-0.458 * 100 * param)); }
https://gitee.com/openharmony/developtools_profiler.git
e9ac7079581274f97f337283b761c3bf612b25fd
gitee
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/utils/AsrDisplayManager.ets
arkts
clear
Clear all hidden and converting states
clear(): void { if (this.hiddenMessageIDs.size > 0 || this.convertingMessageIDs.size > 0) { this.hiddenMessageIDs.clear(); this.convertingMessageIDs.clear(); this.version++; // Trigger UI update console.log(`[AsrDisplayManager] 🗑️ Cleared all states, version: ${this.version}`); this...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear 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#...
clear(): void { if (this.hiddenMessageIDs.size > 0 || this.convertingMessageIDs.size > 0) { this.hiddenMessageIDs.clear(); this.convertingMessageIDs.clear(); this.version++; // Trigger UI update console.log(`[AsrDisplayManager] 🗑️ Cleared all states, version: ${this.version}`); this...
https://github.com/Tencent-RTC/TUIKit_Harmony
250cdc56bb68eafd718208c5c4d8904b644b6617
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/multiplication/multiplication_ulong.ets
arkts
main
--- desc: check multiplication of two unsigned long integers ---
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a * b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a * b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
58992a10e2ab0b6c9eb418696f93438c897c5743
gitee
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/demo/entry/src/main/ets/common/SettingPublicLayout.ets
arkts
isBorderFn
两种形式,1、无圆角,2、全圆角,3、下左下右圆角,4、上左上右圆角 默认不传 无圆角 isModeBol = true borderBol= false 全圆角 isModeBol = true borderBol= true borderBole = false 下左下右圆角 isModeBol = true borderBol= true borderBole = true 上左上右圆角
isBorderFn(): BorderRadiuses { if (this.isModeBol) { if (this.borderBol) { if (this.borderBole) { return { topLeft: 16, topRight: 16 }; } else { return { bottomLeft: 16, bottomRight: 16 }; } } else { return { topLeft: 16, topRight: 16, bottomLeft: 16...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isBorderFn 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 BorderRadiuses AST#identifier#Right AST#ERROR#Right...
isBorderFn(): BorderRadiuses { if (this.isModeBol) { if (this.borderBol) { if (this.borderBole) { return { topLeft: 16, topRight: 16 }; } else { return { bottomLeft: 16, bottomRight: 16 }; } } else { return { topLeft: 16, topRight: 16, bottomLeft: 16...
https://gitee.com/openharmony/multimedia_camera_framework.git
7d9c8be12230dfdc0ec1a10ac597b532fc4116a3
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test52_original_index.ets
arkts
longestCommonPrefix
--- Longest common prefix ---
function longestCommonPrefix(strs: string[]): string { if (strs.length === 0) { return ''; } let prefix: string = strs[0]; for (let i: number = 1; i < strs.length; i++) { while (strs[i].indexOf(prefix) !== 0) { prefix = prefix.substring(0, prefix.length - 1); if (prefix.length === 0) { ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left longestCommonPrefix AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left strs AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
function longestCommonPrefix(strs: string[]): string { if (strs.length === 0) { return ''; } let prefix: string = strs[0]; for (let i: number = 1; i < strs.length; i++) { while (strs[i].indexOf(prefix) !== 0) { prefix = prefix.substring(0, prefix.length - 1); if (prefix.length === 0) { ...
https://github.com/miaochiahao/ark-ghidra
4f8a5e127b1087ec319d3c9d71a411387cf3903f
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Assigns val as element on insertPos. @description Added to avoid (un)packing a single value into array to use overloaded set(double[], insertPos) @param val value to set @param insertPos index to change
public set(insertPos: number, val: number): void { this.set(insertPos as int, val as double as int as double) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#...
public set(insertPos: number, val: number): void { this.set(insertPos as int, val as double as int as double) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9b1493bb0d54e9c4b43e6d90eefbd3eeac112920
gitee
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/entry/src/main/ets/scan/ScanPage.ets
arkts
offLightingFlash
注销手电筒监听状态
offLightingFlash() { try { customScan.off('lightingFlash') } catch (e) { console.error('lucy== 自定义扫码 手电筒释放失败:', e.code); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left offLightingFlash 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...
offLightingFlash() { try { customScan.off('lightingFlash') } catch (e) { console.error('lucy== 自定义扫码 手电筒释放失败:', e.code); } }
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
c0c4109a657499ad7c33a9ee0ee606656b012992
github
HarmonyOS_Samples/BestPracticeSnippets
WaterFlowSample/entry/src/main/ets/pages/DataUpdateAndAnimationPage.ets
arkts
getSize
[StartExclude quick_start]
getSize(): number { let ret: number = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSize 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#number#Right AST#ERROR#Right AST#statement_bloc...
getSize(): number { let ret: number = Math.floor(Math.random() * this.maxSize); return (ret > this.minSize ? ret : this.minSize); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
753ba772744c72687f08512990ed59de680dfd63
gitcode
RoooyHe/toona-ohos
toona/src/main/ets/network/MatrixHttpClient.ets
arkts
deleteDevice
2. 找到原来的 deleteDevice,增加 authData 参数
deleteDevice(deviceId: string, authData?: DeviceAuthData): Promise<void> { return this.deviceClient.deleteDevice(deviceId, authData); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left deleteDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
deleteDevice(deviceId: string, authData?: DeviceAuthData): Promise<void> { return this.deviceClient.deleteDevice(deviceId, authData); }
https://github.com/RoooyHe/toona-ohos
115d9f4abfa88febd49f63624dc65aab5a636ef8
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_plus/unary_plus_byte.ets
arkts
main
--- desc: check unary plus operation for byte operand ---
function main(): void { const v: byte = {{v.value}} assert +(v) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const v: byte = {{v.value}} assert +(v) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
05e4ee2da4a4c2e91c38c8b60d845af7f6738818
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
getProfileNames
── 配置档案管理 ── 获取所有配置名称
static async getProfileNames(): Promise<string[]> { await CustomKeyStore.ensureInit(); return CustomKeyStore.profiles!.map(p => p.name); }
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 getProfileNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
static async getProfileNames(): Promise<string[]> { await CustomKeyStore.ensureInit(); return CustomKeyStore.profiles!.map(p => p.name); }
https://github.com/AlkaidLab/moonlight-harmony
0a4b54dc7e025e0c34275ce2901dc2a1966638ad
github
CPF-ApplicationTPC/imageknifepro
entry/src/main/ets/pages/TestDesiredSizeDecode.ets
arkts
expectedDecodeSizePx
按当前策略与 desired 推算解码像素;DEFAULT 或参数无效时返回 null。
public static expectedDecodeSizePx( strategyIndex: number, srcW: number, srcH: number, desiredW: number, desiredH: number ): DesiredSizeLayoutPx | null { if (strategyIndex === DesiredSizeDemoDownSampling.DEFAULT_STRATEGY_INDEX) { return null } if (srcW <= 0 || srcH <= 0 || desi...
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 expectedDecodeSizePx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left strategyIndex AST#identifier#Right AST#ERROR#Left...
public static expectedDecodeSizePx( strategyIndex: number, srcW: number, srcH: number, desiredW: number, desiredH: number ): DesiredSizeLayoutPx | null { if (strategyIndex === DesiredSizeDemoDownSampling.DEFAULT_STRATEGY_INDEX) { return null } if (srcW <= 0 || srcH <= 0 || desi...
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/entry/src/main/ets/pages/TestDesiredSizeDecode.ets#L144-L168
7b724c6274fff6e2367e53f316108fe1a0de8de5
gitcode
openharmony-tpc/VCard
library/src/main/ets/components/VCardBuilder.ets
arkts
appendLineWithPropertyNameAndRawValue
Appends one line with a given property name and value.
public appendLineWithPropertyNameAndRawValue(propertyName: string, rawValue: string) { this.appendLine(propertyName, null, [rawValue], false, false); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left appendLineWithPropertyNameAndRawValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#st...
public appendLineWithPropertyNameAndRawValue(propertyName: string, rawValue: string) { this.appendLine(propertyName, null, [rawValue], false, false); }
https://gitee.com/openharmony-tpc/VCard.git
84e3fe23326193ebc3479e0c2c76dac32e8bf65f
gitee
PollenWang6/HiXD
entry/src/main/ets/services/SchoolnetService.ets
arkts
encryptPasswordRSA
===== RSA 加密 ===== RSA PKCS#1 v1.5 加密密码 ZFW 给的是 PEM 格式 X.509 SPKI(-----BEGIN PUBLIC KEY-----) 去掉 PEM 头 → base64 解码 → X.509 SPKI DER → convertKey
async encryptPasswordRSA(password: string, rsaKeyPem: string): Promise<string> { // 去掉 PEM 头尾和空白 let b64: string = rsaKeyPem; if (b64.indexOf('-----BEGIN') >= 0) { b64 = b64.replace(/-----[A-Z ]+-----/g, ''); b64 = b64.replace(/\r/g, ''); b64 = b64.replace(/\n/g, ''); b64 = b64.rep...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left encryptPasswordRSA AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left password AST#identifier#Right AST#type_annotation#L...
async encryptPasswordRSA(password: string, rsaKeyPem: string): Promise<string> { // 去掉 PEM 头尾和空白 let b64: string = rsaKeyPem; if (b64.indexOf('-----BEGIN') >= 0) { b64 = b64.replace(/-----[A-Z ]+-----/g, ''); b64 = b64.replace(/\r/g, ''); b64 = b64.replace(/\n/g, ''); b64 = b64.rep...
https://github.com/PollenWang6/HiXD
913f5ce3b8e2d0270f2f13dec3999de1473f77fe
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/AssetUtils.ets
arkts
querySync
查询关键资产 @param assetId 关键资产Id @returns 关键资产内容
public static querySync(assetId: string): string | undefined { if (!assetId) { return undefined; } try { let query: asset.AssetMap = new Map(); // 指定了关键资产别名,最多查询到一条满足条件的关键资产。 query.set(asset.Tag.ALIAS, ByteUtils.stringToBytes(assetId)); query.set(asset.Tag.RETURN_TYPE, asset....
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 querySync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left assetId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
public static querySync(assetId: string): string | undefined { if (!assetId) { return undefined; } try { let query: asset.AssetMap = new Map(); // 指定了关键资产别名,最多查询到一条满足条件的关键资产。 query.set(asset.Tag.ALIAS, ByteUtils.stringToBytes(assetId)); query.set(asset.Tag.RETURN_TYPE, asset....
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/AssetUtils.ets#L18-L38
6d557a32a2c09e170cc5c9734be92204d5f9654b
github
offlinecat-dev/OCNetORM
src/main/ets/core/OrmContext.ets
arkts
getLogger
获取日志记录器实例 @returns Logger 实例
getLogger(): Logger { return this.logger }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLogger 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 Logger AST#identifier#Right AST#ERROR#Right AST#stat...
getLogger(): Logger { return this.logger }
https://github.com/offlinecat-dev/OCNetORM
26999114ebb6923626e96ea319660cd044744738
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets
arkts
destroySurfaceManager
Destroys a C++ ISurfaceManager instance.
destroySurfaceManager(instanceId: number): void { nativeDestroySurfaceManager(instanceId); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroySurfaceManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left instanceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Le...
destroySurfaceManager(instanceId: number): void { nativeDestroySurfaceManager(instanceId); }
https://github.com/AGenUI/AGenUI
4c36cd81f17f210863d65c5190abb585686da209
github
banggx/account_app_harmonyos
entry/src/main/ets/service/account.ets
arkts
getAccountByYear
按年份获取账单记录
getAccountByYear(time: string | number) { const startMonth = dayjs(time).startOf('year').toDate().getTime(); const endMonth = dayjs(time).endOf('year').toDate().getTime(); return AccountModel.queryByDateRange(startMonth, endMonth); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAccountByYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Le...
getAccountByYear(time: string | number) { const startMonth = dayjs(time).startOf('year').toDate().getTime(); const endMonth = dayjs(time).endOf('year').toDate().getTime(); return AccountModel.queryByDateRange(startMonth, endMonth); }
https://github.com/banggx/account_app_harmonyos
81ecb9e2e9e5e7a36fab46948512d9c3d2f32043
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/XiaoyiSkillManager.ets
arkts
processQuery
匹配并执行技能
async processQuery(query: string): Promise<SkillResult> { console.log(`🔍 处理用户查询: "${query}"`); // 遍历所有已注册的技能,查找匹配项 for (const [skillId, skillInfo] of this.skills) { const SkillClass = skillInfo.skillClass; if (SkillClass.match(query)) { console.log(`✅ 匹配到 Skill: ${skillInf...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left processQuery AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:...
async processQuery(query: string): Promise<SkillResult> { console.log(`🔍 处理用户查询: "${query}"`); // 遍历所有已注册的技能,查找匹配项 for (const [skillId, skillInfo] of this.skills) { const SkillClass = skillInfo.skillClass; if (SkillClass.match(query)) { console.log(`✅ 匹配到 Skill: ${skillInf...
https://github.com/LJ666-ui/harmony-health-care
dc95b44062b73f0bb6958ba3c301a1594d0f1ae4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
getUint32
=== Uint32 === Read bytes as they represent given type @param byteOffset zero index to read @returns read value (big endian)
public getUint32(byteOffset: number): number { return this.getUint32(byteOffset as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUint32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
public getUint32(byteOffset: number): number { return this.getUint32(byteOffset as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
0c2f87b116d632cf181de2b6001cd8d7b74c61ec
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelReplaceRuleManager.ets
arkts
applyRules
应用替换规则到文本
applyRules(text: string, scope: ReplaceScope, sourceId?: string): string { if (!text) { return text; } const rules = this.getEnabledRules(scope, sourceId); let result = text; for (const rule of rules) { try { if (rule.isRegex) { const regex = new RegExp(rule.pattern...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#...
applyRules(text: string, scope: ReplaceScope, sourceId?: string): string { if (!text) { return text; } const rules = this.getEnabledRules(scope, sourceId); let result = text; for (const rule of rules) { try { if (rule.isRegex) { const regex = new RegExp(rule.pattern...
https://github.com/DaLongZhuaZi/manxia
647a56dcd1157bdefe103ecc499abc85f374b490
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/json.ets
arkts
isCorrectForParsing
TODO(kirill-mitkin): For testing purpose only, shpuld be replaced by error checking
public static isCorrectForParsing(typ: Type): boolean { return JSON.checkType(typ, new Array<TypeColor>()) }
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 isCorrectForParsing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typ AST#identifier#Right AST#:#Left...
public static isCorrectForParsing(typ: Type): boolean { return JSON.checkType(typ, new Array<TypeColor>()) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b46d53d8bbd1d653c79f784f8992e1f054757a4c
gitee
arkui-x/samples
CodeLab/Cases/feature/dragtoswitchpictures/src/main/ets/components/view/TabsWaterFlowView.ets
arkts
build
通过瀑布流和LazyForeach加载 WaterFlow+LazyForEach详细用法可参考性能范例: https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/waterflow_optimization.md/
build() { Column() { Tabs({ controller: this.tabsController }) { ForEach(TAB_DATA, (tabItem: TabDataModel) => { TabContent() { this.dragWaterFlow(); } .tabBar(SubTabBarStyle.of(tabItem.navData) .indicator({ color: Color.Black }) .padd...
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() { Column() { Tabs({ controller: this.tabsController }) { ForEach(TAB_DATA, (tabItem: TabDataModel) => { TabContent() { this.dragWaterFlow(); } .tabBar(SubTabBarStyle.of(tabItem.navData) .indicator({ color: Color.Black }) .padd...
https://gitcode.com/arkui-x/samples
58493b241e71bc887868ebb66d57a326781d84cc
gitcode
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/User.ets
arkts
fromResponse
从接口响应构建安全的用户对象 @param {Partial<User>} data - 新的用户数据 @returns {User} 用户对象
static fromResponse(data: Partial<User>): User { return new User(data); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromResponse 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#instantiation_expre...
static fromResponse(data: Partial<User>): User { return new User(data); }
https://github.com/Joker-x-dev/CoolMallArkTS
c017341da95d7cbb89d679ccd28a2c988364c59a
github
OHPG/FinMusic
entry/src/main/ets/data/Repository.ets
arkts
loadStreamUrl
获取音频流地址 @param id @param sourceId @returns
public loadStreamUrl(id: string, sourceId: string): Promise<string> { return this.requireApi().loadStreamUrl(id, sourceId) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loadStreamUrl 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 stri...
public loadStreamUrl(id: string, sourceId: string): Promise<string> { return this.requireApi().loadStreamUrl(id, sourceId) }
https://github.com/OHPG/FinMusic
a954fe49d0e0f7d7f5f4859c52ccdbf21a8a5a89
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerPersistence.ets
arkts
loadComputers
--------------------------------------------------------------------------- 加载 --------------------------------------------------------------------------- 从持久化存储加载电脑列表
static async loadComputers(): Promise<Map<string, ComputerInfo>> { const computers = new Map<string, ComputerInfo>(); try { const savedJson = await PreferencesUtil.get<string>(STORAGE_KEY, ''); if (!savedJson) { console.info('ComputerPersistence: 没有保存的电脑'); return computers; ...
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 loadComputers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
static async loadComputers(): Promise<Map<string, ComputerInfo>> { const computers = new Map<string, ComputerInfo>(); try { const savedJson = await PreferencesUtil.get<string>(STORAGE_KEY, ''); if (!savedJson) { console.info('ComputerPersistence: 没有保存的电脑'); return computers; ...
https://github.com/AlkaidLab/moonlight-harmony
5062b67a0d5609c6e1efd4fef0a5382e970c809d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
filter
=== methods with incompatible implementation === Returns the elements of an array that meet the condition specified in a callback function. @param { function } predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. @returns { Array...
public override filter(predicate: (value: T, index: int, array: Array<T>) => boolean): Array<T> { const res = new Array<T>() const len = this.actualLength for (let i: int = 0; i < len && i < this.actualLength; i++) { const val = this.$_get_unsafe(i) if (predicate(val,...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left predicate...
public override filter(predicate: (value: T, index: int, array: Array<T>) => boolean): Array<T> { const res = new Array<T>() const len = this.actualLength for (let i: int = 0; i < len && i < this.actualLength; i++) { const val = this.$_get_unsafe(i) if (predicate(val,...
https://gitcode.com/iop123123/arkts-static-skills
9ac0938226595621859f39461ea25d13f7462faa
gitcode