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
Explore-In-HMOS-Wearable/unit-calculator
entry/src/main/ets/utils/UnitConversion.ets
arkts
convertTemperature
TEMPERATURE
static convertTemperature(value: number, from: TemperatureUnit, to: TemperatureUnit): number { if (from === to) { return value; } const decimalCount: Record<TemperatureUnit, number> = { [TemperatureUnit.CELSIUS]: 2, [TemperatureUnit.FAHRENHEIT]: 2, [TemperatureUnit.KELVIN]: 2 ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertTemperature 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#L...
static convertTemperature(value: number, from: TemperatureUnit, to: TemperatureUnit): number { if (from === to) { return value; } const decimalCount: Record<TemperatureUnit, number> = { [TemperatureUnit.CELSIUS]: 2, [TemperatureUnit.FAHRENHEIT]: 2, [TemperatureUnit.KELVIN]: 2 ...
https://github.com/Explore-In-HMOS-Wearable/unit-calculator
c45552081cd5d84716bbb14cc84cc462c92d59c4
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test7_original_index.ets
arkts
testTernary
--- Conditional expression (ternary) ---
function testTernary(x: number): string { return x > 0 ? 'positive' : x < 0 ? 'negative' : 'zero'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTernary AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
function testTernary(x: number): string { return x > 0 ? 'positive' : x < 0 ? 'negative' : 'zero'; }
https://github.com/miaochiahao/ark-ghidra
ca9534de39cb3dc9410f620ae799136b354d69ab
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
getMonth
Returns the month in the specified date according to local time, as a zero-based value (where zero indicates the first month of the year). @returns { int } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getMonth(): int { let localTime = this.ms - this.TZOffset * 60 * msPerSecond; return ecmaMonthFromTime(localTime); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMonth 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 int AST#ident...
public getMonth(): int { let localTime = this.ms - this.TZOffset * 60 * msPerSecond; return ecmaMonthFromTime(localTime); }
https://gitcode.com/iop123123/arkts-static-skills
e9751fb0aff4591b97508f3c39bfadffdcf6fbc4
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Boolean.ets
arkts
valueOf
Static method that converts primitive boolean to boxed version @param b value to be converted @returns boxed value that represents provided primitive value
public static valueOf(b: boolean): Boolean { if (b) { return Boolean.TRUE; }; return Boolean.FALSE; }
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 valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left b AST#identifier#Right AST#:#Left : AST#:#Right...
public static valueOf(b: boolean): Boolean { if (b) { return Boolean.TRUE; }; return Boolean.FALSE; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2a55f1b12b694379c618ed9d4bfa602d5bd2dfd1
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Image/CoverImageManager.ets
arkts
getCachedPixelMap
获取封面PixelMap(如果已缓存)
getCachedPixelMap(url: string): image.PixelMap | null { const cached = coverCache.get(url); if (!cached) { return null; } touchCoverCache(url, cached); return cached; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getCachedPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
getCachedPixelMap(url: string): image.PixelMap | null { const cached = coverCache.get(url); if (!cached) { return null; } touchCoverCache(url, cached); return cached; }
https://github.com/DaLongZhuaZi/manxia
96515582f8dfc0afb02b32d8cbe107fde351c45e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
translate
Post-translates to the specified points. Less Performant. @param transformedPts @return
public translate(transformedPts: number[], outputMatrix?: Matrix): Matrix { let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix(); save.reset(); save.set(this.mMatrixTouch); const x: number = transformedPts[0] - this.offsetLeft(); const y: number = t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left translate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transformedPts AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
public translate(transformedPts: number[], outputMatrix?: Matrix): Matrix { let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix(); save.reset(); save.set(this.mMatrixTouch); const x: number = transformedPts[0] - this.offsetLeft(); const y: number = t...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
297e8f73de223e94ec07da04d6144c8fd38a37b4
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<int> } items - a set of elements to include in the new array object. @returns { Uint8Array } - a new Uint8Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<int>): Uint8Array { let res = new Uint8Array(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<int>): Uint8Array { let res = new Uint8Array(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
8d07b8254b0d7f97486d80ee34a880e02a5daf4b
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/core/AlertManager.ets
arkts
getAlertsByRoom
根据房间ID获取告警
public getAlertsByRoom(roomId: string): WardAlert[] { return this.alerts.filter(alert => alert.roomId === roomId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAlertsByRoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left roomId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public getAlertsByRoom(roomId: string): WardAlert[] { return this.alerts.filter(alert => alert.roomId === roomId); }
https://github.com/LJ666-ui/harmony-health-care
b357d174b08707d2ba30ac8fe74abe0963a8a728
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/ReminderDAO.ets
arkts
getByType
按类型查询提醒
static async getByType(userId: number, type: 'bill' | 'budget'): Promise<Reminder[]> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM ${Reminder.tableName} WHERE user_id = ? AND type = ? AND is_deleted = 0 ORDER BY next_reminder_date ASC`; let r...
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 getByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:...
static async getByType(userId: number, type: 'bill' | 'budget'): Promise<Reminder[]> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM ${Reminder.tableName} WHERE user_id = ? AND type = ? AND is_deleted = 0 ORDER BY next_reminder_date ASC`; let r...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
4f203d96150c57f09f774a84596ddc4c256a72a9
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/UserAuthManager.ets
arkts
onResult
认证结束会触发 onResult 获取认证结果
onResult(result) { // 如果认证结果为 12500000 表示 SUCCESS 成功 if (result.result === userAuth.UserAuthResultCode.SUCCESS) { // 标记为成功 resolve resolve(true) } else { // 标记为失败 reject reject(false) } // 认证结束后,主动关闭订阅,释放资源 ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left result AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expressi...
onResult(result) { // 如果认证结果为 12500000 表示 SUCCESS 成功 if (result.result === userAuth.UserAuthResultCode.SUCCESS) { // 标记为成功 resolve resolve(true) } else { // 标记为失败 reject reject(false) } // 认证结束后,主动关闭订阅,释放资源 ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
ec752e03c22237f1d27d02272deb99ee48ded66e
gitcode
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/pages/Register.ets
arkts
isRegister
Check whether the registration button can be clicked.
isRegister() { this.isRegisterAvailable = false; let isAvailable = (this.username.length > 0) && (this.password.length > 0) && (this.confirmPassword.length > 0); if (isAvailable) { this.isRegisterAvailable = true; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isRegister 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 AS...
isRegister() { this.isRegisterAvailable = false; let isAvailable = (this.username.length > 0) && (this.password.length > 0) && (this.confirmPassword.length > 0); if (isAvailable) { this.isRegisterAvailable = true; } }
https://gitee.com/openharmony/codelabs.git
7a3181e955b4463575958766f7e2be1c96552037
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/smartward/core/executors/RuleExecutor.ets
arkts
executeActions
执行动作列表
public async executeActions(actions: RuleAction[], roomId: string): Promise<ExecutionResult[]> { const results: ExecutionResult[] = []; console.log(`RuleExecutor: Executing ${actions.length} actions for room ${roomId}`); // 按顺序执行动作 for (const action of actions) { const startTime = Date.now(); ...
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 executeActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left actions AST#identifier#Right AST#:#Left :...
public async executeActions(actions: RuleAction[], roomId: string): Promise<ExecutionResult[]> { const results: ExecutionResult[] = []; console.log(`RuleExecutor: Executing ${actions.length} actions for room ${roomId}`); // 按顺序执行动作 for (const action of actions) { const startTime = Date.now(); ...
https://github.com/LJ666-ui/harmony-health-care
36e73ff39ec977e34db17f4a56bebcda23ffcd06
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
highlightValue
Highlights any y-value at the given x-value in the given DataSet. Provide -1 as the dataSetIndex to undo all highlighting. @param x The x-value to highlight @param y The y-value to highlight. Supply `NaN` for "any" @param dataSetIndex The dataset index to search in @param dataIndex The data index to search in (only use...
public highlightValue(x: number, y?: number, dataSetIndex?: number, dataIndex?: number, callListener?: boolean) { if (y == null || y == undefined) { y = Number.NaN; } if (dataIndex == null || dataIndex == undefined) { dataIndex = -1; } if (callListener == null || callListener == undefi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left highlightValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
public highlightValue(x: number, y?: number, dataSetIndex?: number, dataIndex?: number, callListener?: boolean) { if (y == null || y == undefined) { y = Number.NaN; } if (dataIndex == null || dataIndex == undefined) { dataIndex = -1; } if (callListener == null || callListener == undefi...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
4ee9158d33660f16719001dab2653bc9b444a86c
gitee
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WrongAnswerStore.ets
arkts
open
Open the preferences handle if not already opened. Safe to call repeatedly. Errors are surfaced to the caller — the recorder decides whether to keep retrying or silently degrade.
async open(ctx: common.UIAbilityContext): Promise<void> { if (this.loaded && this.prefs !== undefined) { return; } try { const real: preferences.Preferences = await preferences.getPreferences(ctx, PREFS_NAME); this.prefs = new RealPreferencesAdapter(real); this.loaded = tru...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left open AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annota...
async open(ctx: common.UIAbilityContext): Promise<void> { if (this.loaded && this.prefs !== undefined) { return; } try { const real: preferences.Preferences = await preferences.getPreferences(ctx, PREFS_NAME); this.prefs = new RealPreferencesAdapter(real); this.loaded = tru...
https://github.com/terryma2024/happyword
3a9c640c8eea0d074496d0184ada402214ec84ec
github
youlookwhat/HarmoryOS-learning
HarmonyOSNext/entry/src/main/ets/viewmodel/PageViewModel.ets
arkts
getDetailListData
Get detail list Data. @return {Array<DataItem>} listItems
getDetailListData(): Array<DataItem> { let listItems: Array<DataItem> = []; for (let i = 0; i < CommonConstants.DETAIL_PAGE_LIST_SIZE; i++) { let itemInfo: DataItem = new DataItem(); itemInfo.title = $r('app.string.detail_page_list_title'); itemInfo.summary = $r('app.string.list_item_summary...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDetailListData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:...
getDetailListData(): Array<DataItem> { let listItems: Array<DataItem> = []; for (let i = 0; i < CommonConstants.DETAIL_PAGE_LIST_SIZE; i++) { let itemInfo: DataItem = new DataItem(); itemInfo.title = $r('app.string.detail_page_list_title'); itemInfo.summary = $r('app.string.list_item_summary...
https://github.com/youlookwhat/HarmoryOS-learning
ac2e195837de4237524c76353b2d121ef2d43ae9
github
XHXYT/Pixark
entry/src/main/ets/common/utils/customtransition/CustomNavigationUtils.ets
arkts
registerNavParam
Register an animation callback for a page name: The unique id of the registration page. animation:Used to set the state of the page when the animation starts. onInteractiveFinish:Used to perform other actions on the page after the interactive animation ends. onInteractive: Register the dynamic effects of interactive tr...
registerNavParam(name: string, timeout: number, animation?: (transitionProxy: NavigationTransitionProxy) => void, onInteractiveFinish?: () => void, onInteractive?: () => void ): void { if (customTransitionMap.has(name)) { let param = customTransitionMap.get(name); if (param !== undef...
AST#program#Left AST#ERROR#Left AST#identifier#Left registerNavParam AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left timeout AS...
registerNavParam(name: string, timeout: number, animation?: (transitionProxy: NavigationTransitionProxy) => void, onInteractiveFinish?: () => void, onInteractive?: () => void ): void { if (customTransitionMap.has(name)) { let param = customTransitionMap.get(name); if (param !== undef...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/customtransition/CustomNavigationUtils.ets#L44-L67
1e2d2c0b9cd6071ad45981ec534ec510def0ec2c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_or/bitwise_or_int.ets
arkts
main
--- desc: check bitwise OR of two integers ---
function main(): void { const a: int = {{v.left}} const b: int = {{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: int = {{v.left}} const b: int = {{v.right}} assert (a | b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
534684c4a9453c81da1df804747a0009bd8555a5
gitee
openharmony-sig/applications_clock
common/src/main/ets/utils/TimeUtil.ets
arkts
getLeftTimeToRingTime
Gets the description of the time between the current and next ringing @return The description of the time between the current and next ringing like '3 days 2 hours 1 minute”
static async getLeftTimeToRingTime(isTimeChanged?: boolean): Promise<string> { let ringTimeInMs = await TimerManager.getTriggerTime(); LogUtil.info(TAG, 'getLeftTimeToRingTime isTimeChanged:' + isTimeChanged) if (isTimeChanged) { LogUtil.info(TAG, 'start to deal TimeChanged event'); const curr...
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 getLeftTimeToRingTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTimeChanged AST#identifier#Right AST#ERROR#Left...
static async getLeftTimeToRingTime(isTimeChanged?: boolean): Promise<string> { let ringTimeInMs = await TimerManager.getTriggerTime(); LogUtil.info(TAG, 'getLeftTimeToRingTime isTimeChanged:' + isTimeChanged) if (isTimeChanged) { LogUtil.info(TAG, 'start to deal TimeChanged event'); const curr...
https://gitee.com/openharmony-sig/applications_clock.git
c2e0258171d5fe4e2b348dfa768c23ad567eb5d1
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/pages/ReminderSettingsPage.ets
arkts
build
默认当天的某个时间
build() { Column() { // 标题栏 Row() { Image($r('app.media.ic_back_glass')) .width(24) .height(24) .onClick(() => router.back()) Text('提醒管理') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ left: 16 }) } .width('...
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() { // 标题栏 Row() { Image($r('app.media.ic_back_glass')) .width(24) .height(24) .onClick(() => router.back()) Text('提醒管理') .fontSize(20) .fontWeight(FontWeight.Bold) .margin({ left: 16 }) } .width('...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
35d7c156d598b7f9d3e66cc173aba4fddabe5437
github
bhengubv/aether-protocol
arkts/src/main/ets/incentive/TipPacketPayload.ets
arkts
jsonString
JSON-escapes and quotes a string value.
function jsonString(value: string): string { return JSON.stringify(value); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left jsonString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function jsonString(value: string): string { return JSON.stringify(value); }
https://github.com/bhengubv/aether-protocol
ae91d683097c87680d6912f64efb5dd1f13a68d2
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/component/PopularityItem.ets
arkts
event
判断热度类型获取点击事件的函数
event() { switch (this.popularityType) { case PopularityType.Watch: this.viewModel.onWatch() break case PopularityType.Star: this.viewModel.onStar() break case PopularityType.Fork: this.viewModel.onFork() break } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left event AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#switch_statement#Left AST#switc...
event() { switch (this.popularityType) { case PopularityType.Watch: this.viewModel.onWatch() break case PopularityType.Star: this.viewModel.onStar() break case PopularityType.Fork: this.viewModel.onFork() break } }
https://gitee.com/openharmony-sig/online_event.git
e32c8ea92e3497f7cc4063ba7f39c1a8b89111dc
gitee
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets
arkts
resize
调整窗口尺寸
resize(width: number, height: number): void { this.mainWindow.resize(width, height, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { hilog.error(0x0000, 'testLog', `Failed to change the window size. Cause code: ${err.code}, message: ${err.message}`); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#R...
resize(width: number, height: number): void { this.mainWindow.resize(width, height, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { hilog.error(0x0000, 'testLog', `Failed to change the window size. Cause code: ${err.code}, message: ${err.message}`); ...
https://github.com/ZestBox-18/kitebook-frontend
758ec372005f3cc94f98de94d9872403113272f7
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/platformOhos/UIContextManager.ets
arkts
getUIContext
获取 UIContext @returns UIContext 实例或 null @note API 23 适配:返回类型从 Object 改为 UIContext,可直接使用 UIContext 新方法
getUIContext(): UIContext | null { return this.uiContext; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUIContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi...
getUIContext(): UIContext | null { return this.uiContext; }
https://github.com/DaLongZhuaZi/NGF
ee3de810778f4f11766e84c5ff1aa48bffbe8e25
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
onScreenUnlocked
Handle screen unlock
async onScreenUnlocked(): Promise<void> { if (!isSessionActive) { return; } console.info(`${TAG}: Screen unlocked`); sessionIsScreenLocked = false; // If app is in foreground, exit background mode if (!isInBackground) { this.stopKeepaliveTimer(); if (currentI...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onScreenUnlocked AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef...
async onScreenUnlocked(): Promise<void> { if (!isSessionActive) { return; } console.info(`${TAG}: Screen unlocked`); sessionIsScreenLocked = false; // If app is in foreground, exit background mode if (!isInBackground) { this.stopKeepaliveTimer(); if (currentI...
https://github.com/tangwengang-del/freerdp-harmonyos
0b7d1072d422a3b9fc3956cb59f64b76131b67d9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets
arkts
assertCommon
Produce AssertionError if condition is false. Print an additinal message in this case @param {boolean} condition The provided condition. @param {string} message Optional comment printed when the assertion fails. @param {string} [description] description comment printed when the assertion fails. @throws {AssertionError...
function assertCommon(condition: boolean, message: string, description?: string): void { if (!condition) { failingAssertion(message, description) } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left assertCommon AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left condition AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function assertCommon(condition: boolean, message: string, description?: string): void { if (!condition) { failingAssertion(message, description) } }
https://gitcode.com/iop123123/arkts-static-skills
c00d0cd523c4d8d93d40cf9e91fc13cc32e7c801
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets
arkts
calAddSum
[End Case] [Start Case2]
function calAddSum(addNum: number): number { // count is expected to be int, do not declare it as undefined/null or 0.0, directly initialize it to 0 let count = 0; count += addNum; return count; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calAddSum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left addNum AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function calAddSum(addNum: number): number { // count is expected to be int, do not declare it as undefined/null or 0.0, directly initialize it to 0 let count = 0; count += addNum; return count; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
21c3e6cad8a0d213cf1d3bf6aff0b77e69d368fb
gitcode
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/events/EventsProcessor.ets
arkts
queryEventsByIds
根据EventIds查询出Events数据,用于生成Instances,先批量查询避免在for循环中查询 @param rdbStore rdb数据库 @param eventIds 需查询的eventIds集合 @return Map<number, Events> eventId-Events的map
async function queryEventsByIds(rdbStore: data_rdb.RdbStore, eventIds: Array<number>): Promise<Map<number, Events>> { const resultMap: Map<number, Events> = new Map(); const predicate = new dataSharePredicates.DataSharePredicates(); predicate.in(EventColumns.ID, eventIds); const ...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left queryEventsByIds AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AS...
async function queryEventsByIds(rdbStore: data_rdb.RdbStore, eventIds: Array<number>): Promise<Map<number, Events>> { const resultMap: Map<number, Events> = new Map(); const predicate = new dataSharePredicates.DataSharePredicates(); predicate.in(EventColumns.ID, eventIds); const ...
https://gitee.com/openharmony/applications_calendar_data.git
37894071c0e40647405e3bfc06a1e43deed7429e
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/PrivacyModeManager.ets
arkts
authenticateWithBiometric
启动生物识别验证 基于HarmonyOS官方文档的正确实现(API 12+)
public async authenticateWithBiometric(): Promise<boolean> { return new Promise<boolean>((resolve) => { try { logger.info(TAG, '开始生物识别验证'); // 生成随机challenge const rand = cryptoFramework.createRandom(); const len: number = 16; let randData: Uint8Array | null =...
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 authenticateWithBiometric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
public async authenticateWithBiometric(): Promise<boolean> { return new Promise<boolean>((resolve) => { try { logger.info(TAG, '开始生物识别验证'); // 生成随机challenge const rand = cryptoFramework.createRandom(); const len: number = 16; let randData: Uint8Array | null =...
https://github.com/DaLongZhuaZi/manxia
af660f2086cb82a39e23256540ff0776f9e3bc8e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
insertValues
Inserts values into Array @param beforeIndex @param values @returns a shallow copy of the underlying array and inserted data
private insertValues(beforeIndex: int, values: T[]): T[] { let len = this.data.length + values.length; let res = new T[len]; let n = beforeIndex; let k: int; if (n >= 0) { k = min(this.data.length - 1, n); } else { k = this.data.length + n; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left insertValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left beforeIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#i...
private insertValues(beforeIndex: int, values: T[]): T[] { let len = this.data.length + values.length; let res = new T[len]; let n = beforeIndex; let k: int; if (n >= 0) { k = min(this.data.length - 1, n); } else { k = this.data.length + n; ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
93ac4416fea2f0cd4cc131cfd12f01ab012212f5
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
saveCurrentSegment
保存当前已经流逝的专注时间切片
private saveCurrentSegment(): void { const segmentElapsed = this.segmentStartRemainingSeconds - this.remainingSeconds; if (segmentElapsed > 0) { this.saveFocusRecord(segmentElapsed); this.segmentStartRemainingSeconds = this.remainingSeconds; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveCurrentSegment 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 A...
private saveCurrentSegment(): void { const segmentElapsed = this.segmentStartRemainingSeconds - this.remainingSeconds; if (segmentElapsed > 0) { this.saveFocusRecord(segmentElapsed); this.segmentStartRemainingSeconds = this.remainingSeconds; } }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L156-L162
9d3b346e85882daf00d5f65491026a32f797447e
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/UsbDriverService.ets
arkts
unsubscribeUsbEvents
取消订阅 USB 事件
private unsubscribeUsbEvents(): void { if (this.usbSubscriber) { try { commonEventManager.unsubscribe(this.usbSubscriber); console.info(`${TAG} 已取消订阅 USB 事件`); } catch (err) { console.error(`${TAG} 取消订阅 USB 事件失败:`, err); } this.usbSubscriber = null; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left unsubscribeUsbEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private unsubscribeUsbEvents(): void { if (this.usbSubscriber) { try { commonEventManager.unsubscribe(this.usbSubscriber); console.info(`${TAG} 已取消订阅 USB 事件`); } catch (err) { console.error(`${TAG} 取消订阅 USB 事件失败:`, err); } this.usbSubscriber = null; } }
https://github.com/AlkaidLab/moonlight-harmony
fa74f93d9bad29c3f40efabf7b2550531796819a
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
createEntryFromTemplate
==================== 条目创建 ==================== 从模板创建新条目 @param template 模板对象 @param parentGroup 目标分组 @param options 应用选项 @returns 创建的条目
createEntryFromTemplate( template: ITemplate, parentGroup: KdbxGroup, options?: TemplateApplyOptions ): KdbxEntry { hilog.info(DOMAIN, TAG, `Creating entry from template: ${this.getTemplateName(template)}`); return this.factory.createEntry(template, parentGroup, options); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createEntryFromTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Rig...
createEntryFromTemplate( template: ITemplate, parentGroup: KdbxGroup, options?: TemplateApplyOptions ): KdbxEntry { hilog.info(DOMAIN, TAG, `Creating entry from template: ${this.getTemplateName(template)}`); return this.factory.createEntry(template, parentGroup, options); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L143-L150
ca6194efa308296a70b6d814b82399d05c233be7
github
Bistu-OSSDT-2024/16-ArkNotes
database/MemoTable.ets
arkts
updateData
更新数据的方法,接收单条memo笔记对象,和回调函数
updateData(memo: MemoModel, callback: Function) { // 通过工具函数,将单条memo笔记,转化为存储健值对 const valueBucket: relationalStore.ValuesBucket = generateBucket(memo); // 初始化操作数据库的谓词对象 let predicates = new relationalStore.RdbPredicates(CommonConstants.MEMO_TABLE.tableName); // 配置谓词以匹配数据表的id列中值的字段,为笔记对象的id pred...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left memo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MemoModel AST#identifier#Right...
updateData(memo: MemoModel, callback: Function) { // 通过工具函数,将单条memo笔记,转化为存储健值对 const valueBucket: relationalStore.ValuesBucket = generateBucket(memo); // 初始化操作数据库的谓词对象 let predicates = new relationalStore.RdbPredicates(CommonConstants.MEMO_TABLE.tableName); // 配置谓词以匹配数据表的id列中值的字段,为笔记对象的id pred...
https://github.com/Bistu-OSSDT-2024/16-ArkNotes
405f115a06e1178d0b6fcfa90fed4eaec081bea5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
extractPdfMetadata
提取PDF元数据
private extractPdfMetadata(): PdfMetadata { const fileName = this.getFileNameFromPath(this.config.pdfPath); const title = this.config.title || this.extractTitleFromFileName(fileName); const author = this.config.author || '未知作者'; const description = this.config.description || ''; // 尝试从PDF获取页面尺寸信息...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractPdfMetadata 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 ...
private extractPdfMetadata(): PdfMetadata { const fileName = this.getFileNameFromPath(this.config.pdfPath); const title = this.config.title || this.extractTitleFromFileName(fileName); const author = this.config.author || '未知作者'; const description = this.config.description || ''; // 尝试从PDF获取页面尺寸信息...
https://github.com/DaLongZhuaZi/manxia
7edad1f5f6c9f36a1bc0625cf4809f89ae83e723
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/LoginStateManager.ets
arkts
saveLoginState
保存登录状态到数据库
private async saveLoginState(): Promise<void> { if (!this.rdbStore) return; const value = JSON.stringify(this.loginState); const sqlUpsert = ` INSERT OR REPLACE INTO ${LOGIN_STATE_KEY} (id, key_name, key_value) VALUES (1, '${LOGIN_STATE_KEY}', '${value}') `; await this.rdbStore.execut...
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 saveLoginState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private async saveLoginState(): Promise<void> { if (!this.rdbStore) return; const value = JSON.stringify(this.loginState); const sqlUpsert = ` INSERT OR REPLACE INTO ${LOGIN_STATE_KEY} (id, key_name, key_value) VALUES (1, '${LOGIN_STATE_KEY}', '${value}') `; await this.rdbStore.execut...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
9bc2f5da5d55576a57f3b73de7f19c2e560e7358
github
HarmonyOS_Samples/BestPracticeSnippets
SegmentedPhotograph/entry/src/main/ets/entryability/EntryAbility.ets
arkts
requestPermissionsFn
Get permission
requestPermissionsFn(): void { let atManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(this.context, [ 'ohos.permission.CAMERA' ]).then((): void => { AppStorage.setOrCreate<boolean>('isShow', true); Logger.info(TAG, 'request Permissions success!'); }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left requestPermissionsFn 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#stateme...
requestPermissionsFn(): void { let atManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(this.context, [ 'ohos.permission.CAMERA' ]).then((): void => { AppStorage.setOrCreate<boolean>('isShow', true); Logger.info(TAG, 'request Permissions success!'); }...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
1f7307e117d38327cf9aca3ee99451a62c403134
gitcode
arkui-x/samples
CodeLab/Cases/feature/eraser/src/main/ets/model/RenderNodeModel.ets
arkts
aboutToResize
绑定的NodeContainer布局时触发,获取NodeContainer的宽高
aboutToResize(size: Size): void { if (this.rootRenderNode !== null) { // NodeContainer布局完成后设置rootRenderNode的背景透明 this.rootRenderNode.backgroundColor = 0X00000000; // rootRenderNode的位置从组件NodeContainer的左上角(0,0)坐标开始,大小为NodeContainer的宽高 this.rootRenderNode.frame = { x: 0, y: 0,...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToResize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Size AST#identifier#Right AST#)#Left ) AST...
aboutToResize(size: Size): void { if (this.rootRenderNode !== null) { // NodeContainer布局完成后设置rootRenderNode的背景透明 this.rootRenderNode.backgroundColor = 0X00000000; // rootRenderNode的位置从组件NodeContainer的左上角(0,0)坐标开始,大小为NodeContainer的宽高 this.rootRenderNode.frame = { x: 0, y: 0,...
https://gitcode.com/arkui-x/samples
67188cefc3429e58e98cd156d6090bc8495c1fe2
gitcode
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicApiClient.ets
arkts
httpFetch
HTTP 请求封装
private static httpFetch<T>(url: string, options?: HttpOptions): Promise<T> { return new Promise<T>((resolve, reject) => { const httpRequest = http.createHttp(); console.info(`[HTTP] 请求: ${url}`); const requestOptions: http.HttpRequestOptions = { method: options?.method || http.Request...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left httpFetch AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Righ...
private static httpFetch<T>(url: string, options?: HttpOptions): Promise<T> { return new Promise<T>((resolve, reject) => { const httpRequest = http.createHttp(); console.info(`[HTTP] 请求: ${url}`); const requestOptions: http.HttpRequestOptions = { method: options?.method || http.Request...
https://github.com/cpdd5201314/harmonyOS-music-app
63f944f3e71a2f6775e203f67b55fadcdd143491
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/render_control/If_Else_StateChangedPage.ets
arkts
build
组件一旋转角度
build() { Column() { if (this.data1) { // 如果在动画中增加/删除,会给Text增加默认转场 // 对于删除时,增加默认透明度转场后,会延长组件的生命周期,Text组件没有真正删除,而是等转场动画做完后才删除 Text(this.data1.str).fontColor(Color.Green).id("1") } else if (this.data2) { // 如果在动画中增加/删除,会给Text增加默认转场 Text(this.data2.str).fontColor(C...
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() { if (this.data1) { // 如果在动画中增加/删除,会给Text增加默认转场 // 对于删除时,增加默认透明度转场后,会延长组件的生命周期,Text组件没有真正删除,而是等转场动画做完后才删除 Text(this.data1.str).fontColor(Color.Green).id("1") } else if (this.data2) { // 如果在动画中增加/删除,会给Text增加默认转场 Text(this.data2.str).fontColor(C...
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/render_control/If_Else_StateChangedPage.ets#L20-L65
b882416c38c18473357e7d22b4f9332ae075a646
github
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/DrawableDescriptorReleaseTest.ets
arkts
Test010
E2E_010: AnimatedDrawableDescriptor release() -> loadSync() 抛出 111002
Test010() { const id = 'E2E_010' try { let drawable = this.CreateAnimatedDrawable() drawable.release() try { drawable.loadSync() this.Fail(id, '预期抛出 111002 但未抛出') } catch (e) { let code = this.GetErrorCode(e as Object) if (code === 111002) { th...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left Test010 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#...
Test010() { const id = 'E2E_010' try { let drawable = this.CreateAnimatedDrawable() drawable.release() try { drawable.loadSync() this.Fail(id, '预期抛出 111002 但未抛出') } catch (e) { let code = this.GetErrorCode(e as Object) if (code === 111002) { th...
https://gitcode.com/openharmony/arkui_ace_engine
e6f9b96d2aec453af3929ceeb7eff654f156afbc
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RuntimeLinker.ets
arkts
loadClass
Loads class into this linker's context. @param clsName name of the class. @param init indicator whether class must be initialized. @returns The found class. @throws LinkerClassNotFoundError if the class was not found or errors happened during class initialization.
public final loadClass(clsName: string, init: boolean = false): Class { const optClass = this.loadClassSafe(clsName, init) if (optClass) { return optClass } throw new LinkerClassNotFoundError(clsName) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left clsName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public final loadClass(clsName: string, init: boolean = false): Class { const optClass = this.loadClassSafe(clsName, init) if (optClass) { return optClass } throw new LinkerClassNotFoundError(clsName) }
https://gitcode.com/iop123123/arkts-static-skills
7a7f0571607184d411664db76df86caee7c696e3
gitcode
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
start
Runs prepare(); used when play() is requested before prepared.
private start(seekMs?: number) { Logger.info(TAG, 'AVPlayer play() isPrepared:' + this.isPrepared + ', state:' + this.state + ',seek:' + seekMs); if (this.avPlayer) { this.avPlayer.prepare().then(() => { }).catch((error: BusinessError) => { Logger.error(TAG, `start error ${JSON.stringify(e...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left seekMs AST#identifier#Right AST#?#Left ? A...
private start(seekMs?: number) { Logger.info(TAG, 'AVPlayer play() isPrepared:' + this.isPrepared + ', state:' + this.state + ',seek:' + seekMs); if (this.avPlayer) { this.avPlayer.prepare().then(() => { }).catch((error: BusinessError) => { Logger.error(TAG, `start error ${JSON.stringify(e...
https://gitcode.com/HarmonyOS_Samples/MusicHome
385045e54353f238ecc431de48b389ebcd05d803
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getSimilarArtists
@summary Gets similar items. @param {LibraryApiGetSimilarArtistsRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public async getSimilarArtists(requestParameters: LibraryApiGetSimilarArtistsRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Artists/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
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 getSimilarArtists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right...
public async getSimilarArtists(requestParameters: LibraryApiGetSimilarArtistsRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Artists/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
421690b6b263780b42e85cbfe1dc2f4de228db93
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
getCorrectCount
获取答对题数
getCorrectCount(): number { return this.session.correctCount; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCorrectCount 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#statem...
getCorrectCount(): number { return this.session.correctCount; }
https://github.com/zcg741/chengyu-game
3b9c9a6ef97a4174d9ea0ce95114f6ab270765ee
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateConstants.ets
arkts
protectedField
保护字段快捷创建函数(带资源引用)
function protectedField(key: string, value: string, placeholder: string | undefined, placeholderRes: Resource | undefined, required: boolean, keyRes: Resource | undefined): ITemplateField { return { key, value, isProtected: true, placeholder, placeholderRes, required, keyRes }; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left protectedField AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function protectedField(key: string, value: string, placeholder: string | undefined, placeholderRes: Resource | undefined, required: boolean, keyRes: Resource | undefined): ITemplateField { return { key, value, isProtected: true, placeholder, placeholderRes, required, keyRes }; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateConstants.ets#L20-L24
f47820213f6c56266838df40c4906d245b110e8a
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Row.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example RowSpaceAroundTop() { Text("A"); Text("B"); Text("C"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVal...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginVal...
https://github.com/Joker-x-dev/CoolMallArkTS
60879db7b1d42279c47ed23f96e07bb194a0e778
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/RealInterceptorChain.ets
arkts
request
Get the current request configuration. @returns The current request configuration.
request(): HttpRequestConfig { return this._request; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left request 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 HttpRequestConfig AST#identifier#Right AST#ERROR#Right...
request(): HttpRequestConfig { return this._request; }
https://github.com/killetom/ktretrofit
8d7d0084c82e2d4257b37a5965a4cf555c1b257c
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/PaginationManager.ets
arkts
applyState
根据页码与总页数刷新三元状态(currentPage/totalPages/hasMore)。 子类的 replaceWith / append 逻辑在各自维护完数组后调用本方法统一收口状态。 @param page - 本次提交对应的页码 @param totalPages - 服务端返回的总页数
protected applyState(page: number, totalPages: number): void { this.currentPage = page this.totalPages = totalPages this.hasMore = page < totalPages }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left applyState 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#identifier#L...
protected applyState(page: number, totalPages: number): void { this.currentPage = page this.totalPages = totalPages this.hasMore = page < totalPages }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L51-L55
96147748458f38306a5183c38563e8c7ed2181f2
github
WingedFin1251/Pvz-Gardendless-harmony
src/main/ets/pages/FilePickerHelper.ets
arkts
selectSavePath
打开系统文件选择器,让用户选择保存路径 @param defaultFileName 建议的文件名 @returns 用户选择的完整文件路径,取消时返回 null
async selectSavePath(defaultFileName: string): Promise<string | null> { const documentSaveOptions = new picker.DocumentSaveOptions(); documentSaveOptions.newFileNames = [defaultFileName]; // ✅ 移除强制Download模式,允许用户选择任意目录 // documentSaveOptions.pickerMode = picker.DocumentPickerMode.DOWNLOAD; const...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left selectSavePath AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left defaultFileName AST#identifier#Right AST#type_annotation#Left AS...
async selectSavePath(defaultFileName: string): Promise<string | null> { const documentSaveOptions = new picker.DocumentSaveOptions(); documentSaveOptions.newFileNames = [defaultFileName]; // ✅ 移除强制Download模式,允许用户选择任意目录 // documentSaveOptions.pickerMode = picker.DocumentPickerMode.DOWNLOAD; const...
https://github.com/WingedFin1251/Pvz-Gardendless-harmony
53261f6c14e869789a6998d8e63188d69f38162f
github
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
setTag
设置日志标识(该方法建议在Ability里调用) @param tag
static setTag(tag: string = LogUtil.tag) { LogUtil.tag = tag }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left...
static setTag(tag: string = LogUtil.tag) { LogUtil.tag = tag }
https://github.com/tdcare/tdwebrtc
ffe04e88e913d57a24caa0c05a5113299258e3da
github
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
screenSize
==================== 尺寸分级 ==================== 屏幕尺寸分级 small: < 340 vp(如 Watch D 320×320) standard: 340-460 vp(如 Watch GT 4 466×466) large: > 460 vp(未来大屏手表)
static get screenSize(): string { if (WearScreenUtil._screenSize === null) { const w = WearScreenUtil.screenWidth; // 触发 _initDimensions if (w < 340) { WearScreenUtil._screenSize = 'small'; } else if (w > 460) { WearScreenUtil._screenSize = 'large'; } else { WearScr...
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 screenSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
static get screenSize(): string { if (WearScreenUtil._screenSize === null) { const w = WearScreenUtil.screenWidth; // 触发 _initDimensions if (w < 340) { WearScreenUtil._screenSize = 'small'; } else if (w > 460) { WearScreenUtil._screenSize = 'large'; } else { WearScr...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
8fd4d5ae4cae67499a8a1b4eae3045190751d200
github
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
getStatus
Obtains the current video playing status.
getStatus() { return this.status; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getStatus 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...
getStatus() { return this.status; }
https://gitee.com/openharmony/codelabs.git
5e1bfc59ec75e01bdca9d7336b16ec8cce138edd
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
launchApp
启动应用/游戏
async launchApp(appId: number, config: LaunchConfig): Promise<string> { // 确保 appId 一致 const effectiveAppId = config.appId || appId; const query = this.buildLaunchQuery(effectiveAppId, config, 'launch'); const url = this.buildUrl(await this.getHttpsBaseUrl(), 'launch', query); // 启动可能需要较长时间,使用客户端...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left launchApp AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left appId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async launchApp(appId: number, config: LaunchConfig): Promise<string> { // 确保 appId 一致 const effectiveAppId = config.appId || appId; const query = this.buildLaunchQuery(effectiveAppId, config, 'launch'); const url = this.buildUrl(await this.getHttpsBaseUrl(), 'launch', query); // 启动可能需要较长时间,使用客户端...
https://github.com/AlkaidLab/moonlight-harmony
f9d114ae4b005e27d70bd0811049deaf7716906a
github
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets
arkts
isExposureModeSupported
检测曝光模式是否支持
public static isExposureModeSupported(captureSession: camera.PhotoSession | camera.VideoSession, mode: camera.ExposureMode): boolean { let isSupported: boolean = false; try { isSupported = captureSession.isExposureModeSupported(mode); } catch (error) { // 失败返回错误码error.code并处理 let err = e...
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 isExposureModeSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifi...
public static isExposureModeSupported(captureSession: camera.PhotoSession | camera.VideoSession, mode: camera.ExposureMode): boolean { let isSupported: boolean = false; try { isSupported = captureSession.isExposureModeSupported(mode); } catch (error) { // 失败返回错误码error.code并处理 let err = e...
https://gitee.com/openharmony-sig/flutter_packages.git
ba17fe23a929309e13d0cbd9cf68d1c209ec3b50
gitee
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/test/EncryptedDBTest.ets
arkts
mockQuery
Mock query operation
function mockQuery(): EncryptedEventLogRow[] { return mockTable }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mockQuery 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#array_type#Left A...
function mockQuery(): EncryptedEventLogRow[] { return mockTable }
https://gitcode.com/openharmony/codelabs
47565a5c125d3e72c050ea41b2770ea36538619d
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/OCRRecognition.ets
arkts
createEmptyStructuredData
创建空的结构化票据数据
static createEmptyStructuredData(): StructuredReceiptData { const result: StructuredReceiptData = { totalAmount: OCRUtils.createEmptyNumberField(), transactionDate: OCRUtils.createEmptyDateField(), transactionTime: OCRUtils.createEmptyStringField(), merchantName: OCRUtils.createEmptyString...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEmptyStructuredData 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#L...
static createEmptyStructuredData(): StructuredReceiptData { const result: StructuredReceiptData = { totalAmount: OCRUtils.createEmptyNumberField(), transactionDate: OCRUtils.createEmptyDateField(), transactionTime: OCRUtils.createEmptyStringField(), merchantName: OCRUtils.createEmptyString...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a50089bdd0cd1e1ce97ee4fe1bb2eae83dffc2d9
github
Delsin-Yu/JustPDF
entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets
arkts
peekPrevSetIndices
水平滑动预览:上一套页面索引;若无上一套则返回空数组
peekPrevSetIndices(): number[] { if (this.totalPageCount <= 0) { return []; } const baseDisplayed: number[] = this.slideNavEffectiveStartIndex !== undefined ? this.calculateDisplayIndices(this.slideNavEffectiveStartIndex) : this.displayedPageIndices; const raw = this.navigateToPrevio...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left peekPrevSetIndices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERRO...
peekPrevSetIndices(): number[] { if (this.totalPageCount <= 0) { return []; } const baseDisplayed: number[] = this.slideNavEffectiveStartIndex !== undefined ? this.calculateDisplayIndices(this.slideNavEffectiveStartIndex) : this.displayedPageIndices; const raw = this.navigateToPrevio...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets#L580-L594
b279a45d883502edf8a9419508a5c160f137b6cd
github
aintnece/TuiEditorHarmonyOS
entry/src/main/ets/editor/markdown/WwEditor.ets
arkts
onLoadTokenChange
── Initial content injection ──
onLoadTokenChange(): void { if (this.isReady) { this.applyInitial(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onLoadTokenChange 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_expressi...
onLoadTokenChange(): void { if (this.isReady) { this.applyInitial(); } }
https://github.com/aintnece/TuiEditorHarmonyOS
d0b4050876aacff6a1a9fa860d7c3c2b942450b9
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
getLoadError
Get native module load error
static getLoadError(): string | null { ensureNativeLoaded(); return nativeLoadError; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLoadError 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#expressio...
static getLoadError(): string | null { ensureNativeLoaded(); return nativeLoadError; }
https://github.com/tangwengang-del/freerdp-harmonyos
a9e590a751c8292fbea7853644358e07083fcfc4
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/features/mydemo/src/main/ets/Chart/dialog/McBarChart1.ets
arkts
build
构建UI布局视图
build() { Column() { Button('返回') .onClick(() => { this.dialogController?.close() }) McBarChart({ options: this.defOption }) } .height('90%') }
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() { Button('返回') .onClick(() => { this.dialogController?.close() }) McBarChart({ options: this.defOption }) } .height('90%') }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
808e344f27045f74d6d013e90a8aa3f31119d494
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AiKeyService.ets
arkts
loadSystemPrompt
加载并缓存 system prompt
private loadSystemPrompt(): string { if (cachedPrompt !== null) return cachedPrompt; const raw: Uint8Array = this.context.resourceManager.getRawFileContentSync(PROMPT_RAWFILE); const decoder = util.TextDecoder.create('utf-8'); cachedPrompt = decoder.decodeToString(raw); return cachedPrompt; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadSystemPrompt 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...
private loadSystemPrompt(): string { if (cachedPrompt !== null) return cachedPrompt; const raw: Uint8Array = this.context.resourceManager.getRawFileContentSync(PROMPT_RAWFILE); const decoder = util.TextDecoder.create('utf-8'); cachedPrompt = decoder.decodeToString(raw); return cachedPrompt; }
https://github.com/AlkaidLab/moonlight-harmony
cd9a9120e49f02bec3d08e5c71098891e15b59eb
github
arkui-x/samples
CodeLab/Cases/feature/applicationexception/src/main/ets/model/DataSource.ets
arkts
getData
获取指定数据项
public getData(index: number): string { return this.originDataArray[index]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public getData(index: number): string { return this.originDataArray[index]; }
https://gitcode.com/arkui-x/samples
f4aea9b560b4f65c4f0cad115c7ea42276828ff6
gitcode
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
products/phone/src/main/ets/pages/customScan/model/ScanLayout.ets
arkts
setHeightBreakpoint
When the width is less than 600, the height breakpoints are: 300, 480. BREAKPOINT_SM, BREAKPOINT_MD, BREAKPOINT_LG, or BREAKPOINT_XL When the width is greater than or equal to 600, the height breakpoints are: 480, 600. BREAKPOINT_SM or BREAKPOINT_MD, BREAKPOINT_LG, BREAKPOINT_XL
public setHeightBreakpoint(height: number): void { if (height < BreakpointConstants.MIDDLE_DEVICE_HEIGHT) { this.heightBreakpoint = BreakpointConstants.BREAKPOINT_SM; } else if (height < BreakpointConstants.LARGE_DEVICE_HEIGHT) { this.heightBreakpoint = BreakpointConstants.BREAKPOINT_MD; } els...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHeightBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left height AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public setHeightBreakpoint(height: number): void { if (height < BreakpointConstants.MIDDLE_DEVICE_HEIGHT) { this.heightBreakpoint = BreakpointConstants.BREAKPOINT_SM; } else if (height < BreakpointConstants.LARGE_DEVICE_HEIGHT) { this.heightBreakpoint = BreakpointConstants.BREAKPOINT_MD; } els...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
4829611dc38c92c0bd9dcf903718f33180e248fe
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/DatabaseConfigOptimizer.ets
arkts
printConfig
打印当前数据库配置
static async printConfig(): Promise<void> { try { const config = await DatabaseConfigOptimizer.getConfig(); console.log('\n========== 数据库配置信息 =========='); console.log(`Journal Mode: ${config.journalMode}`); console.log(`Cache Size: ${config.cacheSize} 页(约 ${(config.cacheSize * 4 / ...
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 printConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
static async printConfig(): Promise<void> { try { const config = await DatabaseConfigOptimizer.getConfig(); console.log('\n========== 数据库配置信息 =========='); console.log(`Journal Mode: ${config.journalMode}`); console.log(`Cache Size: ${config.cacheSize} 页(约 ${(config.cacheSize * 4 / ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
0b8c4f58b647e7e65d0c8a4f766ebbc1ec83d65d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
createDownloadTask
==================== 下载服务 ==================== 创建下载任务
public async createDownloadTask(comicId: string, chapterIds: string[]): Promise<string[]> { try { const taskIds: string[] = []; for (const chapterId of chapterIds) { const pages = await this.dataManager.getChapterPages(chapterId); const taskData: DownloadTaskInput = { ...
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 createDownloadTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#Le...
public async createDownloadTask(comicId: string, chapterIds: string[]): Promise<string[]> { try { const taskIds: string[] = []; for (const chapterId of chapterIds) { const pages = await this.dataManager.getChapterPages(chapterId); const taskData: DownloadTaskInput = { ...
https://github.com/DaLongZhuaZi/manxia
2e052479e8a27306144d9ec065761438c1483ea6
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setBorderColor
Sets the color of the chart border lines. @param color
public setBorderColor(color: number): void { if (this.mBorderPaint) { this.mBorderPaint.setColor(color); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBorderColor 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#identifier#Left ...
public setBorderColor(color: number): void { if (this.mBorderPaint) { this.mBorderPaint.setColor(color); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a3966f42cbfeeef56e00f70dcd016cc7ee1d1f64
gitee
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getNetworkTypeStr
获取网络类型,返回字符类型。
static async getNetworkTypeStr(): Promise<string> { const networkType = await NetworkUtil.getNetworkType(); switch (networkType) { case NetworkType.NETWORK_TYPE_WIFI: return "Wi-Fi"; case NetworkType.NETWORK_TYPE_2G: return "2G"; case NetworkType.NETWORK_TYPE_3G: retu...
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 getNetworkTypeStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
static async getNetworkTypeStr(): Promise<string> { const networkType = await NetworkUtil.getNetworkType(); switch (networkType) { case NetworkType.NETWORK_TYPE_WIFI: return "Wi-Fi"; case NetworkType.NETWORK_TYPE_2G: return "2G"; case NetworkType.NETWORK_TYPE_3G: retu...
https://github.com/tdcare/tdwebrtc
aec5355ec88e00aae0aa630dbab18707a91b0ea6
github
honjow/Next2V
feature/node/src/main/ets/viewmodel/NodeViewModel.ets
arkts
loadNodeTopicsV2
Load topics under the specified node (API v2, supports pagination, requires Token)
async loadNodeTopicsV2(nodeName: string, token: string, options?: NodeTopicPageOneLoadOptions): Promise<boolean> { const loadOptions = options || {} const requestId = loadOptions.requestId || 0 const source: NodeTopicPageOneSource = loadOptions.source || 'api_v2' this.isLoading = true this.errorMe...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadNodeTopicsV2 AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nodeName AST#identifier#Right AST#type_annotation#Left AST#:#L...
async loadNodeTopicsV2(nodeName: string, token: string, options?: NodeTopicPageOneLoadOptions): Promise<boolean> { const loadOptions = options || {} const requestId = loadOptions.requestId || 0 const source: NodeTopicPageOneSource = loadOptions.source || 'api_v2' this.isLoading = true this.errorMe...
https://github.com/honjow/Next2V
45f9280452acfce9197db2081fcdd539ac3b8939
github
honjow/Next2V
shared/src/main/ets/parser/V2exTabParser.ets
arkts
extractMainFeedTopicLinkIds
Main-feed topic ids only (id="topic-link-NNN"); deliberately omits the /t/NNN fallback so the right-sidebar hot-topic widget can never leak into a tab feed. extractTopicIds() keeps that fallback for member/node parsing.
private static extractMainFeedTopicLinkIds(clean: string): number[] { const ids: Set<number> = new Set() const topicLinkRegex = /id=["']topic-link-(\d+)["']/g let match: RegExpExecArray | null = topicLinkRegex.exec(clean) while (match !== null) { ids.add(parseInt(match[1], 10)) match = top...
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 extractMainFeedTopicLinkIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left clean AST#identifier#Rig...
private static extractMainFeedTopicLinkIds(clean: string): number[] { const ids: Set<number> = new Set() const topicLinkRegex = /id=["']topic-link-(\d+)["']/g let match: RegExpExecArray | null = topicLinkRegex.exec(clean) while (match !== null) { ids.add(parseInt(match[1], 10)) match = top...
https://github.com/honjow/Next2V
40efc57f60a2e740bd6958379de9144b405b2fae
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/BaseMapper.ets
arkts
getObject
查询得到对象 @param wrapper 查询条件 @returns 对象数组
async getObject(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<ESObject[]> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.list(myWrapper...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getObject AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left wrapper AST#identifier#Right AST#type_annotation#Left AST#:#...
async getObject(wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<ESObject[]> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.list(myWrapper...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L87-L116
2c579bdfee7cdc2cf168ea0dacd18d04dffc82b8
github
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
getLoginPageForm
========== Step 1: 获取 CAS 登录表单隐藏字段 ==========
async getLoginPageForm(onProgress?: (p: LoginProgress) => void): Promise<CasFormFields> { if (onProgress) { onProgress({ step: 'form', message: '获取登录页面...', percent: 5 }); } console.info(TAG, 'getLoginPageForm: requesting ' + this.LOGIN_PAGE); const resp: HttpResponse = await this.http.getNoRedi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getLoginPageForm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left onProgress AST#identifier#Ri...
async getLoginPageForm(onProgress?: (p: LoginProgress) => void): Promise<CasFormFields> { if (onProgress) { onProgress({ step: 'form', message: '获取登录页面...', percent: 5 }); } console.info(TAG, 'getLoginPageForm: requesting ' + this.LOGIN_PAGE); const resp: HttpResponse = await this.http.getNoRedi...
https://github.com/PollenWang6/HiXD
9dbf097dcd09d51be235a2182ff7febefe1d57b2
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
cacheServerInfo
缓存最新的 ServerInfo(轮询 / AppList 刷新成功时调用) 用于让"进入串流"链路跳过一次 HTTPS /serverinfo 请求。
cacheServerInfo(uuid: string, info: ServerInfo): void { if (!uuid) return; this.serverInfoCache.set(uuid, { info, timestamp: Date.now() }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cacheServerInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uuid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,...
cacheServerInfo(uuid: string, info: ServerInfo): void { if (!uuid) return; this.serverInfoCache.set(uuid, { info, timestamp: Date.now() }); }
https://github.com/AlkaidLab/moonlight-harmony
e473a1b108a438f815e354cf616de9bc251599db
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
addMessageTokenColumnsIfNeeded
添加消息 token 用量字段(prompt_tokens / completion_tokens / total_tokens,用于使用统计)
private async addMessageTokenColumnsIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.MESSAGES} ADD COLUMN prompt_tokens INTEGER DEFAULT 0`) } catch (_error) { console.info('DatabaseService', 'prompt_toke...
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 addMessageTokenColumnsIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_exp...
private async addMessageTokenColumnsIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.MESSAGES} ADD COLUMN prompt_tokens INTEGER DEFAULT 0`) } catch (_error) { console.info('DatabaseService', 'prompt_toke...
https://github.com/LongLiveY96/chatcube
5868a5cd3f34b596881de843f533775ff386f192
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
encodedFragment
Gets the encoded fragment part of this URI, everything after the '#'. @returns { string | null }
get encodedFragment(): string | null { let s: string = this.uriEntry.getFragment(); return s == '' ? null : s; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left encodedFragment 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_stat...
get encodedFragment(): string | null { let s: string = this.uriEntry.getFragment(); return s == '' ? null : s; }
https://gitcode.com/iop123123/arkts-static-skills
a4026f8b0f0dec8470fc38b1bc3399aa239702a2
gitcode
who7708/harmonyos-codelabs
HmosWorld/commons/common/src/main/ets/service/datasource/network/agc/FuncNetwork.ets
arkts
getResourceDetail
************************************* DISCOVER ***************************************** @param resourceId @param userId @returns ResourceDetail
public getResourceDetail(resourceId: string): Promise<ResourceDetail> { const params: GetResourceDetailParams = { resourceId, userId: (AppStorage.get<UserAccount>('user') as UserAccount)?.id }; return new Promise((resolve: (value: ResourceDetail | PromiseLike<ResourceDetail>) => void, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getResourceDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
public getResourceDetail(resourceId: string): Promise<ResourceDetail> { const params: GetResourceDetailParams = { resourceId, userId: (AppStorage.get<UserAccount>('user') as UserAccount)?.id }; return new Promise((resolve: (value: ResourceDetail | PromiseLike<ResourceDetail>) => void, ...
https://github.com/who7708/harmonyos-codelabs
b521f92c91884deeec90b8d748d30186591eb6a8
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaBuilder.ets
arkts
createTableWithManager
使用 DatabaseManager 执行建表操作 @param metadata 实体元数据 @returns Promise<CreateTableResult>
async createTableWithManager(metadata: EntityMetadata): Promise<CreateTableResult> { try { const store = DatabaseManager.getInstance().getStore() return await this.createTable(store, metadata) } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error) ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createTableWithManager AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left metadata AST#identifier#Right AST#type_annotation#Left A...
async createTableWithManager(metadata: EntityMetadata): Promise<CreateTableResult> { try { const store = DatabaseManager.getInstance().getStore() return await this.createTable(store, metadata) } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error) ...
https://github.com/offlinecat-dev/OCNetORM
fbf18e26f17e124e5d2226873756d07b9713b5c4
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test24_original_index.ets
arkts
testMultiVarDecl
--- Multiple variable declarations with initializers ---
function testMultiVarDecl(): string { let a: number = 1; let b: number = 2; let c: number = 3; let sum: number = a + b + c; let prod: number = a * b * c; return String(sum) + ',' + String(prod); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMultiVarDecl 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...
function testMultiVarDecl(): string { let a: number = 1; let b: number = 2; let c: number = 3; let sum: number = a + b + c; let prod: number = a * b * c; return String(sum) + ',' + String(prod); }
https://github.com/miaochiahao/ark-ghidra
1f134dd965f926d233cddbc4f763a4ddcedff3c6
github
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/components/ChatList.ets
arkts
aboutToDisappear
普通函数声明返回类型为 void
aboutToDisappear(): void { emitter.off(10002); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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_b...
aboutToDisappear(): void { emitter.off(10002); }
https://gitcode.com/openharmony/codelabs
1e4c768792376385471de914157238b2ca232c3b
gitcode
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
updateAlarm
修改闹钟,同时更新闹钟的提醒信息 isIntentMode 意图框架调用此方法的标识 @param alarmInfo 闹钟对象
async updateAlarm(alarmInfo: AlarmInfo, isIntentMode?: boolean): Promise<void> { if (!alarmInfo.id) { LogUtil.error(TAG, 'Execute method updateAlarm failed, params is incorrect.'); return; } // EventReportUtil.reportEvent(hiSysEvent.EventType.BEHAVIOR, EventName.CLOCK_ALARM_SAVE_SETTING) a...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateAlarm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AS...
async updateAlarm(alarmInfo: AlarmInfo, isIntentMode?: boolean): Promise<void> { if (!alarmInfo.id) { LogUtil.error(TAG, 'Execute method updateAlarm failed, params is incorrect.'); return; } // EventReportUtil.reportEvent(hiSysEvent.EventType.BEHAVIOR, EventName.CLOCK_ALARM_SAVE_SETTING) a...
https://gitee.com/openharmony-sig/applications_clock.git
958488b68478c633650956de3b4749bc7236c68b
gitee
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets
arkts
release
释放监听事件
release(): void { try { this.mainWindow.off('windowStatusChange'); this.mainWindow.off('windowSizeChange'); this.mainWindow.off('avoidAreaChange'); } catch (error) { let err = error as BusinessError; hilog.error(0x0000, 'TestLog', `Failed to off. Code: ${err.code}, message: ${err...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left release AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left...
release(): void { try { this.mainWindow.off('windowStatusChange'); this.mainWindow.off('windowSizeChange'); this.mainWindow.off('avoidAreaChange'); } catch (error) { let err = error as BusinessError; hilog.error(0x0000, 'TestLog', `Failed to off. Code: ${err.code}, message: ${err...
https://github.com/ZestBox-18/kitebook-frontend
e96e68e9db6acea79279616c426c179e52db0784
github
openharmony/arkui_advanced_ui_component
atomicservicetabs/source/atomicservicetabs.ets
arkts
barPositionChangeBySingleMode
单图标或文本场景下监听位置变化影响tabbar高度布局样式
barPositionChangeBySingleMode(): void { if (this.isIconTextExist) { return; } if (this.tabBarPosition === TabBarPosition.LEFT) { this.tabBarHeight = (50 / this.tabBarOptionsArray.length + '%'); this.barModeStatus = BarMode.Scrollable; } else { this.barModeStatus = BarMode.Fixed...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left barPositionChangeBySingleMode 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#{#Left { AST#{...
barPositionChangeBySingleMode(): void { if (this.isIconTextExist) { return; } if (this.tabBarPosition === TabBarPosition.LEFT) { this.tabBarHeight = (50 / this.tabBarOptionsArray.length + '%'); this.barModeStatus = BarMode.Scrollable; } else { this.barModeStatus = BarMode.Fixed...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
93bd84be2de75edb929c2766affdc9e6ebc09370
gitee
Countly/countly-sdk-hos
library/src/main/ets/internal/DeviceInfo.ets
arkts
collectDiskMetrics
Disk metrics for the app sandbox (`context.filesDir`). Async because `statvfs.getTotalSize` ships as a Promise; `getFreeSizeSync` exists but the sync total variant is unconfirmed, so both run async for symmetry. Returns `_disk_total` / `_disk_current` in MB (matches Android units). On any failure (no context, permissio...
public static async collectDiskMetrics(context: common.Context | null): Promise<Record<string, string>> { const out: Record<string, string> = {}; if (context === null) return out; try { const path: string = context.filesDir; const total: number = await statvfs.getTotalSize(path); const f...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left collectDiskMetrics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
public static async collectDiskMetrics(context: common.Context | null): Promise<Record<string, string>> { const out: Record<string, string> = {}; if (context === null) return out; try { const path: string = context.filesDir; const total: number = await statvfs.getTotalSize(path); const f...
https://github.com/Countly/countly-sdk-hos
ec0cd23c222fe88c5ef2866b4d9f9a77e031ca8c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
saveEBook
保存电子书信息到数据库
public async saveEBook(ebook: EBook, options: SaveEBookOptions = {}): Promise<void> { try { let preservedImageReaderSettings: ImageReaderSettings | null = null; let preservedImageReaderSettingsSource: string = ''; const title = ebook.metadata?.title || ebook.id || '未知书籍'; logger.info(TAG, ...
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 saveEBook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left : AST#:#...
public async saveEBook(ebook: EBook, options: SaveEBookOptions = {}): Promise<void> { try { let preservedImageReaderSettings: ImageReaderSettings | null = null; let preservedImageReaderSettingsSource: string = ''; const title = ebook.metadata?.title || ebook.id || '未知书籍'; logger.info(TAG, ...
https://github.com/DaLongZhuaZi/manxia
5825bf8afe7b8e0c92af56654e3dbd0b2a6c834b
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosEngineHost.ets
arkts
executeMethodAsync
Engine-utils dispatcher pair, replicated from the scaffold pages/index.ets module prologue (the engine resolves jsb reflection calls through these).
function executeMethodAsync(nativeFunc: Function, funcData: string, funCb: Function): void { nativeFunc(funcData, funCb); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left executeMethodAsync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nativeFunc AST#identifier#Right AST#type_annotation#Left AST#:#Left...
function executeMethodAsync(nativeFunc: Function, funcData: string, funCb: Function): void { nativeFunc(funcData, funCb); }
https://github.com/terryma2024/happyword
7ad7050c09b8917cc16a54a1d5f7787f01f4c81e
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
mergeImportKeys
合并导入:将 JSON 中的按键合并到当前活跃配置 与 importProfile 不同,不创建新配置,而是将按键追加到当前配置中。 每个导入按键分配新 ID,略微偏移位置避免完全重叠。 @returns 合并的按键数量,失败返回 -1
static async mergeImportKeys(json: string): Promise<number> { try { const data = JSON.parse(json) as ExportData; if (!data.profile || !Array.isArray(data.profile.keys) || data.profile.keys.length === 0) { return -1; } CustomKeyStore.migrateProfileKeys(data.profile); const pro...
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 mergeImportKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : A...
static async mergeImportKeys(json: string): Promise<number> { try { const data = JSON.parse(json) as ExportData; if (!data.profile || !Array.isArray(data.profile.keys) || data.profile.keys.length === 0) { return -1; } CustomKeyStore.migrateProfileKeys(data.profile); const pro...
https://github.com/AlkaidLab/moonlight-harmony
0dd9a83a78a02ffcdbf23198468a086449bbadb2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
getVisibleShelves
获取可见书架(根据内容数量过滤) @param mangaCount 漫画数量 @param ebookCount 电子书数量 @param novelCount 小说数量
getVisibleShelves(mangaCount: number, ebookCount: number, novelCount: number): TypeShelf[] { return this.getShelves().filter(shelf => { // 自定义书架始终显示 if (!shelf.isSystem) { return true; } // 系统书架根据内容数量决定是否显示 if (shelf.contentTypes.includes(ShelfContentType.MANGA) && mangaCount...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getVisibleShelves AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaCount AST#identi...
getVisibleShelves(mangaCount: number, ebookCount: number, novelCount: number): TypeShelf[] { return this.getShelves().filter(shelf => { // 自定义书架始终显示 if (!shelf.isSystem) { return true; } // 系统书架根据内容数量决定是否显示 if (shelf.contentTypes.includes(ShelfContentType.MANGA) && mangaCount...
https://github.com/DaLongZhuaZi/manxia
1e91e73975196d87e8c7915fe4e25e9549e580eb
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
getNodeFavoriteToggleActionWithCookie
Get the follow/unfollow toggle link for a node (requires Cookie session)
async getNodeFavoriteToggleActionWithCookie( cookie: string, nodeName: string, ): Promise<V2exToggleAction> { const cleanName = (nodeName || '').trim() if (!cookie) { throw ApiErrors.authRequired() } if (!cleanName) { throw ApiErrors.invalidNode() } const nodePath = `/go/...
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getNodeFavoriteToggleActionWithCookie AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left c...
async getNodeFavoriteToggleActionWithCookie( cookie: string, nodeName: string, ): Promise<V2exToggleAction> { const cleanName = (nodeName || '').trim() if (!cookie) { throw ApiErrors.authRequired() } if (!cleanName) { throw ApiErrors.invalidNode() } const nodePath = `/go/...
https://github.com/honjow/Next2V
6ab7f4e9f05fb8456b0c96d4ba9a59ed76142f47
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets
arkts
clear
Delete all elements of the TreeMap
clear(): void { this.elementNum = 0; this.rootEntry = undefined; }
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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): void { this.elementNum = 0; this.rootEntry = undefined; }
https://gitcode.com/iop123123/arkts-static-skills
6bdf10ba36d53ffc429d9e1d135d1aadcc6ee5d6
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets
arkts
getTaskStatus
获取章节预加载状态
public getTaskStatus(chapterId: string): PreloadTask | null { return this.tasks.get(chapterId) || null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTaskStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
public getTaskStatus(chapterId: string): PreloadTask | null { return this.tasks.get(chapterId) || null; }
https://github.com/DaLongZhuaZi/manxia
50f6bf8f50fa6fa888a025784e7ea1c7fcb6c674
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
getSystemFontName
获取系统字体名称
private getSystemFontName(fontId: string): string { const systemFont = SYSTEM_FONTS.find(f => f.id === fontId); return systemFont?.name || 'HarmonyOS Sans'; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSystemFontName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fontId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private getSystemFontName(fontId: string): string { const systemFont = SYSTEM_FONTS.find(f => f.id === fontId); return systemFont?.name || 'HarmonyOS Sans'; }
https://github.com/DaLongZhuaZi/manxia
f256c89edabcdc019f09b575320c991cd9f6eae0
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/SettingsBackupService.ets
arkts
importFromFile
通过系统文件选择器从文件导入设置
static async importFromFile(): Promise<boolean> { try { const documentPicker = new picker.DocumentViewPicker(); const selectOptions = new picker.DocumentSelectOptions(); selectOptions.maxSelectNumber = 1; selectOptions.fileSuffixFilters = ['.mlbk', '.json']; const uris = await docume...
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 importFromFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async importFromFile(): Promise<boolean> { try { const documentPicker = new picker.DocumentViewPicker(); const selectOptions = new picker.DocumentSelectOptions(); selectOptions.maxSelectNumber = 1; selectOptions.fileSuffixFilters = ['.mlbk', '.json']; const uris = await docume...
https://github.com/AlkaidLab/moonlight-harmony
429d63c9130df4fd293fc317ebd1fb92660c6173
github
CLMC2025/Vignette
entry/src/main/ets/manager/SessionPlanner.ets
arkts
getStatusText
获取任务状态文本
getStatusText(): string { if (!this.isCompleted()) { return '待完成'; } if (this.isCorrect === undefined) { return '待评价'; } return this.isCorrect ? '正确' : '错误'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatusText 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#statemen...
getStatusText(): string { if (!this.isCompleted()) { return '待完成'; } if (this.isCorrect === undefined) { return '待评价'; } return this.isCorrect ? '正确' : '错误'; }
https://github.com/CLMC2025/Vignette
5eb56252e2fc53311454c49cc3ced825bfd3cc63
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/RemoteKeyDispatcher.ets
arkts
collectModifierCodes
============================================================ 内部辅助 ============================================================
private collectModifierCodes(getLatch: LatchGetter): number[] { const codes: number[] = []; if (getLatch('ctrl') !== 'off') { codes.push(KEYCODE_CTRL_LEFT); } if (getLatch('alt') !== 'off') { codes.push(KEYCODE_ALT_LEFT); } if (getLatch('shift') !== 'off') { codes.push(KEYCOD...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left collectModifierCodes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left getLatch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private collectModifierCodes(getLatch: LatchGetter): number[] { const codes: number[] = []; if (getLatch('ctrl') !== 'off') { codes.push(KEYCODE_CTRL_LEFT); } if (getLatch('alt') !== 'off') { codes.push(KEYCODE_ALT_LEFT); } if (getLatch('shift') !== 'off') { codes.push(KEYCOD...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
5a22cf064920f39288fbc79577889768d90e8555
github
YANGZX22/Voot
entry/src/main/ets/pages/ApiConfigPage.ets
arkts
onIndexChange
标记是否有待执行的动画 监听索引变化,标记需要动画
onIndexChange() { if (this.currentSlotIndex !== this.previousIndex) { this.pendingAnimation = true; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onIndexChange 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...
onIndexChange() { if (this.currentSlotIndex !== this.previousIndex) { this.pendingAnimation = true; } }
https://github.com/YANGZX22/Voot
346a3c3d6ad76da749c7fd4d048766612d9a40be
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/LoginStateManager.ets
arkts
isLoggedIn
判断是否已登录
isLoggedIn(): boolean { return this.loginState.isLoggedIn; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLoggedIn 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#statemen...
isLoggedIn(): boolean { return this.loginState.isLoggedIn; }
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
57477d72a740110d77981e4997ba3a62cdd86f41
github
CLMC2025/Vignette
entry/src/main/ets/algorithm/Algorithm.ets
arkts
constructor
Days until next review
constructor( newState: FSRSState, nextReviewMs: number, intervalDays: number ) { this.newState = newState; this.nextReviewMs = nextReviewMs; this.intervalDays = intervalDays; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newState AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FSRSState AST#identifier#...
constructor( newState: FSRSState, nextReviewMs: number, intervalDays: number ) { this.newState = newState; this.nextReviewMs = nextReviewMs; this.intervalDays = intervalDays; }
https://github.com/CLMC2025/Vignette
66ac691cc3b742a8cefde1dbf6d8e3c616889167
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/AudioManager.ets
arkts
addToPlaylist
添加到播放列表 @param song 歌曲
addToPlaylist(song: SongInfo): void { this.playlist.push(song); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SongInfo AST#identifier#Right AST#)#Left )...
addToPlaylist(song: SongInfo): void { this.playlist.push(song); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
a43a7982032fd5f0b7289a44f90a9fa677762b98
github
Tencent-RTC/TUIKit_Harmony
call/src/main/ets/feature/CallingVibratorFeature.ets
arkts
init
Idempotent. Subscribes to status transitions so an accepted / rejected / cancelled call stops the vibrator immediately — `onCallEnded` only fires on hang-up, never on pickup.
init(): void { if (this.subscribed) { return; } this.subscribed = true; CallStatusObserver().addListener((status: CallParticipantStatus): void => { if (status === CallParticipantStatus.waiting) { return; } this.stop(); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#v...
init(): void { if (this.subscribed) { return; } this.subscribed = true; CallStatusObserver().addListener((status: CallParticipantStatus): void => { if (status === CallParticipantStatus.waiting) { return; } this.stop(); }); }
https://github.com/Tencent-RTC/TUIKit_Harmony
ee983580dc35710e0a4ea5252dbc03085350ee96
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/ParentAdminFlow.ui.test.ets
arkts
ensureParentPin
Idempotent PIN seeder. Mirrors WishlistFlow.ui.test.ets's ensureParentPin so this suite can run independently of configFlowUiTest's ordering. Re-committing the same PIN is a no-op from the operator's perspective: ParentPinSetupPage's commitOrReset() persists `firstBuf` into AppStorage and routes back to ConfigPage eith...
async function ensureParentPin(driver: Driver, pin: string): Promise<void> { try { await clickByIdShared(driver, 'HomeConfigButton'); await driver.delayMs(1500); // V0.6.5.1: scroll iteratively until the parent-PIN button is on // screen — the packPickerSection between autoSpeak and parentPin // c...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left ensureParentPin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#t...
async function ensureParentPin(driver: Driver, pin: string): Promise<void> { try { await clickByIdShared(driver, 'HomeConfigButton'); await driver.delayMs(1500); // V0.6.5.1: scroll iteratively until the parent-PIN button is on // screen — the packPickerSection between autoSpeak and parentPin // c...
https://github.com/terryma2024/happyword
9299be881d2b8edc8202e78b033f66174e9019fa
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/ProfilePage.ets
arkts
onThemeChange
主题变化回调
onThemeChange() { // 主题已变化,组件会自动重新渲染 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onThemeChange 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...
onThemeChange() { // 主题已变化,组件会自动重新渲染 }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
c58a11063d172b4177278735cb4fec51093a1bca
github