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
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/DeviceTypeUtil.ets
arkts
isTablet
判断是否为平板设备
public isTablet(): boolean { return this.currentDeviceType === DeviceType.TABLET; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isTablet 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#bool...
public isTablet(): boolean { return this.currentDeviceType === DeviceType.TABLET; }
https://github.com/LJ666-ui/harmony-health-care
7ee45981d61012d340543d2ab00b3c2f19c9c169
github
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/CommonEventManager.ets
arkts
createSubscriber
Create a subscriber.
public createSubscriber(): void { try { commonEventManager.createSubscriber(this.subscribeInfo, (error: BusinessError, commonEventSubscriber: commonEventManager.CommonEventSubscriber) => { this.createCB(error, commonEventSubscriber); }); } catch (error) { Logger.error(TAG...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createSubscriber 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#expre...
public createSubscriber(): void { try { commonEventManager.createSubscriber(this.subscribeInfo, (error: BusinessError, commonEventSubscriber: commonEventManager.CommonEventSubscriber) => { this.createCB(error, commonEventSubscriber); }); } catch (error) { Logger.error(TAG...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
ee7e8d1ec6c9be7e15fef97d8dcf7c535ad42c0c
gitcode
2763981847/Clock-Alarm
entry/src/main/ets/viewmodel/AlarmClockViewModel.ets
arkts
fillZero
为数字填充前导零。 @param val number 要填充的数字 @return content string 填充后的字符串
public static fillZero(val: number): string { return (val > AlarmClockConstants.DEFAULT_SINGLE_DIGIT_MAX ? val.toString() : (AlarmClockConstants.DEFAULT_ZEROING + val)); }
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 fillZero AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Ri...
public static fillZero(val: number): string { return (val > AlarmClockConstants.DEFAULT_SINGLE_DIGIT_MAX ? val.toString() : (AlarmClockConstants.DEFAULT_ZEROING + val)); }
https://github.com/2763981847/Clock-Alarm
a4f81bdd43ac976f08c0bb0ee6950f12ba70dc03
github
yanglfree/CopoHub-Multi
flutter/ohos/entry/src/main/ets/plugins/IapPlugin.ets
arkts
queryOwnedPurchases
── queryOwnedPurchases ──────────────────────────────────────────────────────
private async queryOwnedPurchases(result: MethodResult): Promise<void> { const context = this.context; if (!context) { result.error('NO_CONTEXT', 'Context is not available', null); return; } try { const owned: OwnedPurchase[] = []; // Query non-consumable (lifetime). tr...
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 queryOwnedPurchases AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:...
private async queryOwnedPurchases(result: MethodResult): Promise<void> { const context = this.context; if (!context) { result.error('NO_CONTEXT', 'Context is not available', null); return; } try { const owned: OwnedPurchase[] = []; // Query non-consumable (lifetime). tr...
https://github.com/yanglfree/CopoHub-Multi
e7e7d3a4564b69c793f15de23d22301710890d96
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
reduceRight
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param { function } callbackfn - A function that accepts four arguments. The reduceR...
public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint8Array) => number): number { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: number = this.$_get(this....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#L...
public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint8Array) => number): number { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: number = this.$_get(this....
https://gitcode.com/iop123123/arkts-static-skills
fd64ef123e4fe5a296a7ac5e2e018c1ef6e888b0
gitcode
openharmony-sig/earth
hpauditor/tests/issues/expected/issue407.ets.audit.ets
arkts
handleHorizontalRelease
双中心横滑切换、单中心反向横滑-面板的离手动效
private handleHorizontalRelease(value: number): void { /* HPAudit: Use strict equality operators : hp-specs-strict-equality-ops : 1 : 11 : issue407.ets */ if (this.dropDownEvent.target !== this.currentPanel) { this.contentTransX = this.horizontalDropPanelPosition * value; return; } animate...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleHorizontalRelease 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#iden...
private handleHorizontalRelease(value: number): void { /* HPAudit: Use strict equality operators : hp-specs-strict-equality-ops : 1 : 11 : issue407.ets */ if (this.dropDownEvent.target !== this.currentPanel) { this.contentTransX = this.horizontalDropPanelPosition * value; return; } animate...
https://gitee.com/openharmony-sig/earth.git
25a36de8692f4f56beff1a45aa52b50b62b9f168
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array-like or iterable object. @param { ArrayLike<T> } arrayLike - An array-like or iterable object to convert to an array. @param { function } mapfn - A mapping function to call on every element of the array. @returns { Int8Array } - A new Int8Array @static @syscap SystemCapability.Utils.Lang ...
public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Int8Array { let res = new Int8Array(arrayLike.length) // NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by unknown ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identif...
public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Int8Array { let res = new Int8Array(arrayLike.length) // NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by unknown ...
https://gitcode.com/iop123123/arkts-static-skills
bf37381cc49f800e2e83aeab8662823a5ca9b56c
gitcode
wanrenhuifu/JLU
harmonyos-鸿蒙实训/jilinuniversity-homework/entry/src/main/ets/pages/PerferencesTest.ets
arkts
aboutToAppear
第三步 获取Preferences实例 getPreferences方法 注意 在页面构建前先要获取到实例 页面获取上下文 getContext
aboutToAppear(): void { dataPreferences = preferences.getPreferencesSync(getContext(Content), { name: 'mystore' }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#object_pattern#Left AST#{#Left...
aboutToAppear(): void { dataPreferences = preferences.getPreferencesSync(getContext(Content), { name: 'mystore' }) }
https://github.com/wanrenhuifu/JLU
9bacdf83427ca452991c0dd422cd96d1e069e4a6
github
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/UserState.ets
arkts
updateAuth
更新认证信息(例如刷新 token) @param {Auth} auth - 新的认证信息 @returns {void} 无返回值 @example getUserState().updateAuth(new Auth({ token: "abc" }));
updateAuth(auth: Auth): void { this.auth = Auth.fromResponse(auth); new TokenStoreRepository().saveToken(this.auth.token); this.persist(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left auth AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Auth AST#identifier#Right AST#)#Left ) AST#)#...
updateAuth(auth: Auth): void { this.auth = Auth.fromResponse(auth); new TokenStoreRepository().saveToken(this.auth.token); this.persist(); }
https://github.com/Joker-x-dev/CoolMallArkTS
7aa00ce7aefa53a83e7aa432fbd9f62b68000676
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
addOnlinePageInfo
添加在线页面信息(完整版)
public async addOnlinePageInfo(pageInput: OnlinePageInfoInput): Promise<string> { try { const now = Date.now(); const pageId = this.generateId(); const sql = `INSERT INTO online_page (id, chapterId, pageNumber, imageUrl, requestHeaders, width, height, fileSize, createTime) ...
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 addOnlinePageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageInput AST#identifier#Right AST#:#L...
public async addOnlinePageInfo(pageInput: OnlinePageInfoInput): Promise<string> { try { const now = Date.now(); const pageId = this.generateId(); const sql = `INSERT INTO online_page (id, chapterId, pageNumber, imageUrl, requestHeaders, width, height, fileSize, createTime) ...
https://github.com/DaLongZhuaZi/manxia
94de31c263e6668b2f00de1eadca907b5296dfc7
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/BudgetOverviewCardComponent.ets
arkts
MetricItem
构建预算卡右侧的单个指标项。
private MetricItem(label: string, value: string) { Column({ space: 4 }) { Text(label) .fontSize(this.compactLayout ? 11 : 12) .fontWeight(FontWeight.Medium) .fontColor(this.themeState.brand) Text(value) .fontSize(this.compactLayout ? 14 : 17) .fontWeight(FontWei...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left MetricItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
private MetricItem(label: string, value: string) { Column({ space: 4 }) { Text(label) .fontSize(this.compactLayout ? 11 : 12) .fontWeight(FontWeight.Medium) .fontColor(this.themeState.brand) Text(value) .fontSize(this.compactLayout ? 14 : 17) .fontWeight(FontWei...
https://github.com/ZestBox-18/kitebook-frontend
4bb189e4db024cfe0ec3c4691684c6fe3781834f
github
CLMC2025/Vignette
entry/src/main/ets/ui/ProgressCharts.ets
arkts
LineChart
线性图表组件
@Builder function LineChart( title: string, data: ChartDataPoint[], showLabels: boolean = true ): void { Column() { Text(title) .fontSize(16) .fontWeight(FontWeight.Bold) .fontColor(DesignTokens.Colors.TEXT_PRIMARY) .margin({ bottom: 16 }) Stack() { // 简化实现:使用Progress模拟线...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left LineChart AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#require...
@Builder function LineChart( title: string, data: ChartDataPoint[], showLabels: boolean = true ): void { Column() { Text(title) .fontSize(16) .fontWeight(FontWeight.Bold) .fontColor(DesignTokens.Colors.TEXT_PRIMARY) .margin({ bottom: 16 }) Stack() { // 简化实现:使用Progress模拟线...
https://github.com/CLMC2025/Vignette
aae1f269ed90a7a80c5e752fea22b4fb48279198
github
aimilin6688/KeePassHO
entry/src/main/ets/entryability/EntryAbility.ets
arkts
isLockScreen
是否锁屏 @returns
private isLockScreen(): boolean { let dbFileParam = FileService.getDbFileParam(); return dbFileParam && dbFileParam.filePath !== undefined; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isLockScreen 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 A...
private isLockScreen(): boolean { let dbFileParam = FileService.getDbFileParam(); return dbFileParam && dbFileParam.filePath !== undefined; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/entryability/EntryAbility.ets#L226-L229
9e733604a2d0afcce9021a3501dca8e0d46af721
github
2763981847/Accounting-app
entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
batchInsert
批量插入账目数据
batchInsert(accounts: Account[], callback: Function) { // 将账户数据转换为值桶数组 const valueBuckets: relationalStore.ValuesBucket[] = accounts.map((account) => generateBucket(account)); // 调用 Rdb 对象的批量插入数据方法,并传入回调函数 this.accountTable.batchInsert(valueBuckets, callback) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left batchInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left accounts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#...
batchInsert(accounts: Account[], callback: Function) { // 将账户数据转换为值桶数组 const valueBuckets: relationalStore.ValuesBucket[] = accounts.map((account) => generateBucket(account)); // 调用 Rdb 对象的批量插入数据方法,并传入回调函数 this.accountTable.batchInsert(valueBuckets, callback) }
https://github.com/2763981847/Accounting-app
2d748c62a7f9087659b74584c847b8c5c58a8141
github
honjow/Next2V
feature/detail/src/main/ets/pages/TopicDetailPage.ets
arkts
restoreReadPosition
IT-Home-style restore: do NOT auto-scroll to the saved floor on entry. Instead pre-load the replies up to that floor (so the later tap can land precisely) and surface the resume button. The user is left at the top; tapping the button performs the actual jump.
private restoreReadPosition(): void { if (this.hasRestoredReadPosition || this.topicId <= 0) { return } this.hasRestoredReadPosition = true const context = this.getUIContext().getHostContext() as common.UIAbilityContext CollectionSettings.getTopicReadFloor(context, this.topicId) .then(...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left restoreReadPosition 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...
private restoreReadPosition(): void { if (this.hasRestoredReadPosition || this.topicId <= 0) { return } this.hasRestoredReadPosition = true const context = this.getUIContext().getHostContext() as common.UIAbilityContext CollectionSettings.getTopicReadFloor(context, this.topicId) .then(...
https://github.com/honjow/Next2V
c505870748d5053170273ae58e3ee91ef61089d2
github
HarmonyOS_Samples/BestPracticeSnippets
TaskPoolPractice/entry/src/main/ets/pages/sample1/Sample1.ets
arkts
wrongConcurrentFunc
[End bar] [Start wrong] Sample1.ets
@Concurrent function wrongConcurrentFunc() { try { let bar: Bar = new Bar; } catch (e) { let error: BusinessError = e; hilog.error(0xFF00, 'sampleTag', 'error occur: ' + error.message); } }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left wrongConcurrentFunc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Righ...
@Concurrent function wrongConcurrentFunc() { try { let bar: Bar = new Bar; } catch (e) { let error: BusinessError = e; hilog.error(0xFF00, 'sampleTag', 'error occur: ' + error.message); } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
02a9e5070c7c037147b153888ebfae106639a961
gitcode
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets
arkts
notifyThemeStateUpdate
Notify ThemeState to check for color mode updates
private static notifyThemeStateUpdate(): void { try { ThemeState.getInstance().checkCurrentColorMode() } catch (error) { hilog.warn(0x0000, 'ContextProvider', 'Failed to notify ThemeState: %{public}s', JSON.stringify(error)); } }
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 notifyThemeStateUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private static notifyThemeStateUpdate(): void { try { ThemeState.getInstance().checkCurrentColorMode() } catch (error) { hilog.warn(0x0000, 'ContextProvider', 'Failed to notify ThemeState: %{public}s', JSON.stringify(error)); } }
https://github.com/Tencent-RTC/TUIKit_Harmony
ea46fc148dd85bb874accd2ff331e190c8f74897
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getAttendanceRule
获取考勤规则
async getAttendanceRule(): Promise<ApiResponse<any>> { return this.get<any>('/api/attendance/rule') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAttendanceRule AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge...
async getAttendanceRule(): Promise<ApiResponse<any>> { return this.get<any>('/api/attendance/rule') }
https://github.com/David8Idira/AI-OA
1538da2fb11f87fd248e174be866d41067c8dc6e
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
refreshCurrent
Refresh the current tab.
refreshCurrent() { if (this.currentTab && !this.currentTab.isLoading) { this.currentTab.refresh(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshCurrent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
refreshCurrent() { if (this.currentTab && !this.currentTab.isLoading) { this.currentTab.refresh(); } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
31fa6fddd4db19f288b2092e4d117929d8a3c6e7
github
HarmonyOS_Samples/BestPracticeSnippets
PreHttpRequestUseFiles/entry/src/main/ets/utils/NetRequest.ets
arkts
readWriteFileWithStream
Write to the sandbox
async function readWriteFileWithStream(imageData: ArrayBuffer): Promise<void> { let outputStream: fileIo.Stream = fileIo.createStreamSync(fileUrl, 'w+'); await outputStream.write(imageData); outputStream.closeSync(); }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left readWriteFileWithStream AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageData AST#identifier#...
async function readWriteFileWithStream(imageData: ArrayBuffer): Promise<void> { let outputStream: fileIo.Stream = fileIo.createStreamSync(fileUrl, 'w+'); await outputStream.write(imageData); outputStream.closeSync(); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
ea1928556e0ece11a305872e08aafa3e53f8301a
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
asinh
Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value of this Decimal. @returns { Decimal } the Decimal type @throws { BusinessError } 10200060 - Precision limit exceeded.
public asinh(): Decimal { let x: Decimal = this; if (!x.isFinite() || x.isZero()) { return new Decimal(x); } let pr = Decimal.precision; let rm = Decimal.rounding; Decimal.precision = pr + 2 * Math.max(Math.abs(x.e), x.precision()) + 6; Decimal.ro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left asinh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public asinh(): Decimal { let x: Decimal = this; if (!x.isFinite() || x.isZero()) { return new Decimal(x); } let pr = Decimal.precision; let rm = Decimal.rounding; Decimal.precision = pr + 2 * Math.max(Math.abs(x.e), x.precision()) + 6; Decimal.ro...
https://gitcode.com/iop123123/arkts-static-skills
844f8eb22b6aa88bb36bf5150f9ff6c3ce046239
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/Logger.ets
arkts
warn
Warn 级别日志
warn(msg: string, ...args: (string | number | boolean | object | undefined | null)[]): void { const formattedMsg = this.formatMessage(msg, args); hilog.warn(DOMAIN, this.tag, '%{public}s', formattedMsg); this.writeToFile(LogLevel.WARN, 'WARN', formattedMsg); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left warn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right...
warn(msg: string, ...args: (string | number | boolean | object | undefined | null)[]): void { const formattedMsg = this.formatMessage(msg, args); hilog.warn(DOMAIN, this.tag, '%{public}s', formattedMsg); this.writeToFile(LogLevel.WARN, 'WARN', formattedMsg); }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
3f917b49c9960c898a0cc8d2708d11621e886c2e
github
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
initWidthMultiple
初始化多列类型
initWidthMultiple(){ let options = this.options as IBestPickerOption[][] let value: IBestStringNumber[] = JSON.parse(JSON.stringify(this.value)) if(!value.length){ value = Array(options.length).fill('') } options.forEach((item, index) => { let i = item.findIndex(e => e.value == value[index]) i = i >...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initWidthMultiple 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#...
initWidthMultiple(){ let options = this.options as IBestPickerOption[][] let value: IBestStringNumber[] = JSON.parse(JSON.stringify(this.value)) if(!value.length){ value = Array(options.length).fill('') } options.forEach((item, index) => { let i = item.findIndex(e => e.value == value[index]) i = i >...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L410-L425
167ae64bc89243bbd44334c38a878a08e40fab37
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test2_original_index.ets
arkts
testArrayAccess
=== Destructuring ===
function testArrayAccess(): string { let arr: number[] = [10, 20, 30]; let a: number = arr[0]; let b: number = arr[1]; let c: number = arr[2]; return String(a + b + c); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayAccess 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 testArrayAccess(): string { let arr: number[] = [10, 20, 30]; let a: number = arr[0]; let b: number = arr[1]; let c: number = arr[2]; return String(a + b + c); }
https://github.com/miaochiahao/ark-ghidra
c2da52ad09d5ce698a8aefae031552293dc05dde
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreEBookLibrary
恢复电子书库 [重构] 使用文件夹结构,更新文件路径和封面路径
private async restoreEBookLibrary(items: EBookBackupItem[]): Promise<void> { logger.info(TAG, `正在恢复电子书库: ${items.length} 项`); const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); const sandboxEbooksDir = `${this.sandboxManager.getDirectory('files')}/ebooks`; // 确定基础目录 c...
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 restoreEBookLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#...
private async restoreEBookLibrary(items: EBookBackupItem[]): Promise<void> { logger.info(TAG, `正在恢复电子书库: ${items.length} 项`); const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); const sandboxEbooksDir = `${this.sandboxManager.getDirectory('files')}/ebooks`; // 确定基础目录 c...
https://github.com/DaLongZhuaZi/manxia
26a89e23291d76a569426f2a5d38913048f71a0c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
getGridDashPathEffect
returns the DashPathEffect that is set for grid line @return
public getGridDashPathEffect(): DashPathEffect | null { return this.mGridDashPathEffect; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGridDashPathEffect 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#binary_expressio...
public getGridDashPathEffect(): DashPathEffect | null { return this.mGridDashPathEffect; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
da4463aaccaeb2ee2be981d6fef7882dc04d221f
gitee
arkui-x/samples
CodeLab/Cases/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
getData
获取指定索引数据 @param {number} index - 索引值 @returns {VideoDataType} 返回指定索引数据
public getData(index: number): VideoDataType { return this.dataArray[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): VideoDataType { return this.dataArray[index]; }
https://gitcode.com/arkui-x/samples
6330cdf1e843a186a7c9476a0c47c7a5380dcd4b
gitcode
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
saveSearchRecord
保存搜索记录
static async saveSearchRecord(keyword: string, resultCount: number, source: string): Promise<void> { try { if (!SearchHistoryManager.checkInitialized()) { throw new SearchHistoryError('SearchHistoryManager 未初始化,请先调用 init() 方法') } const records = await SearchHistoryManager.getSearchHisto...
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 saveSearchRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async saveSearchRecord(keyword: string, resultCount: number, source: string): Promise<void> { try { if (!SearchHistoryManager.checkInitialized()) { throw new SearchHistoryError('SearchHistoryManager 未初始化,请先调用 init() 方法') } const records = await SearchHistoryManager.getSearchHisto...
https://github.com/cpdd5201314/harmonyOS-music-app
1ed410fcd5e060dad151f98a0a6183c495131c8b
github
LongLiveY96/chatcube
entry/src/main/ets/services/WebSearchService.ets
arkts
getConfig
通过 preference key 获取引擎配置值
getConfig(prefKey: string, defaultValue: string = ''): string { return this.engineConfigs.get(prefKey) ?? defaultValue }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left prefKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Righ...
getConfig(prefKey: string, defaultValue: string = ''): string { return this.engineConfigs.get(prefKey) ?? defaultValue }
https://github.com/LongLiveY96/chatcube
5bbb3673c4fd4575f38b763e53b920a0efa1fa04
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets
arkts
scanImageFiles
扫描图片文件
private async scanImageFiles(dir: string): Promise<ComicPageInfo[]> { try { const files = await this.sandboxManager.listDirectory(dir); const imageFiles: ComicPageInfo[] = []; for (const file of files) { const filePath = `${dir}/${file}`; const fileInfo = await this.sandbo...
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 scanImageFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#:#Left : ...
private async scanImageFiles(dir: string): Promise<ComicPageInfo[]> { try { const files = await this.sandboxManager.listDirectory(dir); const imageFiles: ComicPageInfo[] = []; for (const file of files) { const filePath = `${dir}/${file}`; const fileInfo = await this.sandbo...
https://github.com/DaLongZhuaZi/manxia
4719c05f25a88100fa8d16ca670764065ad279cb
github
openharmony-sig/knowledge_demo_entainment
FA/BombGame/entry/src/main/ets/MainAbility/pages/RemoteDeviceManager.ets
arkts
startDeviceDiscovery
启动发现设备
startDeviceDiscovery() { CommonLog.info("startDeviceDiscovery") this.init().then(() => { this.dmInstance.on('deviceStateChange', (data) => { CommonLog.info('deviceStateChange data=' + JSON.stringify(data)); switch (data.action) { // ONLINE case 0: CommonLog.info('ONLINE a device ! deviceI...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startDeviceDiscovery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo...
startDeviceDiscovery() { CommonLog.info("startDeviceDiscovery") this.init().then(() => { this.dmInstance.on('deviceStateChange', (data) => { CommonLog.info('deviceStateChange data=' + JSON.stringify(data)); switch (data.action) { // ONLINE case 0: CommonLog.info('ONLINE a device ! deviceI...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
f46ccc83daf577dc55fd9e7b7189f06cb709a4fa
gitee
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
onRangeStopScrollChanged
视频范围选择结束
onRangeStopScrollChanged() { let start: number = this.scroller.currentOffset().xOffset; // 计算开始位置 let startPosition: number = start * 1000.0 / this.msPxAvg startPosition = Math.max(0, Math.floor(startPosition)); // 计算结束位置 let endPosition: number = startPosition + this.mRangSeekBarOption.mMaxC...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onRangeStopScrollChanged 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...
onRangeStopScrollChanged() { let start: number = this.scroller.currentOffset().xOffset; // 计算开始位置 let startPosition: number = start * 1000.0 / this.msPxAvg startPosition = Math.max(0, Math.floor(startPosition)); // 计算结束位置 let endPosition: number = startPosition + this.mRangSeekBarOption.mMaxC...
https://github.com/openharmony/applications_app_samples
55b4590f61fde3203d6edc6e6a55ea9e81495057
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
setFormToTextSpace
sets the space between the form and the actual label/text, converts to dp internally @param space
public setFormToTextSpace(space: number): void { this.mFormToTextSpace = space; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFormToTextSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left space AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setFormToTextSpace(space: number): void { this.mFormToTextSpace = space; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
27bcfccf5849fce8b35c3ffa10cae2d8a4ad70af
gitee
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/UserHandler.ets
arkts
insertUser
将之前的插入逻辑移到这里
async insertUser(userData: UserModel) { if (!this.store) { console.error('数据库尚未初始化,请先调用 initDB'); return; } const valueBucket: relationalStore.ValuesBucket = { avatarPath: userData.avatarPath, nickName: userData.nickName, country: userData.country, phoneNumber: userDat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insertUser AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userData AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async insertUser(userData: UserModel) { if (!this.store) { console.error('数据库尚未初始化,请先调用 initDB'); return; } const valueBucket: relationalStore.ValuesBucket = { avatarPath: userData.avatarPath, nickName: userData.nickName, country: userData.country, phoneNumber: userDat...
https://gitcode.com/openharmony/codelabs
23a6a0ef425497f4f26c038d72bdf254f8c45b08
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/entryability/EntryAbility.ets
arkts
extractAndSetupHelper
从 rawfile 提取 rustdesk_helper 到 App 沙箱, 并通过 NAPI 配置 IPC 路径。
private extractAndSetupHelper(): void { try { // 设置 IPC socket 路径 (内置 C++ helper pthread, 不需要外部二进制) const socketPath: string = this.context.filesDir + '/rustdesk_helper.sock'; ExtensionLoader.getInstance().setHelperSocketPath(socketPath, ''); hilog.info(DOMAIN, TAG, 'RustDesk IPC socket 路径...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractAndSetupHelper 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 voi...
private extractAndSetupHelper(): void { try { // 设置 IPC socket 路径 (内置 C++ helper pthread, 不需要外部二进制) const socketPath: string = this.context.filesDir + '/rustdesk_helper.sock'; ExtensionLoader.getInstance().setHelperSocketPath(socketPath, ''); hilog.info(DOMAIN, TAG, 'RustDesk IPC socket 路径...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
3b01c70982313e4029f1f35518796476b687de8b
github
huangyuanlove/HelloArkUI
entry/src/main/ets/pages/playground/take_photo/TakePhotoPage.ets
arkts
getAllCamerasPositionStr
展示在弹窗中相机列表
getAllCamerasPositionStr(devices: camera.CameraDevice[]): string[] { let result: string[] = [] for (let i = 0; i < devices.length; i++) { result.push(this.getCameraPositionStr(devices[i])) } return result }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAllCamerasPositionStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left devices AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST...
getAllCamerasPositionStr(devices: camera.CameraDevice[]): string[] { let result: string[] = [] for (let i = 0; i < devices.length; i++) { result.push(this.getCameraPositionStr(devices[i])) } return result }
https://github.com/huangyuanlove/HelloArkUI
c3ae08204f1fb518b21d5cae34877ec881519912
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets
arkts
checkPendingTasks
检查待处理任务
private async checkPendingTasks(): Promise<void> { if (!this.webviewController || this.pendingTasks.size === 0) { return; } const taskIds = Array.from(this.pendingTasks.keys()); for (let i = 0; i < taskIds.length; i++) { const taskId = taskIds[i]; const task = this.pendingTasks....
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 checkPendingTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async checkPendingTasks(): Promise<void> { if (!this.webviewController || this.pendingTasks.size === 0) { return; } const taskIds = Array.from(this.pendingTasks.keys()); for (let i = 0; i < taskIds.length; i++) { const taskId = taskIds[i]; const task = this.pendingTasks....
https://github.com/DaLongZhuaZi/manxia
18181de43b769bf5f0c20d056a3a8f8a75261476
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/FileUtils.ets
arkts
revokePermission
取消文件持久化权限 @param path 文件路径 @returns 结果 @throws BusinessError
public static revokePermission(path: string, operationMode: fileShare.OperationMode): Promise<void> { if (!canIUse(FileUtils.FolderAuthorization)) { throw new Error('this api is not supported on this device'); } let policyInfo: fileShare.PolicyInfo = { uri: path, operationMode: operation...
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 revokePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left :...
public static revokePermission(path: string, operationMode: fileShare.OperationMode): Promise<void> { if (!canIUse(FileUtils.FolderAuthorization)) { throw new Error('this api is not supported on this device'); } let policyInfo: fileShare.PolicyInfo = { uri: path, operationMode: operation...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FileUtils.ets#L74-L84
64dc87ab83c60215bb6207d43254da0398fa2022
github
zmuxuny/ai-guardian-star
entry/src/main/ets/common/UserManager.ets
arkts
getCurrentUsername
获取当前登录用户名(统一入口,保证一致性) @returns 当前用户名,未登录时返回默认用户名
public getCurrentUsername(): string { return AppStorage.get<string>(UserManager.STORAGE_KEY) ?? UserManager.DEFAULT_USERNAME; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentUsername 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 ...
public getCurrentUsername(): string { return AppStorage.get<string>(UserManager.STORAGE_KEY) ?? UserManager.DEFAULT_USERNAME; }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/UserManager.ets#L29-L31
5b8554fd4eec77e3bc5a21cc55b2f1bbc40e476a
github
ibestservices/ibest-ui
library/src/main/ets/components/tag/index.ets
arkts
getTagSize
根据size获取tag的尺寸
getTagSize() { const tagSize = this.tagSize switch (tagSize) { case 'medium': return new TagSizeData(this.baseStyle.spaceX as string, convertDimensionsWidthUnit(20), this.baseStyle.fontSizeSm as string, this.getBorderRadius(this.baseStyle.borderRadiusSm as string)) case SIZE.LARGE: return new Ta...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getTagSize 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...
getTagSize() { const tagSize = this.tagSize switch (tagSize) { case 'medium': return new TagSizeData(this.baseStyle.spaceX as string, convertDimensionsWidthUnit(20), this.baseStyle.fontSizeSm as string, this.getBorderRadius(this.baseStyle.borderRadiusSm as string)) case SIZE.LARGE: return new Ta...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/tag/index.ets#L99-L112
467ef0570f6befd4f65f7f20c95570a9e21c314f
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test30_original_index.ets
arkts
greet
=== Round 30: Default parameters, rest parameters, nested try-catch with throw, Object.assign/Object.keys/values, Map advanced, Set operations, instanceof with inheritance, typeof type guard, Object.keys iteration === --- Default parameters ---
function greet(name: string, greeting: string = 'Hello'): string { return greeting + ', ' + name + '!'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left greet AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function greet(name: string, greeting: string = 'Hello'): string { return greeting + ', ' + name + '!'; }
https://github.com/miaochiahao/ark-ghidra
b2c3e60dc51c4f54bda5454a870ff7ca84abbfa3
github
Dige945/EmoCollector
entry/src/main/ets/model/DBManager.ets
arkts
delete
删除指定 ID 的记录 @param id 记录 ID @returns 删除成功返回受影响的行数,失败返回 0
public async delete(id: number): Promise<number> { if (!this.rdbStore) { console.error('[DBManager] 数据库未初始化'); return 0; } try { // 构造删除条件:WHERE id = ? const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.equalTo(this.COLUMN_ID, id); // 执行...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
public async delete(id: number): Promise<number> { if (!this.rdbStore) { console.error('[DBManager] 数据库未初始化'); return 0; } try { // 构造删除条件:WHERE id = ? const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.equalTo(this.COLUMN_ID, id); // 执行...
https://github.com/Dige945/EmoCollector
c6be5d1cab5fd22d9ede15c3be30f6c7a8b5307c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WindowManager.ets
arkts
getMainWindowFromUIContext
通过UIContext获取主窗口(推荐方式) 在@Component组件中使用:WindowManager.getMainWindowFromUIContext(this.getUIContext())
static getMainWindowFromUIContext(uiContext: UIContext | undefined): window.Window | null { try { if (!uiContext) { logger.error(WindowManager.TAG, '❌ UIContext为空'); return null; } const hostContext = uiContext.getHostContext() as common.UIAbilityContext; if (!hostContext ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMainWindowFromUIContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
static getMainWindowFromUIContext(uiContext: UIContext | undefined): window.Window | null { try { if (!uiContext) { logger.error(WindowManager.TAG, '❌ UIContext为空'); return null; } const hostContext = uiContext.getHostContext() as common.UIAbilityContext; if (!hostContext ...
https://github.com/DaLongZhuaZi/manxia
1dcd99f8483a432da06a6c6c18bcd0865263b29f
github
CLMC2025/Vignette
entry/src/main/ets/database/DBManager.ets
arkts
close
Close database connection
async close(): Promise<void> { if (this.store !== null) { this.store = null; this.initialized = false; this.wordRepo.setStore(null); this.reviewEventRepo.setStore(null); this.vignetteCacheRepo.setStore(null); this.wordBookRepo.setStore(null); this.textRepo.setStore(null);...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left close AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef...
async close(): Promise<void> { if (this.store !== null) { this.store = null; this.initialized = false; this.wordRepo.setStore(null); this.reviewEventRepo.setStore(null); this.vignetteCacheRepo.setStore(null); this.wordBookRepo.setStore(null); this.textRepo.setStore(null);...
https://github.com/CLMC2025/Vignette
a09cd44a34e475bece7ec5d83598b4d3894937a5
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/Rect.ets
arkts
inset
Insets the rectangle on all sides specified by the insets. @hide @param left The amount to add from the rectangle's left @param top The amount to add from the rectangle's top @param right The amount to subtract from the rectangle's right @param bottom The amount to subtract from the rectangle's bottom
public inset(left: number, top: number, right: number, bottom: number) { this.left += left; this.top += top; this.right -= right; this.bottom -= bottom; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left inset AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left left AST#identifier#Right AST#:#Left : AST#...
public inset(left: number, top: number, right: number, bottom: number) { this.left += left; this.top += top; this.right -= right; this.bottom -= bottom; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9fc366af7e46d22256e9748d748464eec890e108
gitee
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/RecurringBillDatabase.ets
arkts
deleteConfig
删除定期配置
async deleteConfig(id: number): Promise<number> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.CONFIG_TABLE); predicates.equalTo('id', id); try { const rows = await this.rdbStore.delete(predicates); console.info('...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type...
async deleteConfig(id: number): Promise<number> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.CONFIG_TABLE); predicates.equalTo('id', id); try { const rows = await this.rdbStore.delete(predicates); console.info('...
https://github.com/qiuhaotc/HarmonyOSPlayground
2956b331a25718c6cf0eb404d4b77748d27824c0
github
Joker-x-dev/CoolMallArkTS
feature/common/src/main/ets/view/WebPage.ets
arkts
build
构建网页页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "网页", viewModel: this.vm }) { this.WebContent(); } }
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#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "网页", viewModel: this.vm }) { this.WebContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
99856568fdba8e98ab0920bb73f39f5af7df5707
github
LiMingKuan-UESTC/HarmonyOs-Clock-Demo
entry/src/main/ets/pages/TimePickerPage.ets
arkts
aboutToAppear
用来保存 type
aboutToAppear() { const params = router.getParams() as TimePickerType if (params) { this.type = params.type ?? '' // 保存 type } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { const params = router.getParams() as TimePickerType if (params) { this.type = params.type ?? '' // 保存 type } }
https://github.com/LiMingKuan-UESTC/HarmonyOs-Clock-Demo
4c21d8b477ebe2fc71df559848c8c8294981bfd9
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
holtWintersDouble
Holt-Winters 双参数指数平滑
static holtWintersDouble(data: number[], alpha: number, beta: number, periodsAhead: number): number { if (data.length < 2) { if (data.length === 1) { return data[0]; } return 0; } let level = data[0]; let trend = data[1] - data[0]; for (let i = 1; i < data.length; i++) ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left holtWintersDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expr...
static holtWintersDouble(data: number[], alpha: number, beta: number, periodsAhead: number): number { if (data.length < 2) { if (data.length === 1) { return data[0]; } return 0; } let level = data[0]; let trend = data[1] - data[0]; for (let i = 1; i < data.length; i++) ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
55e71c95379a6f9929481b17c1a4f2d1f04ba83f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/MdnsDiscovery.ets
arkts
resolveService
解析服务获取详细信息(旧方法,保留兼容)
private async resolveService(serviceInfo: mdns.LocalServiceInfo): Promise<void> { try { const resolvedService = await mdns.resolveLocalService(this.context, serviceInfo); console.info(`MdnsDiscovery: 解析服务 ${resolvedService.serviceName}`); console.info(` - 主机地址: ${resolvedService.host?.address}...
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 resolveService AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left serviceInfo AST#identifier...
private async resolveService(serviceInfo: mdns.LocalServiceInfo): Promise<void> { try { const resolvedService = await mdns.resolveLocalService(this.context, serviceInfo); console.info(`MdnsDiscovery: 解析服务 ${resolvedService.serviceName}`); console.info(` - 主机地址: ${resolvedService.host?.address}...
https://github.com/AlkaidLab/moonlight-harmony
0ccb4a4acef55bac60bdfb6317ca9c2887331570
github
the-wwyang/kids-learning-app
src/main/ets/services/QuestionCacheService.ets
arkts
getStatistics
========== 调试和统计方法 ========== 获取缓存统计信息
getStatistics(): CacheStatistics { let totalQuestions = 0; this.questionPools.forEach(pool => { totalQuestions += pool.length; }); const recentAnswers = this.answerHistory.slice(-this.difficultyConfig.windowSize); const correctCount = recentAnswers.filter(a => a.isCorrect).length; const...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatistics 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 CacheStatistics AST#identifier#Right AST#ERROR#R...
getStatistics(): CacheStatistics { let totalQuestions = 0; this.questionPools.forEach(pool => { totalQuestions += pool.length; }); const recentAnswers = this.answerHistory.slice(-this.difficultyConfig.windowSize); const correctCount = recentAnswers.filter(a => a.isCorrect).length; const...
https://github.com/the-wwyang/kids-learning-app
003b4fd1f41e6d3b676f15a71bdc21cf840d0cca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/ImageCacheManager.ets
arkts
clearMemoryCache
清空内存缓存
public clearMemoryCache(): void { try { // 释放所有PixelMap for (const entry of this.memoryCache.values()) { entry.pixelMap.release(); } this.memoryCache.clear(); this.memoryCacheSize = 0; logger.info(TAG, '内存缓存已清空'); } catch (error) { logger.error(TAG, '清空内存缓存失败'...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearMemoryCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#vo...
public clearMemoryCache(): void { try { // 释放所有PixelMap for (const entry of this.memoryCache.values()) { entry.pixelMap.release(); } this.memoryCache.clear(); this.memoryCacheSize = 0; logger.info(TAG, '内存缓存已清空'); } catch (error) { logger.error(TAG, '清空内存缓存失败'...
https://github.com/DaLongZhuaZi/manxia
0ac7b41d652830f8a2836d4aa3fbceb4f84e9960
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/discover/src/main/ets/model/DiscoverModel.ets
arkts
search
search resource by keywords on search page
search(value: string): void { // Update search history. if (!this.searchHistory.includes(value)) { // Add the current search content to the top of the search history. this.searchHistory.unshift(value); } else { // Move an existing search to the top of the search history. this.searc...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#R...
search(value: string): void { // Update search history. if (!this.searchHistory.includes(value)) { // Add the current search content to the top of the search history. this.searchHistory.unshift(value); } else { // Move an existing search to the top of the search history. this.searc...
https://gitcode.com/HarmonyOS_Samples/hmosworld
3f2fae245be0f85df4446c14250aecfe1272a796
gitcode
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onUnhandledException
应用注册后,当应用产生未捕获 catch 的异常时的回调,做统一的错误管理
async onUnhandledException() { const logs = await FaultLogger.query(FaultLogger.FaultType.JS_CRASH) const currentLog = logs[0] console.error('errorManager', JSON.stringify(currentLog)) // 上报错误到服务器 axios.post('https://guardian-api.itheima.net/log/fault/report/single', curren...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onUnhandledException AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left {...
async onUnhandledException() { const logs = await FaultLogger.query(FaultLogger.FaultType.JS_CRASH) const currentLog = logs[0] console.error('errorManager', JSON.stringify(currentLog)) // 上报错误到服务器 axios.post('https://guardian-api.itheima.net/log/fault/report/single', curren...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
83271da8e7e180637e265d926fa41d45fbc50a52
gitcode
kumaleap/ArkLuban
library/src/main/ets/luban/LubanEngine.ets
arkts
generateCompressedFileName
生成压缩后的文件名 @param originalPath 原文件路径 @param targetDir 目标目录 @param customName 自定义名称 @returns 目标文件路径
static generateCompressedFileName( originalPath: string, targetDir: string, customName?: string ): string { if (customName) { return `${targetDir}/${customName}`; } const extension = LubanEngine.getOutputExtension(originalPath, false); const fileName = LubanUtils.generateOutputFil...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateCompressedFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left s...
static generateCompressedFileName( originalPath: string, targetDir: string, customName?: string ): string { if (customName) { return `${targetDir}/${customName}`; } const extension = LubanEngine.getOutputExtension(originalPath, false); const fileName = LubanUtils.generateOutputFil...
https://github.com/kumaleap/ArkLuban
cbd95b973ad9da4a331b541e86c6f1e135fdedeb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
addBrowseHistoryListener
添加历史浏览变化监听器
addBrowseHistoryListener(listener: () => void): void { this.browseHistoryListeners.push(listener); }
AST#program#Left AST#ERROR#Left AST#identifier#Left addBrowseHistoryListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Rig...
addBrowseHistoryListener(listener: () => void): void { this.browseHistoryListeners.push(listener); }
https://github.com/DaLongZhuaZi/manxia
39a5e08375d75c98f12abe3d3a2b3d354482ede9
github
openharmony-sig/shimmer-ohos
library/src/main/ets/components/MainPage/Shimmer.ets
arkts
setIntensity
Sets the intensity of the shimmer. A larger value causes the shimmer to be larger.
setIntensity(intensity: number): Shimmer { if (intensity < 0) { throw new Error("Given invalid intensity value: " + intensity); } this.intensity = intensity; return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setIntensity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left intensity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)...
setIntensity(intensity: number): Shimmer { if (intensity < 0) { throw new Error("Given invalid intensity value: " + intensity); } this.intensity = intensity; return this }
https://gitee.com/openharmony-sig/shimmer-ohos.git
d11429452783d5ecbf11b794d5de0324cc6caba7
gitee
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
confirmReceive
确认收货 @param {number} orderId - 订单 ID @returns {Promise<NetworkResponse<boolean>>} 是否成功
async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.get("order/info/confirm", { params: { orderId } }); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left confirmReceive AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left orderId AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.get("order/info/confirm", { params: { orderId } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
ee0ac03874ee2ffc6a9d56fec2b7ec9f7d670dfe
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
trimLeft
Trims all specified characters from the beginning this String. @param { char[] } remove that contains the characters to trim @throws { NullPointerError } if remove param is null @returns { String } new left trimmed string @syscap SystemCapability.Utils.Lang @FaAndStageModel
public trimLeft(remove: char[]): String { if (this.isEmpty() || !String.isCharOneOf(this.charAt(0), remove)) { return this; } let firstNotSpecCharIdx: int = 0; for (let i: int = 1; i < this.getLength(); i++) { if (!String.isCharOneOf(this.charAt(i), remove)) {...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remove AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier#R...
public trimLeft(remove: char[]): String { if (this.isEmpty() || !String.isCharOneOf(this.charAt(0), remove)) { return this; } let firstNotSpecCharIdx: int = 0; for (let i: int = 1; i < this.getLength(); i++) { if (!String.isCharOneOf(this.charAt(i), remove)) {...
https://gitcode.com/iop123123/arkts-static-skills
3e459ce237b214318c040c73e96e27a92cdd3c26
gitcode
openharmony-sig/ohos-beacon-library
library/src/main/ets/components/beacon/logging/LogManager.ets
arkts
w
Send a warning log message to the logger. @param message The message you would like logged. This message may contain string formatting which will be replaced with values from args. @param args Arguments for string formatting.
public static w(message: string, ...args: Object[]): void { LogManager.sLogger.w(message, args); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left w AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right ...
public static w(message: string, ...args: Object[]): void { LogManager.sLogger.w(message, args); }
https://gitee.com/openharmony-sig/ohos-beacon-library.git
b85b907b94ffb531985c2b4065ec7198aa7ff9d1
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/OrderRepository.ets
arkts
getOrderLogistics
查询订单物流信息 @param orderId 订单 ID @returns 物流详情
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { return this.networkDataSource.getOrderLogistics(orderId); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOrderLogistics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left orderId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { return this.networkDataSource.getOrderLogistics(orderId); }
https://github.com/Joker-x-dev/CoolMallArkTS
a1febea0186edcb6481f58e52fee2c2c9c288216
github
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
endSession
结束学习会话
public async endSession(): Promise<void> { if (this.sessionStartTime === 0) return; const duration = Math.floor((Date.now() - this.sessionStartTime) / 60000); // 分钟 await this.recordUsage(duration); this.sessionStartTime = 0; this.currentSessionMinutes = 0; console.info('ParentalControlServi...
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 endSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public async endSession(): Promise<void> { if (this.sessionStartTime === 0) return; const duration = Math.floor((Date.now() - this.sessionStartTime) / 60000); // 分钟 await this.recordUsage(duration); this.sessionStartTime = 0; this.currentSessionMinutes = 0; console.info('ParentalControlServi...
https://github.com/the-wwyang/kids-learning-app
0079e505f1ec61168ff0fa99dca07617f4d4e7b4
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setBarSpace
Sets the space that is left out on the left and right side of each candle, default 0.1f (10%), max 0.45f, min 0f @param space
public setBarSpace(space: number): void { if (space < 0) space = 0; if (space > 0.45) space = 0.45; this.mBarSpace = space; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBarSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left space AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
public setBarSpace(space: number): void { if (space < 0) space = 0; if (space > 0.45) space = 0.45; this.mBarSpace = space; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
b6bd6b541919da5e1dd41f0f728dee2dae87859d
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/skill/utils/SkillTestTool.ets
arkts
testNavigation
测试导航意图
private async testNavigation(): Promise<void> { const testName = 'AR导航'; const testCases = [ { input: '导航去内科', expectedContains: ['导航', '内科'] }, { input: '怎么走', expectedContains: ['导航'] }, { input: '打开AR导航', expectedContains: ['AR'] } ]; for (const tc of testCases) { try { ...
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 testNavigation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private async testNavigation(): Promise<void> { const testName = 'AR导航'; const testCases = [ { input: '导航去内科', expectedContains: ['导航', '内科'] }, { input: '怎么走', expectedContains: ['导航'] }, { input: '打开AR导航', expectedContains: ['AR'] } ]; for (const tc of testCases) { try { ...
https://github.com/LJ666-ui/harmony-health-care
8dc93c5e0f1198451ae842b0fa555a93fb61e045
github
itrainhub/wu-ui
WuUI/entry/src/main/ets/styles/Page.ets
arkts
constructor
inset: 是否页面容器
constructor(inset: boolean = false) { this.inset = inset }
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 inset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Le...
constructor(inset: boolean = false) { this.inset = inset }
https://github.com/itrainhub/wu-ui
da5d5e02578b6004108ba8074ff87d052fd230d9
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/RdbManager.ets
arkts
importInitialData
==================== 数据插入逻辑 ==================== 将写死的 SongListItemType[] 数据导入数据库 注意:这个方法应该只在应用第一次启动或重置时调用
async importInitialData(playlists: SongListItemType[]) { if (!this.rdbStore) return; // 开启事务,保证数据完整性 this.rdbStore.beginTransaction(); try { for (const playlist of playlists) { // 1. 插入歌单,并获取生成的歌单ID const playlistValue: ValuesBucket = { name: playlist.name, ...
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left importInitialData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ...
async importInitialData(playlists: SongListItemType[]) { if (!this.rdbStore) return; // 开启事务,保证数据完整性 this.rdbStore.beginTransaction(); try { for (const playlist of playlists) { // 1. 插入歌单,并获取生成的歌单ID const playlistValue: ValuesBucket = { name: playlist.name, ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L80-L132
37c25c71414d268f3c415a24789a60bfd8ab2898
github
dingzhilin1990/zhilinclaw
examples/SecurityDemo.ets
arkts
demonstrateSecurityFeatures
演示安全功能
async function demonstrateSecurityFeatures() { console.log('='.repeat(60)); console.log('ZhiLinClaw 安全功能演示'); console.log('='.repeat(60)); // 创建加密密钥(实际项目中应使用安全的密钥生成) const encryptionKey = new Uint8Array(32); for (let i = 0; i < 32; i++) { encryptionKey[i] = i; } // 1. 初始化安全上下文 console.log('\n[1]...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left demonstrateSecurityFeatures AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_bl...
async function demonstrateSecurityFeatures() { console.log('='.repeat(60)); console.log('ZhiLinClaw 安全功能演示'); console.log('='.repeat(60)); // 创建加密密钥(实际项目中应使用安全的密钥生成) const encryptionKey = new Uint8Array(32); for (let i = 0; i < 32; i++) { encryptionKey[i] = i; } // 1. 初始化安全上下文 console.log('\n[1]...
https://github.com/dingzhilin1990/zhilinclaw
c3a116a524fff71f317e9424cdea824389944a7e
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets
arkts
getRepeatOptions
获取重复选项(代理给RepeatService)
getRepeatOptions() { return this.repeatService.getRepeatOptions(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRepeatOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
getRepeatOptions() { return this.repeatService.getRepeatOptions(); }
https://gitcode.com/openharmony/codelabs
38ec8abe4973692a227bcb120bd4a71de2952e85
gitcode
offlinecat-dev/OCNetORM
src/main/ets/errors/RelationError.ets
arkts
constructor
构造函数 @param entityName 实体名称 @param relationName 关联关系名称
constructor(entityName: string, relationName: string) { const context = new ErrorContext() context.entityName = entityName context.details = `关联关系 '${relationName}' 未注册` super(`实体 '${entityName}' 的关联关系 '${relationName}' 未找到`, ERROR_RELATION_NOT_FOUND, context) this.name = 'RelationNotFoundError' ...
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#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST...
constructor(entityName: string, relationName: string) { const context = new ErrorContext() context.entityName = entityName context.details = `关联关系 '${relationName}' 未注册` super(`实体 '${entityName}' 的关联关系 '${relationName}' 未找到`, ERROR_RELATION_NOT_FOUND, context) this.name = 'RelationNotFoundError' ...
https://github.com/offlinecat-dev/OCNetORM
8bd3710f744adcd272a5dc11d4a14307b65ba2fc
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets
arkts
setDragOffsetX
Set an offset in dp that allows the user to drag the chart over it's bounds on the x-axis. @param offset
public setDragOffsetX(offset: number) { this.mTransOffsetX = Utils.convertDpToPixel(offset); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragOffsetX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setDragOffsetX(offset: number) { this.mTransOffsetX = Utils.convertDpToPixel(offset); }
https://gitee.com/openharmony/developtools_profiler.git
a96dc5612231d3dba4f141bee5a0fb85342dcb4f
gitee
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/pages/LauncherPage.ets
arkts
onConfirm
同意按钮回调
onConfirm(): void { Logger.info(CommonConstants.LAUNCHER_PAGE_TAG, 'Privacy agreed'); this.saveIsPrivacy(); this.jumpToIndexPage(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onConfirm 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#Le...
onConfirm(): void { Logger.info(CommonConstants.LAUNCHER_PAGE_TAG, 'Privacy agreed'); this.saveIsPrivacy(); this.jumpToIndexPage(); }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
cf6a03da3ae5c42741651459ff5bd33a23d6bdeb
github
openharmony-tpc/mp4parser
library/src/main/ets/mp4parser/MP4Parser.ets
arkts
videoMultMerge
Batch video synthesis @param sourcePath @param outPath @param callBack
static videoMultMerge(sourcePath: string, outPath: string, callBack: ICallBack): void { mp4parser_napi.exeFFmpegCmd("ffmpeg -y -f concat -safe 0 -i " + sourcePath + " -c copy " + outPath) .then((res: number) => { callBack.callBackResult(res) }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left videoMultMerge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
static videoMultMerge(sourcePath: string, outPath: string, callBack: ICallBack): void { mp4parser_napi.exeFFmpegCmd("ffmpeg -y -f concat -safe 0 -i " + sourcePath + " -c copy " + outPath) .then((res: number) => { callBack.callBackResult(res) }); }
https://gitee.com/openharmony-tpc/mp4parser.git
43a5d16f69b25975027bb8177e6cc224bd5d244d
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
base64ToUint8Array
Base64 转 Uint8Array 使用鸿蒙 util.Base64Helper
private base64ToUint8Array(base64: string): Uint8Array { const base64Helper = new util.Base64Helper(); return base64Helper.decodeSync(base64); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base64ToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base64 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private base64ToUint8Array(base64: string): Uint8Array { const base64Helper = new util.Base64Helper(); return base64Helper.decodeSync(base64); }
https://github.com/richshaw2015/nds
59b6b88db47cd921033b492b0bc4dd2ea53590e5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/ConsolePanel.ets
arkts
updateTimerState
--- 私有方法 ---
private updateTimerState(): void { if (this._isVisible) { this.startRefreshTimer(); } else { this.stopRefreshTimer(); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateTimerState 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#ex...
private updateTimerState(): void { if (this._isVisible) { this.startRefreshTimer(); } else { this.stopRefreshTimer(); } }
https://github.com/DaLongZhuaZi/manxia
2a36ba0f597d0ce78c6bdaeb767efcc87f65160c
github
harmonyos/codelabs
AlarmClock/entry/src/main/ets/common/utils/DataTypeUtils.ets
arkts
deepCopy
return new deep copy object from obj. @return type in obj.
static deepCopy(obj: number[]) { let newObj: number[] = []; for (let i = 0; i < obj.length; i++) { newObj[i] = JSON.parse(JSON.stringify(obj[i])); } return newObj; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left deepCopy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Lef...
static deepCopy(obj: number[]) { let newObj: number[] = []; for (let i = 0; i < obj.length; i++) { newObj[i] = JSON.parse(JSON.stringify(obj[i])); } return newObj; }
https://gitee.com/harmonyos/codelabs.git
8b1893b3ad91ccf7c92f67c1657f7e2254f6deb7
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/constants/ApiConstants.ets
arkts
userBookmarks
获取用户书签
static userBookmarks(username: string): string { return `/u/${username}/bookmarks.json`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left userBookmarks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static userBookmarks(username: string): string { return `/u/${username}/bookmarks.json`; }
https://github.com/Amaz1ny/HarmonyDO-public
109d8f9fbfefcdc8c2df934f5e9baf7c2f0a1851
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/UnifiedOperationInterface.ets
arkts
generateOperationId
生成操作ID
private generateOperationId(): string { return `op_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateOperationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left str...
private generateOperationId(): string { return `op_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
https://github.com/DaLongZhuaZi/manxia
f5c95af2592ef3e10200bfe3bf9347cbd4b39ffc
github
openharmony-sig/arkui_composite_component
source/TreeView/TreeView.ets
arkts
once
Event registration and processing. After the event is processed once, it will be destroyed. @param type Registered Events. @param callback Event callback. @since 10
public once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void) { let _self = this; function handler() { _self.off(type, handler); callback.apply(null, [type, callback]); } handler.callback = callback; this.on(type, handler); }
AST#program#Left AST#ERROR#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left once AST#identifier#Right AST#ERROR#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TreeListenType A...
public once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void) { let _self = this; function handler() { _self.off(type, handler); callback.apply(null, [type, callback]); } handler.callback = callback; this.on(type, handler); }
https://gitee.com/openharmony-sig/arkui_composite_component.git
879bd71b4ec365d3a0e75ea5acb05c91e38bff1e
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test19_original_index.ets
arkts
testStringPadding
--- String.padStart / padEnd with deeper nesting ---
function testStringPadding(): string { let s: string = '42'; let padded: string = s.padStart(6, '0'); let right: string = s.padEnd(6, '-'); return padded + '|' + right; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringPadding 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#predefine...
function testStringPadding(): string { let s: string = '42'; let padded: string = s.padStart(6, '0'); let right: string = s.padEnd(6, '-'); return padded + '|' + right; }
https://github.com/miaochiahao/ark-ghidra
7bd2d552393c2bd321acf251a936710a500573e5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
onMousePrimaryRelease
primary 手指释放的统一路径(对账 + 正常 Up/Cancel 共享)
private onMousePrimaryRelease(finalX: number, finalY: number): void { this.mousePrimaryFingerId = -1; if (!this.mouseCancelled) { this.cancelMouseLongPressTimer(); this.cancelMouseTapDownTimer(); if (this.mouseConfirmedLongPress) { this.nativeInput.sendMouseButton(BUTTON_ACTION_REL...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onMousePrimaryRelease AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left finalX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private onMousePrimaryRelease(finalX: number, finalY: number): void { this.mousePrimaryFingerId = -1; if (!this.mouseCancelled) { this.cancelMouseLongPressTimer(); this.cancelMouseTapDownTimer(); if (this.mouseConfirmedLongPress) { this.nativeInput.sendMouseButton(BUTTON_ACTION_REL...
https://github.com/AlkaidLab/moonlight-harmony
56b2b94a81ff99a369488a3cabcc287b0273b253
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/Post.ets
arkts
isDeleted
帖子是否已被删除
get isDeleted(): boolean { return this.deletedAt !== null; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isDeleted 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#Righ...
get isDeleted(): boolean { return this.deletedAt !== null; }
https://github.com/Amaz1ny/HarmonyDO-public
0b36059c6b688bcee80b8f4c2a91232ff11e3311
github
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
login
========== 完整登录流程 ==========
async login( username: string, password: string, onTracks: () => Promise<TrackPoint[]>, onProgress?: (p: LoginProgress) => void ): Promise<boolean> { // Step 1: 获取表单 const fields: CasFormFields = await this.getLoginPageForm(onProgress); // Step 2: 获取验证码 const puzzle: SliderPuzzle = ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left login AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async login( username: string, password: string, onTracks: () => Promise<TrackPoint[]>, onProgress?: (p: LoginProgress) => void ): Promise<boolean> { // Step 1: 获取表单 const fields: CasFormFields = await this.getLoginPageForm(onProgress); // Step 2: 获取验证码 const puzzle: SliderPuzzle = ...
https://github.com/PollenWang6/HiXD
fd0e0764a42daba774415a73fbabe46bf76e7bf9
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/ThreadPaginationManager.ets
arkts
getDisplayPage
根据列表中心索引计算当前应显示的页码。 @param centerIndex - 中心条目索引 @returns 对应页码
getDisplayPage(centerIndex: number): number { if (centerIndex >= 0 && centerIndex < this.pageOfIndex.length) { return this.pageOfIndex[centerIndex] } return this.currentPage }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left centerIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A...
getDisplayPage(centerIndex: number): number { if (centerIndex >= 0 && centerIndex < this.pageOfIndex.length) { return this.pageOfIndex[centerIndex] } return this.currentPage }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L210-L215
83b39bc344c62161932ca674683425f11f6ac19f
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
goToSourceSearch
进入书源专属搜索页面
goToSourceSearch(source: NovelSourceInfo): void { // 传递sourceId到搜索页面,让搜索页面只使用这个书源 const params: NovelSearchPageParams = { keyword: '', sourceId: source.id, sourceName: source.name }; this.pathStack.pushPathByName('NovelSearchPage', params); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left goToSourceSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NovelSourceInfo AST#identifier#Right ...
goToSourceSearch(source: NovelSourceInfo): void { // 传递sourceId到搜索页面,让搜索页面只使用这个书源 const params: NovelSearchPageParams = { keyword: '', sourceId: source.id, sourceName: source.name }; this.pathStack.pushPathByName('NovelSearchPage', params); }
https://github.com/DaLongZhuaZi/manxia
5d8ab5e386e3c3733134f322f4cfeea42e3162c3
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/viewmodel/CalendarViewModel.ets
arkts
getPrevMonth
获取上一月
public getPrevMonth(year: number, month: number): MonthInfo { let prevMonth = month - 1; let prevYear = year; if (prevMonth < 1) { prevMonth = 12; prevYear--; } return new MonthInfo(prevYear, prevMonth); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPrevMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
public getPrevMonth(year: number, month: number): MonthInfo { let prevMonth = month - 1; let prevYear = year; if (prevMonth < 1) { prevMonth = 12; prevYear--; } return new MonthInfo(prevYear, prevMonth); }
https://gitcode.com/openharmony/codelabs
8a652eb798e0c84f27094ea9c70633d640a5e8bf
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getDiagnostics
获取主题系统的诊断信息
public getDiagnostics(): string { return `ThemeManager 诊断信息: - 初始化状态: ${this.isInitialized} - 当前主题设置: ${this.currentTheme} - 实际系统主题: ${this.actualTheme} - 最终显示主题: ${this.getActualThemeSync()} - 注册的监听器数量: ${this.themeChangeCallbacks.size} - 存储状态: ${this.preferencesStore ? '已初始化' : '未初始化'}`; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDiagnostics 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#...
public getDiagnostics(): string { return `ThemeManager 诊断信息: - 初始化状态: ${this.isInitialized} - 当前主题设置: ${this.currentTheme} - 实际系统主题: ${this.actualTheme} - 最终显示主题: ${this.getActualThemeSync()} - 注册的监听器数量: ${this.themeChangeCallbacks.size} - 存储状态: ${this.preferencesStore ? '已初始化' : '未初始化'}`; }
https://github.com/DaLongZhuaZi/manxia
7833964ecc8749cb2409830f1d2c35d3561e5630
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/EntryAbility.ets
arkts
isSystemDarkMode
组件功能简介: - 根据系统色彩模式判断是否为深色主题。 可传入项: - `colorMode`: 系统配置中的颜色模式。 返回行为: - 返回是否深色模式。 副作用: - 无。
private isSystemDarkMode(colorMode: ConfigurationConstant.ColorMode | undefined): boolean { return colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isSystemDarkMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colorMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_...
private isSystemDarkMode(colorMode: ConfigurationConstant.ColorMode | undefined): boolean { return colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/EntryAbility.ets#L48-L50
4b0bc4a31b70b399c49dcdd4906b42b51a574d7c
github
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/FileImportManager.ets
arkts
parseCSVContent
解析CSV内容
private static parseCSVContent(content: string): PhoneEntry[] { const phoneList: PhoneEntry[] = [] const lines = content.split('\n').filter(line => line.trim()) if (lines.length === 0) { return phoneList } // 解析标题行,确定列索引 const headers = lines[0].split(',').map(h => h.trim().toLower...
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 parseCSVContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#L...
private static parseCSVContent(content: string): PhoneEntry[] { const phoneList: PhoneEntry[] = [] const lines = content.split('\n').filter(line => line.trim()) if (lines.length === 0) { return phoneList } // 解析标题行,确定列索引 const headers = lines[0].split(',').map(h => h.trim().toLower...
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
4530ffc0f253d70ec352430cec4e082114f9bc8d
github
openharmony/applications_print_spooler
entry/src/main/ets/pages/component/PreviewComponent.ets
arkts
swapCanvasWidthAndHeight
调整画布的方向
swapCanvasWidthAndHeight() { let temp = this.canvasWidth; this.canvasWidth = this.canvasHeight this.canvasHeight = temp this.checkCanvasWidth() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left swapCanvasWidthAndHeight 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...
swapCanvasWidthAndHeight() { let temp = this.canvasWidth; this.canvasWidth = this.canvasHeight this.canvasHeight = temp this.checkCanvasWidth() }
https://gitee.com/openharmony/applications_print_spooler.git
199eec00756a18cc15eeb584dbc13197bd92428c
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Creates a slice of current Uint32Array using range [begin, end) @param begin start index to be taken into slice @param end last index to be taken into slice @returns a new Uint32Array with elements of current Uint32Array[begin;end) where end index is excluded @link https://developer.mozilla.org/en-US/docs/Web/JavaScrip...
/* public */ internal slice(begin: int, end: int): Uint32Array { if (begin < -this.length) { begin = 0 } if (begin < 0) { begin = this.length + begin } if (begin >= this.length) { return new Uint32Array(new ArrayBuffer(0)) } ...
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Ri...
/* public */ internal slice(begin: int, end: int): Uint32Array { if (begin < -this.length) { begin = 0 } if (begin < 0) { begin = this.length + begin } if (begin >= this.length) { return new Uint32Array(new ArrayBuffer(0)) } ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f2cab8669b2f6f79679c3f19e6b1f6d19d890a92
gitee
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
resetPdfPageHandle
文档从磁盘重载后清除缓存的 PdfPage 句柄。
public resetPdfPageHandle(): void { this._pdfPage = undefined; this.pdfLinks = undefined; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetPdfPageHandle 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#exp...
public resetPdfPageHandle(): void { this._pdfPage = undefined; this.pdfLinks = undefined; }
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L233-L236
47d29c97715d642fa63a3ce639d68a7e9ee132d7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CacheConfigManager.ets
arkts
updateDiskCacheConfig
更新磁盘缓存配置
public async updateDiskCacheConfig(config: DiskCacheConfig): Promise<void> { const newConfig = this.cloneConfig(this.config); newConfig.diskCache = this.mergeDiskCache(this.config.diskCache, config); await this.updateConfig(newConfig); }
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 updateDiskCacheConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#...
public async updateDiskCacheConfig(config: DiskCacheConfig): Promise<void> { const newConfig = this.cloneConfig(this.config); newConfig.diskCache = this.mergeDiskCache(this.config.diskCache, config); await this.updateConfig(newConfig); }
https://github.com/DaLongZhuaZi/manxia
d3d2201bbf65a04f4100cfdf233dce256b0417a7
github
who7708/harmonyos-codelabs
HmosWorld/commons/common/src/main/ets/service/datasource/network/agc/FuncNetwork.ets
arkts
toggleLiked
@param resourceId @param operation @param userId @returns
public toggleLiked(resourceId: string, operation: number): Promise<void> { return new Promise((resolve: (value: void | PromiseLike<void>) => void, reject: (reason?: Object) => void) => { const params: ToggleActionParams = { resourceId, operation, userId: (AppS...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toggleLiked 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#string#...
public toggleLiked(resourceId: string, operation: number): Promise<void> { return new Promise((resolve: (value: void | PromiseLike<void>) => void, reject: (reason?: Object) => void) => { const params: ToggleActionParams = { resourceId, operation, userId: (AppS...
https://github.com/who7708/harmonyos-codelabs
9cb05b7355731eecc451ce2b713f91544434980c
github
LongLiveY96/chatcube
entry/src/main/ets/services/WebDAVSyncService.ets
arkts
getRemoteStatus
查询远端备份文件信息
async getRemoteStatus(): Promise<RemoteInfo> { const config = await this.loadConfig() const validation = this.validateConfig(config) if (validation !== null) { return { exists: false, size: 0, lastModified: '', etag: '', statusCode: 0, message: validat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRemoteStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async getRemoteStatus(): Promise<RemoteInfo> { const config = await this.loadConfig() const validation = this.validateConfig(config) if (validation !== null) { return { exists: false, size: 0, lastModified: '', etag: '', statusCode: 0, message: validat...
https://github.com/LongLiveY96/chatcube
87d75444deaa2d5ee9005a1767a92a2f2454d56d
github
OHPG/FinSdk
jellyfin/src/main/ets/api/UsersApi.ets
arkts
getUserItem
getUserItem @summary Gets an item from a user's library. Walks GET /Users/{userId}/Items/{itemId}. The server fills in UserData (including PlaybackPositionTicks) based on userId. @param {UsersApiGetItemRequest} requestParameters Request parameters. @throws {RequiredError} @memberof UsersApi
public async getUserItem(requestParameters: UsersApiGetItemRequest): Promise<BaseItemDto> { this.assertParam(requestParameters.userId) this.assertParam(requestParameters.itemId) return this.apiClient.get({ path: `/Users/${requestParameters.userId}/Items/${requestParameters.itemId}` }) }
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 getUserItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:...
public async getUserItem(requestParameters: UsersApiGetItemRequest): Promise<BaseItemDto> { this.assertParam(requestParameters.userId) this.assertParam(requestParameters.itemId) return this.apiClient.get({ path: `/Users/${requestParameters.userId}/Items/${requestParameters.itemId}` }) }
https://github.com/OHPG/FinSdk
fda66dfcacf2198bf4f3670f616759671ad8c78c
github
silence17/harmonydemo
entry/src/main/ets/view/refresh/DialogUtils.ets
arkts
textPickerDialog
Text dialog dialog
static textPickerDialog(sexArray: Resource, sexCallback: Function) { if (this.isEmpty(sexArray)) { console.error('sex is null'); return; } TextPickerDialog.show({ range: sexArray, selected: 0, onAccept: (result: TextPickerResult) => { sexCallback(result.value); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left textPickerDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sexArray AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static textPickerDialog(sexArray: Resource, sexCallback: Function) { if (this.isEmpty(sexArray)) { console.error('sex is null'); return; } TextPickerDialog.show({ range: sexArray, selected: 0, onAccept: (result: TextPickerResult) => { sexCallback(result.value); ...
https://github.com/silence17/harmonydemo
51803182cafefc0c905c7c03d185b6e6817a084b
github
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
makeAlphanumeric
Returns a segment representing the given text string encoded in alphanumeric mode. The characters allowed are: 0 to 9, A to Z (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
public static makeAlphanumeric(text: string): QrSegment { if (!QrSegment.isAlphanumeric(text)) { throw new RangeError("String contains unencodable characters in alphanumeric mode"); } let bb: Array<bit> = [] let i: int; for (i = 0; i + 2 <= text.length; i += 2) { // Process gr...
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 makeAlphanumeric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left :...
public static makeAlphanumeric(text: string): QrSegment { if (!QrSegment.isAlphanumeric(text)) { throw new RangeError("String contains unencodable characters in alphanumeric mode"); } let bb: Array<bit> = [] let i: int; for (i = 0; i + 2 <= text.length; i += 2) { // Process gr...
https://gitee.com/openharmony/arkui_ace_engine.git
2f2c0cd5e9fab12405453f81296f641f6cb7a567
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
constructor
Constructs a new InternalError instance with provided message and error specific information @param { String | undefined } message - Error text @param { ErrorOptions | undefined } options - Error options @syscap SystemCapability.Utils.Lang
constructor(message?: String, options?: ErrorOptions) { super("InternalError", message, options) }
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#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("InternalError", message, options) }
https://gitcode.com/iop123123/arkts-static-skills
0b400f3ff1eb7180fcf1e9052c544c3552a85b48
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/JSONSourceParser.ets
arkts
parseJSONResponse
解析JSON响应
private parseJSONResponse(response: Record<string, Object | undefined>, parser: ParserConfig): Record<string, Object | undefined>[] { try { // 获取列表数据 const listPath: string | undefined = parser.listPath || parser.root; const items: Object[] = listPath ? JSONPathParser.parseArray(response as Reco...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseJSONResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
private parseJSONResponse(response: Record<string, Object | undefined>, parser: ParserConfig): Record<string, Object | undefined>[] { try { // 获取列表数据 const listPath: string | undefined = parser.listPath || parser.root; const items: Object[] = listPath ? JSONPathParser.parseArray(response as Reco...
https://github.com/DaLongZhuaZi/manxia
17e80ec0521fcd9f2e90457a1f71708c037fe43f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineRadarDataSet.ets
arkts
setFillDrawable
Sets the drawable to be used to fill the area below the line. @param drawable @TargetApi(18)
public setFillDrawable(drawable: ChartPixelMap): void { this.mFillDrawable = drawable; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFillDrawable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left drawable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setFillDrawable(drawable: ChartPixelMap): void { this.mFillDrawable = drawable; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9964572cefad32fb3fde983d8add8ac438926b21
gitee