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
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setExtraBottomOffset
Set an extra offset to be appended to the viewport's bottom
public setExtraBottomOffset(offset: number) { this.mExtraBottomOffset = Utils.handleDataValues(offset); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setExtraBottomOffset 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#identifie...
public setExtraBottomOffset(offset: number) { this.mExtraBottomOffset = Utils.handleDataValues(offset); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
206d04ae9e166d17acc9961b5f5e03c520ff7475
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineDataSet.ets
arkts
getCircleColors
ALL CODE BELOW RELATED TO CIRCLE-COLORS returns all colors specified for the circles @return
public getCircleColors(): JArrayList<Number> | null { return this.mCircleColors; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCircleColors 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_expression#Left...
public getCircleColors(): JArrayList<Number> | null { return this.mCircleColors; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
4fd8453d20074b51d409aed1c5ddfe93f1a23a00
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
getSync
同步获取设置值(从缓存) @param key 设置键名 @param defaultValue 默认值 @returns 设置值
public getSync<T extends SettingValue>(key: string, defaultValue?: T): T { if (this.settingsCache.has(key)) { return this.settingsCache.get(key) as T; } const definedDefault = getDefaultValue(key); return (definedDefault ?? defaultValue) as T; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left getSync AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type_identifier#Left SettingValue AST#type_identifier#Right...
public getSync<T extends SettingValue>(key: string, defaultValue?: T): T { if (this.settingsCache.has(key)) { return this.settingsCache.get(key) as T; } const definedDefault = getDefaultValue(key); return (definedDefault ?? defaultValue) as T; }
https://github.com/richshaw2015/nds
dd6fbe64aa899316a9d43511ecce9a12077c7665
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
beginTextStream
MARK: - Data Exchange Begins a streaming data session
public beginTextStream(): void { this._surfaceBridge.beginTextStream(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left beginTextStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres...
public beginTextStream(): void { this._surfaceBridge.beginTextStream(); }
https://github.com/AGenUI/AGenUI
37a3c7a65722c99a250abbb2285bfa6c9abc6428
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
togglePinned
切换条目或分组的置顶状态 @param item 条目或分组 @returns 切换后是否置顶
public static togglePinned(item: KdbxEntry | KdbxGroup): boolean { if (!item.tags) { item.tags = []; } const index = item.tags.indexOf(KdbxUtils.PINNED_TAG); if (index >= 0) { // 取消置顶 item.tags.splice(index, 1); return false; } else { // 置顶 item.tags.push(KdbxUt...
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 togglePinned AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST...
public static togglePinned(item: KdbxEntry | KdbxGroup): boolean { if (!item.tags) { item.tags = []; } const index = item.tags.indexOf(KdbxUtils.PINNED_TAG); if (index >= 0) { // 取消置顶 item.tags.splice(index, 1); return false; } else { // 置顶 item.tags.push(KdbxUt...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L427-L441
6aec6de2c7243e89822b7cd3c47505efd6d28802
github
Harrisonls2004/WaterFlow
entry/src/main/ets/pages/MessagePage.ets
arkts
onRefreshFlagChange
监听刷新标志变化,立即刷新会话列表
onRefreshFlagChange(): void { console.log('MessagePage: refreshFlag changed to', this.refreshFlag); if (this.currentUsername) { this.loadConversations(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRefreshFlagChange 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#statemen...
onRefreshFlagChange(): void { console.log('MessagePage: refreshFlag changed to', this.refreshFlag); if (this.currentUsername) { this.loadConversations(); } }
https://github.com/Harrisonls2004/WaterFlow
5eecc1231cfe100a3776757bd4f56225ae021fc2
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveStorage.ets
arkts
write
写入文件内容 @param path 文件路径 @param data 文件内容 @returns Promise<void> @throws StorageError 如果写入失败
public async write(path: string, data: ArrayBuffer): Promise<void> { if (!this.client) { hilog.error(DOMAIN, TAG, 'OneDrive not init:%{public}s', JSON.stringify(this.config)); return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, 'OneDrive not initialized')); } // 检查令牌是否过...
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 write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right...
public async write(path: string, data: ArrayBuffer): Promise<void> { if (!this.client) { hilog.error(DOMAIN, TAG, 'OneDrive not init:%{public}s', JSON.stringify(this.config)); return Promise.reject(new StorageError(StorageErrorCodes.CLIENT_UNDEFINED, 'OneDrive not initialized')); } // 检查令牌是否过...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveStorage.ets#L190-L210
74725a84df5980a0d3cd00499c85ee9a34d501eb
github
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmStateManager.ets
arkts
setState
set alarm state @param currentState alarm state @param alarmId alarm id
private async setState(currentState: number, alarmId: string): Promise<void> { const preferences = await this.getPreferences(); await preferences.put(KEY_ALARM_STATE, currentState); if (currentState === STATE_FIRING) { await preferences.put(KEY_ALARM_STATE_ID, alarmId); } await preferences.f...
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 setState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentState AST#identifier#Right AST#ERROR#Left AST#:#Left...
private async setState(currentState: number, alarmId: string): Promise<void> { const preferences = await this.getPreferences(); await preferences.put(KEY_ALARM_STATE, currentState); if (currentState === STATE_FIRING) { await preferences.put(KEY_ALARM_STATE_ID, alarmId); } await preferences.f...
https://gitee.com/openharmony-sig/applications_clock.git
1c608aea021052c647820fea098a92ad52049549
gitee
openharmony/xts_acts
ability/ability_runtime/actsabilityamstest/systemappa/entry/src/main/ets/mainability23/MainAbility23.ets
arkts
unmarshalling
从MessageSequence中解封此可序列对象。
unmarshalling(messageSequence: rpc.MessageSequence) { this.num = messageSequence.readInt(); // 从MessageSequence实例读取整数值。 this.str = messageSequence.readString(); console.log(`MyMessageAble unmarshalling num[${this.num}] str[${this.str}]`); return true; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unmarshalling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left messageSequence AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left rpc A...
unmarshalling(messageSequence: rpc.MessageSequence) { this.num = messageSequence.readInt(); // 从MessageSequence实例读取整数值。 this.str = messageSequence.readString(); console.log(`MyMessageAble unmarshalling num[${this.num}] str[${this.str}]`); return true; }
https://gitee.com/openharmony/xts_acts.git
cdd44b7e5008beef86aee42af132a349096346ee
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
showToasts
显示Toast消息 @param toasts Toast消息列表
private showToasts(toasts: ToastMessage[]): void { for (const toast of toasts) { try { const duration = toast.type === 'long' ? 3500 : 2000; AppStorage.get<UIContext>('GlobalUIContext')?.getPromptAction()?.showToast({ message: toast.msg, duration: duration }); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showToasts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toasts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expres...
private showToasts(toasts: ToastMessage[]): void { for (const toast of toasts) { try { const duration = toast.type === 'long' ? 3500 : 2000; AppStorage.get<UIContext>('GlobalUIContext')?.getPromptAction()?.showToast({ message: toast.msg, duration: duration }); ...
https://github.com/DaLongZhuaZi/manxia
ea9dad71848b09aaf2686d34c72158779c552376
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
internal
checks that context is errorneous used after long-returning types (that can't throw an exception explicitly)
internal checkError(): void throws { this.checkError(TypeCreatorCtx.getError(this.ctxPtr)) }
AST#program#Left AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkError 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#e...
internal checkError(): void throws { this.checkError(TypeCreatorCtx.getError(this.ctxPtr)) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
26db2d0b66be56c4a4dc44d015bea8e905c3aebe
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/SettingsUtil.ets
arkts
isFamilyLoggedIn
检查家属是否已登录
async isFamilyLoggedIn(): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const token: string = await this.getFamilyToken(); return token.length > 0; } catch (e) { console.error('SettingsUtil - check family login status failed:', e); return f...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left isFamilyLoggedIn AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef...
async isFamilyLoggedIn(): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const token: string = await this.getFamilyToken(); return token.length > 0; } catch (e) { console.error('SettingsUtil - check family login status failed:', e); return f...
https://github.com/LJ666-ui/harmony-health-care
2735c073f3ce7ec9aede7852d11c85ca9f7ff787
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGPolygonAndPolyLine.ets
arkts
setPoints
设置顶点坐标 @param newPoints 顶点坐标集合
public setPoints(newPoints: number[]): void{ this._points = newPoints; this._resultObj['points'] = newPoints; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPoints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newPoints AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Rig...
public setPoints(newPoints: number[]): void{ this._points = newPoints; this._resultObj['points'] = newPoints; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
ec531c1cd0304ec697b7cabc2c1d1ba00dfd5fc3
gitee
veaba/EsptouchForHarmony
entry/src/main/ets/esptouch/provision/APProvisioner.ets
arkts
close
Clean up resources
close(): void { this.cancel(); this.callback = null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left close AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
close(): void { this.cancel(); this.callback = null; }
https://github.com/veaba/EsptouchForHarmony
0ba7a175c55b0be10fa4493f2e08e37b7675a749
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test4_original_index.ets
arkts
testJsonOps
=== JSON Operations ===
function testJsonOps(): string { let obj: Record<string, number> = {}; obj['x'] = 10; obj['y'] = 20; let jsonStr: string = JSON.stringify(obj); return jsonStr; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testJsonOps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type...
function testJsonOps(): string { let obj: Record<string, number> = {}; obj['x'] = 10; obj['y'] = 20; let jsonStr: string = JSON.stringify(obj); return jsonStr; }
https://github.com/miaochiahao/ark-ghidra
0c4a576bac9301b4e16e5aae3da8f42a5c45d066
github
ycj3/streaming-markdown
packages/streaming-markdown/src/main/ets/ui/BlockView.ets
arkts
getAlignment
Get TextAlign from alignment string
getAlignment(alignment: 'left' | 'center' | 'right' | null | undefined): TextAlign { if (alignment === 'center') { return TextAlign.Center; } else if (alignment === 'right') { return TextAlign.End; } return TextAlign.Start; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAlignment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alignment AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left AST#...
getAlignment(alignment: 'left' | 'center' | 'right' | null | undefined): TextAlign { if (alignment === 'center') { return TextAlign.Center; } else if (alignment === 'right') { return TextAlign.End; } return TextAlign.Start; }
https://github.com/ycj3/streaming-markdown
5674213261f71919a568bad7bb7e2f382044052a
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/TerminalManager.ets
arkts
replacePage
替换当前页面(带权限检查) @param pageUrl 页面URL @param params 参数(可选)
async replacePage(pageUrl: string, params?: Record<string, any>): Promise<boolean> { // 检查权限 if (!this.canAccessPage(pageUrl)) { console.error(`无权访问页面: ${pageUrl}`); await this.showAccessDenied(); return false; } try { await router.replaceUrl({ url: pageUrl, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left replacePage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pageUrl AST#identifier#Right AST#...
async replacePage(pageUrl: string, params?: Record<string, any>): Promise<boolean> { // 检查权限 if (!this.canAccessPage(pageUrl)) { console.error(`无权访问页面: ${pageUrl}`); await this.showAccessDenied(); return false; } try { await router.replaceUrl({ url: pageUrl, ...
https://github.com/LJ666-ui/harmony-health-care
629e7718b79712a10c3cb8574c33fbca996425e4
github
erosTeam/NextE
shared/src/main/ets/utils/BasicDataSource.ets
arkts
setData
Replace the whole list (refresh / first page).
setData(items: T[]): void { this.items = items this.notifyReload() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left items AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#[#Left [ AST#[#Right AST#]#Left ] AS...
setData(items: T[]): void { this.items = items this.notifyReload() }
https://github.com/erosTeam/NextE
5a53f374ed27b3c454b75c9a5e0fed06b780a199
github
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets
arkts
assemblingVideoBean
Assembling the video object
async assemblingVideoBean() { VIDEO_DATA.forEach(async (item: VideoItem) => { let videoBean = await getContext().resourceManager.getRawFd(item.iSrc); let uri = videoBean; this.videoLocalList.push(new VideoItem(item.name, uri, '')); }); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left assemblingVideoBean AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#...
async assemblingVideoBean() { VIDEO_DATA.forEach(async (item: VideoItem) => { let videoBean = await getContext().resourceManager.getRawFd(item.iSrc); let uri = videoBean; this.videoLocalList.push(new VideoItem(item.name, uri, '')); }); }
https://gitee.com/openharmony/codelabs.git
313f9fab37a116f0d87c7e924a595eec70ceb177
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitSfixed64
访问 sfixed64 字段 Wire type: 1 (64-bit)
visitSfixed64(value: bigint, fieldNumber: number): void { this.writer.tag(fieldNumber, 1).sfixed64(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitSfixed64 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 bigint AST#identifier#Right AST#,#Left , ...
visitSfixed64(value: bigint, fieldNumber: number): void { this.writer.tag(fieldNumber, 1).sfixed64(value) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
51909242938a9be26c9db76b611ea65041a1c4aa
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
isEncrypted
检查字符串是否为加密格式
isEncrypted(data: string): boolean { return data.length > 0 && data.startsWith(this.ENCRYPTED_PREFIX); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEncrypted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
isEncrypted(data: string): boolean { return data.length > 0 && data.startsWith(this.ENCRYPTED_PREFIX); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
b14e6785bc725dae1a38ed3fdbcaed258fb7d204
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
scale
============================================================ 需解码类(硬解硬编) ============================================================ 视频缩放 @param bitrate 可选码率参数,如 '1M', '500k'。不设置则使用编码器默认质量
public static scale(input: string, output: string, width: number, height: number, bitrate?: string): string[] { const cmd: string[] = [ 'ffmpeg', '-i', input, '-vf', `scale=${width}:${height}`, '-c:v', FFmpegFactory.HW_CODEC ]; if (bitrate !== undefined) { cmd.push('-b:v', bi...
AST#program#Left AST#expression_statement#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 scale AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#...
public static scale(input: string, output: string, width: number, height: number, bitrate?: string): string[] { const cmd: string[] = [ 'ffmpeg', '-i', input, '-vf', `scale=${width}:${height}`, '-c:v', FFmpegFactory.HW_CODEC ]; if (bitrate !== undefined) { cmd.push('-b:v', bi...
https://github.com/jjjjjjava/ffmpeg_tools
3ad0263919ff309373bb78dc025fabc95d4752d9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a Float32Array with the same ArrayBuffer @param begin start index, inclusive @returns new Float32Array with the same ArrayBuffer
public subarray(begin: number): Float32Array { return this.subarray(begin as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number): Float32Array { return this.subarray(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
48925cf4774dc9245720a18a665f3daa3471b774
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
encodedQuery
Sets the encoded query component from this URI. @param { string } input
set encodedQuery(input: string) { this.uriEntry.setQuery(input); }
AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left encodedQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#...
set encodedQuery(input: string) { this.uriEntry.setQuery(input); }
https://gitcode.com/iop123123/arkts-static-skills
d586d98f789e7d2638b9a9ef7651be22e3f18f66
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
createEntryFromPresetId
从预置模板ID创建条目
createEntryFromPresetId( templateId: string, parentGroup: KdbxGroup, options?: TemplateApplyOptions ): KdbxEntry | null { const template = this.getPresetTemplateById(templateId); if (!template) { hilog.warn(DOMAIN, TAG, `Template not found: ${templateId}`); return null; } ret...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left createEntryFromPresetId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left templateId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri...
createEntryFromPresetId( templateId: string, parentGroup: KdbxGroup, options?: TemplateApplyOptions ): KdbxEntry | null { const template = this.getPresetTemplateById(templateId); if (!template) { hilog.warn(DOMAIN, TAG, `Template not found: ${templateId}`); return null; } ret...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L155-L166
8db4b38cfb0b777927e221d6766e92ad544ce102
github
openharmony/applications_calendar_data
datastructure/src/main/ets/events/Events.ets
arkts
isAllDay
判断是否全天日程 @return true 全天日程 false 非全天日程
public isAllDay(): boolean { return this.allDay === 1; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAllDay 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 isAllDay(): boolean { return this.allDay === 1; }
https://gitee.com/openharmony/applications_calendar_data.git
de429d9319f17c70a4bc1940ef496bf914865180
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/pages/RehabListPage.ets
arkts
handleSearch
==================== 搜索与分页 ====================
handleSearch(): void { this.currentPage = 1; this.loadCoursesFromAPI(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleSearch 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...
handleSearch(): void { this.currentPage = 1; this.loadCoursesFromAPI(); }
https://github.com/LJ666-ui/harmony-health-care
56096f368ce8de8727cba646089a6da44dbe73ba
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/DataMapper.ets
arkts
getMetadata
获取实体元数据 @returns 实体元数据
getMetadata(): EntityMetadata { return this.entityMetadata }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMetadata 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 EntityMetadata AST#identifier#Right AST#ERROR#Righ...
getMetadata(): EntityMetadata { return this.entityMetadata }
https://github.com/offlinecat-dev/OCNetORM
c4e4fa68f9069a2587817867b43336460f82dff2
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/RealInterceptorChain.ets
arkts
writeTimeout
Get the write timeout. @returns The write timeout in milliseconds.
writeTimeout(): number { return this._writeTimeout; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement...
writeTimeout(): number { return this._writeTimeout; }
https://github.com/killetom/ktretrofit
da6cc8f6605c9d40d74bde3f8f80156dbab4953a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
constructor
Creates a LinkedConcurrentQueue from an iterable with the default capacity. Appends each defined element from the iterable in iteration order. @param { Iterable<T> } iterable The iterable source used to initialize the queue. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(iterable: Iterable<T>) { this.actualCapacity = Int.MAX_VALUE; this.initializeQueueState(); this.appendIterable(iterable); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iterable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex...
public constructor(iterable: Iterable<T>) { this.actualCapacity = Int.MAX_VALUE; this.initializeQueueState(); this.appendIterable(iterable); }
https://gitcode.com/iop123123/arkts-static-skills
558b5a8bb16f60812ccff58dbdd8ced5ecaaebc2
gitcode
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Column.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example ColumnSpaceBetweenEnd() { Text("A"); Text("B"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: HorizontalAlign.End, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.mar...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceBetween, alignItems: HorizontalAlign.End, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.mar...
https://github.com/Joker-x-dev/CoolMallArkTS
4d65bfa1446e2f55787ef41ce2c784f76776d543
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/pages/aiinsight/AIInsightState.ets
arkts
stopGeneration
停止流式生成,不将未完成内容写入历史。
stopGeneration(): void { this.cancelStream(); this.isGenerating = false; if (this.activeRecord !== null) { const activeId = this.activeRecord.id; this.records = this.records.filter((item: InsightRecord) => item.id !== activeId); } this.generatingText = ''; this.errorMessage = ''; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopGeneration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
stopGeneration(): void { this.cancelStream(); this.isGenerating = false; if (this.activeRecord !== null) { const activeId = this.activeRecord.id; this.records = this.records.filter((item: InsightRecord) => item.id !== activeId); } this.generatingText = ''; this.errorMessage = ''; ...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/AIInsightState.ets#L290-L302
f3c2d4bb3ea4e83e82a43947f2c51fee1c082f89
github
webabcd/HarmonyDemo
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
UIAbility 的窗口销毁时
onWindowStageDestroy(): void { MyLog.d('ability onWindowStageDestroy'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme...
onWindowStageDestroy(): void { MyLog.d('ability onWindowStageDestroy'); }
https://github.com/webabcd/HarmonyDemo
10b03e991bec4667bb5a024d1c34aac604f0cb96
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/BackgroundMusicManager.ets
arkts
pauseForGame
进入游戏时暂停背景音乐
public async pauseForGame(): Promise<void> { if (!this.initialized || !this.avPlayer) return; const enabled = this.settingsManager.getSync<boolean>('bgm_enabled', true); if (!enabled) return; this.pausedForGame = true; await this.pause(); hilog.info(DOMAIN, TAG, 'BGM paused for game'); }
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 pauseForGame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public async pauseForGame(): Promise<void> { if (!this.initialized || !this.avPlayer) return; const enabled = this.settingsManager.getSync<boolean>('bgm_enabled', true); if (!enabled) return; this.pausedForGame = true; await this.pause(); hilog.info(DOMAIN, TAG, 'BGM paused for game'); }
https://github.com/richshaw2015/nds
a43f90aed699932d308989ff683de727d09f2048
github
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioDecoderManager.ets
arkts
initContext
初始化应用上下文 @param {common.Context} context - Ability 或应用上下文
public initContext(context: common.Context): void { this.context = context; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression...
public initContext(context: common.Context): void { this.context = context; }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioDecoderManager.ets#L216-L218
704773ed0c64e8e909222a604499667f787644fb
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
query
查询全部user(在WEILIAO项目的注册方面不需要使用该方法,作为参考用于其他功能)
query(user: AccountData, callback: Function) { //初始化对象 let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName) //执行查询方法 this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => { //创建变量,存储结果行数 let count: number = resultSet.rowCount ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AccountData AST#identifier#Right AS...
query(user: AccountData, callback: Function) { //初始化对象 let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName) //执行查询方法 this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet) => { //创建变量,存储结果行数 let count: number = resultSet.rowCount ...
https://gitee.com/openharmony/vendor_unionman.git
06a02bf5c9033446b41e02c6ddf49fe537e7ec0f
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/constants/ApiConstants.ets
arkts
onebox
获取链接 onebox 预览 HTML
static onebox(url: string, refresh: boolean = true): string { const encodedUrl: string = encodeURIComponent(url); return refresh ? `/onebox?url=${encodedUrl}&refresh=true` : `/onebox?url=${encodedUrl}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onebox AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST...
static onebox(url: string, refresh: boolean = true): string { const encodedUrl: string = encodeURIComponent(url); return refresh ? `/onebox?url=${encodedUrl}&refresh=true` : `/onebox?url=${encodedUrl}`; }
https://github.com/Amaz1ny/HarmonyDO-public
029186c0eef87f915aed09f6dc43bbcf9000323d
github
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/components/coin/Coin.ets
arkts
flipCoin
抛硬币动画
flipCoin() { this.isFlipped = randomBoolean() if (this.isFlipped) { // 翻转正面 this.rotateY = 0 this.opacityFront = 1 this.opacityBack = 0 // 正面次数+1 this.headTime++ // 总次数+1 this.totalTime++ // 正面出现的概率 this.headOdds = this.headTime / this.totalTime ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left flipCoin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS...
flipCoin() { this.isFlipped = randomBoolean() if (this.isFlipped) { // 翻转正面 this.rotateY = 0 this.opacityFront = 1 this.opacityBack = 0 // 正面次数+1 this.headTime++ // 总次数+1 this.totalTime++ // 正面出现的概率 this.headOdds = this.headTime / this.totalTime ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
bf5e9a052898b73f9b2e61b9eae90a952bb4ff53
gitcode
erosTeam/NextE
shared/src/main/ets/model/EhGallery.ets
arkts
merge
Fold a richer source onto a copy of this gallery; non-empty/non-zero values win.
merge(o: EhGallery): EhGallery { const g: EhGallery = this.copy() if (o.url.length > 0) g.url = o.url if (o.thumbUrl.length > 0) g.thumbUrl = o.thumbUrl if (o.thumbUrlL.length > 0) g.thumbUrlL = o.thumbUrlL if (o.imgWidth > 0) g.imgWidth = o.imgWidth if (o.imgHeight > 0) g.imgHeight = o.imgHei...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left merge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EhGallery AST#identifier#Right AST#)#Left ) AST#)#Rig...
merge(o: EhGallery): EhGallery { const g: EhGallery = this.copy() if (o.url.length > 0) g.url = o.url if (o.thumbUrl.length > 0) g.thumbUrl = o.thumbUrl if (o.thumbUrlL.length > 0) g.thumbUrlL = o.thumbUrlL if (o.imgWidth > 0) g.imgWidth = o.imgWidth if (o.imgHeight > 0) g.imgHeight = o.imgHei...
https://github.com/erosTeam/NextE
e49a5878dbb3949193e4738929098207d6154e93
github
kumaleap/ArkSwipeDeck
library/src/main/ets/utils/AnimationUtils.ets
arkts
clamp
限制数值范围 @param value - 输入值 @param min - 最小值 @param max - 最大值 @returns 限制后的值
static clamp(value: number, min: number, max: number): number { return Math.max(min, Math.min(max, value)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left clamp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
static clamp(value: number, min: number, max: number): number { return Math.max(min, Math.min(max, value)); }
https://github.com/kumaleap/ArkSwipeDeck
c7040007c92654cf00771eb0cbcd0f474f8cbaa5
github
tdcare/tdwebrtc
src/main/ets/utils/PermissionUtil.ets
arkts
requestGlobalSwitch
用于UIAbility/UIExtensionAbility拉起全局开关设置弹框。部分情况下,录音、拍照等功能禁用,应用可拉起此弹框请求用户同意开启对应功能。如果当前全局开关的状态为开启,则不拉起弹框 @param type 全局开关类型。 @returns
static async requestGlobalSwitch(type: abilityAccessCtrl.SwitchType): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = getContext() as common.UIAbilityContext; return await atManager.requestGlobalSwitch(context, type); }
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 requestGlobalSwitch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left...
static async requestGlobalSwitch(type: abilityAccessCtrl.SwitchType): Promise<boolean> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); const context: Context = getContext() as common.UIAbilityContext; return await atManager.requestGlobalSwitch(context, type); }
https://github.com/tdcare/tdwebrtc
02910c5d35cdf224214e3184320060d640dc63e8
github
Yebingiscn/SweetVideo
entry/src/main/ets/database/Preferences.ets
arkts
saveVideoMetaData
保存首页 TODO 这里需要施工
static saveVideoMetaData(context: Context, video_meta_data: VideoMetadata[]) { const folders = Preferences.getFileFolder(context) const rootFolderIndex: number = folders.findIndex(i => i.name === '首页') if (rootFolderIndex !== -1) { folders[rootFolderIndex].video_list = video_meta_data Preferen...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveVideoMetaData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static saveVideoMetaData(context: Context, video_meta_data: VideoMetadata[]) { const folders = Preferences.getFileFolder(context) const rootFolderIndex: number = folders.findIndex(i => i.name === '首页') if (rootFolderIndex !== -1) { folders[rootFolderIndex].video_list = video_meta_data Preferen...
https://github.com/Yebingiscn/SweetVideo
bd3fe417174096c2da7af117e3ff6ea845d4c6ed
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
isBlank
判断字符串是否为空和空白符(空白符包括空格、制表符、全角空格和不间断空格)。true为空,否则false @param str @returns
static isBlank(str: string | undefined | null): boolean { if ((str === undefined) || (str === null)) { return true; } let trimStr = StrUtil.trimAll(str); return trimStr.length === 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isBlank AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AS...
static isBlank(str: string | undefined | null): boolean { if ((str === undefined) || (str === null)) { return true; } let trimStr = StrUtil.trimAll(str); return trimStr.length === 0; }
https://github.com/tdcare/tdwebrtc
f3325dc964927dcb5e1eed4b43705e49aa8cb718
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/Utils.ets
arkts
init
initialize method, called inside the Chart.init() method. @param context
public static init() { }
AST#program#Left AST#expression_statement#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 init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#ar...
public static init() { }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c8275209b7a9e265dd711fa127c065c8cbb2bf9a
gitee
YANGZX22/Voot
entry/src/main/ets/services/ModelDownloadService.ets
arkts
getModelPath
获取模型文件路径(用于加载模型)
public getModelPath(context: common.UIAbilityContext): string { return this.getModelDir(context); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getModelPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressio...
public getModelPath(context: common.UIAbilityContext): string { return this.getModelDir(context); }
https://github.com/YANGZX22/Voot
b4d3e0270725c4bc3a5adb9922afe44ce840829b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/ImagePreprocessor.ets
arkts
resize
缩放图像 @param pixelMap 原始图像 @param targetWidth 目标宽度 @param targetHeight 目标高度 @returns 缩放后的图像
async resize( pixelMap: image.PixelMap, targetWidth: number, targetHeight: number ): Promise<image.PixelMap> { try { // 获取原始图像信息 const imageInfo = await pixelMap.getImageInfo(); const originalWidth = imageInfo.size.width; const originalHeight = imageInfo.size.height; /...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left resize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pixelMap AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async resize( pixelMap: image.PixelMap, targetWidth: number, targetHeight: number ): Promise<image.PixelMap> { try { // 获取原始图像信息 const imageInfo = await pixelMap.getImageInfo(); const originalWidth = imageInfo.size.width; const originalHeight = imageInfo.size.height; /...
https://github.com/LJ666-ui/harmony-health-care
209f5dd24b03272db5b0982d4032207b7f694db8
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/CandleDataSet.ets
arkts
setDecreasingPaintStyle
Sets paint style when open > close @param decreasingPaintStyle
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void { this.mDecreasingPaintStyle = decreasingPaintStyle; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDecreasingPaintStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left decreasingPaintStyle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi...
public setDecreasingPaintStyle(decreasingPaintStyle: Style): void { this.mDecreasingPaintStyle = decreasingPaintStyle; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
edbbda007295fd8cbb0955aeaf468a03490ea603
gitee
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/view/GoodsCommentPage.ets
arkts
build
构建商品评论页面 @returns {void} 无返回值
build(): void { AppNavDestination({ title: $r("app.string.goods_comment_title"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.GoodsCommentContent() }); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { AppNavDestination({ title: $r("app.string.goods_comment_title"), viewModel: this.vm }) { BaseNetWorkListView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.GoodsCommentContent() }); } }
https://github.com/Joker-x-dev/CoolMallArkTS
701a9a765ff575a20c710b556fe7d607ad1c1dc7
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
getByType
根据规则类型查询
static async getByType( userId: number, ruleType: 'keyword' | 'regex' | 'amount' | 'merchant' | 'composite' ): Promise<SmartCategoryRule[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${SmartCategoryRule.tableName} WHERE user_id = ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:...
static async getByType( userId: number, ruleType: 'keyword' | 'regex' | 'amount' | 'merchant' | 'composite' ): Promise<SmartCategoryRule[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${SmartCategoryRule.tableName} WHERE user_id = ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ba04217279df33326b9d9afe1a50129091d447e8
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
confirmLogout
确认退出登录 @returns {void} 无返回值
confirmLogout(): void { this.userState.logout(); this.hideLogoutDialog(); navigateBack(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmLogout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
confirmLogout(): void { this.userState.logout(); this.hideLogoutDialog(); navigateBack(); }
https://github.com/Joker-x-dev/CoolMallArkTS
ef742440075c4d3e8ea9345f945ad596549df4f9
github
StarHeartY/CalculatorX
entry/src/main/ets/utils/EngineService.ets
arkts
parseWebJsonResult
3. 解析并安全验证从 Webview 返回的 JSON 字符串
public static parseWebJsonResult(jsonResult: string): string { let cleanJsonString = ''; try { cleanJsonString = JSON.parse(jsonResult); if (typeof cleanJsonString === 'string') { cleanJsonString = JSON.parse(cleanJsonString); } } catch (e) { cleanJsonString = jsonResult; ...
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 parseWebJsonResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonResult AST#identifier#Right AST#ERROR#Left AST#...
public static parseWebJsonResult(jsonResult: string): string { let cleanJsonString = ''; try { cleanJsonString = JSON.parse(jsonResult); if (typeof cleanJsonString === 'string') { cleanJsonString = JSON.parse(cleanJsonString); } } catch (e) { cleanJsonString = jsonResult; ...
https://github.com/StarHeartY/CalculatorX
59e350fc43d5b0ad69ab429818259315a30191f5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreMangaLibraryWithStrategy
带冲突处理策略的恢复方法
private async restoreMangaLibraryWithStrategy(items: MangaBackupItem[], strategy: 'skip' | 'replace' | 'merge'): Promise<void> { logger.info(TAG, `Restoring manga library with strategy: ${strategy}, ${items.length} items`); const failures: string[] = []; for (const item of items) { 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 restoreMangaLibraryWithStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#...
private async restoreMangaLibraryWithStrategy(items: MangaBackupItem[], strategy: 'skip' | 'replace' | 'merge'): Promise<void> { logger.info(TAG, `Restoring manga library with strategy: ${strategy}, ${items.length} items`); const failures: string[] = []; for (const item of items) { try { ...
https://github.com/DaLongZhuaZi/manxia
ea80bb12139b12f6c2e6534dfb978dbc8779754f
github
OHPG/FinMusic
entry/src/main/ets/player/AppPlaybackManager.ets
arkts
resumeAudioQueue
恢复上次播放列表(App 启动时调用)。 只加载队列和 prepare,不自动播放,等待用户手动触发。
public async resumeAudioQueue(): Promise<void> { let items = await this.repository.getPlayList() console.info("FinMusic: resumeAudioQueue items=" + (items ? items.length : 0)) if (!items || items.length <= 0) return // 找到最近播放的项 let lastItem: BaseItemDto | undefined = undefined for (let item o...
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 resumeAudioQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async resumeAudioQueue(): Promise<void> { let items = await this.repository.getPlayList() console.info("FinMusic: resumeAudioQueue items=" + (items ? items.length : 0)) if (!items || items.length <= 0) return // 找到最近播放的项 let lastItem: BaseItemDto | undefined = undefined for (let item o...
https://github.com/OHPG/FinMusic
8cc02486f67da86299beed7ee9bc7aca8ee1afb2
github
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/pages/HttpsPlayer.ets
arkts
destroyCurrentConnect
在切换视频前,先销毁当前的连接
destroyCurrentConnect() { try { const currentUrl = this.SRC_LIST[this.index]; if (currentUrl) { GlobalProxyServer?.getInstance()?.getServer()?.destroyCurrentSource(currentUrl); Logger.info(TAG, `已销毁当前视频连接: ${currentUrl}`); } } catch (err) { Logger.error(TAG, `销毁当前视频连接失败...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left destroyCurrentConnect 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_bl...
destroyCurrentConnect() { try { const currentUrl = this.SRC_LIST[this.index]; if (currentUrl) { GlobalProxyServer?.getInstance()?.getServer()?.destroyCurrentSource(currentUrl); Logger.info(TAG, `已销毁当前视频连接: ${currentUrl}`); } } catch (err) { Logger.error(TAG, `销毁当前视频连接失败...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
69e8b31a088237a7f3a8f54d73c8894980690bff
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/skill/utils/SkillTestTool.ets
arkts
testRehabTraining
测试康复训练意图
private async testRehabTraining(): Promise<void> { const testName = '康复训练'; try { const result = await this.skill.handleQuickCommand('开始康复训练'); const passed = result.ttsText.includes('康复') || result.ttsText.includes('训练'); this.addResult(testName, '开始康复训练', passed, result); }...
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 testRehabTraining AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async testRehabTraining(): Promise<void> { const testName = '康复训练'; try { const result = await this.skill.handleQuickCommand('开始康复训练'); const passed = result.ttsText.includes('康复') || result.ttsText.includes('训练'); this.addResult(testName, '开始康复训练', passed, result); }...
https://github.com/LJ666-ui/harmony-health-care
21054eba905f82c561284f4e5b1223b4d5c40611
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets
arkts
values
Return the elements in the TreeSet as an Iterator of values @returns an Iterator of values
values(): IterableIterator<T> { return this.treeMap.keys(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#...
values(): IterableIterator<T> { return this.treeMap.keys(); }
https://gitcode.com/iop123123/arkts-static-skills
d87d96a034a6230d4980020f6b754d42a11f556a
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitMessage
========== 嵌套消息(⭐ 自动递归) ========== 访问嵌套消息字段 ⭐ 核心方法:自动处理递归! 实现逻辑: 1. 检查递归深度(防止栈溢出) 2. 创建新的 JsonEncodingVisitor 3. 调用嵌套消息的 traverse() 方法(自动递归) 4. 获取嵌套消息的 JSON 对象 5. 设置到当前 JSON 对象中 @param value 嵌套消息对象 @param fieldNumber proto 字段编号 @throws 如果递归深度超过限制
visitMessage(value: Message, fieldNumber: number): void { // 递归深度保护 this.recursionDepth++ if (this.recursionDepth > this.maxRecursionDepth) { throw new Error(`Message nesting depth exceeds limit: ${this.maxRecursionDepth}`) } try { const fieldName = this.getFieldName(fieldNumber) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMessage 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 Message AST#identifier#Right AST#,#Left , ...
visitMessage(value: Message, fieldNumber: number): void { // 递归深度保护 this.recursionDepth++ if (this.recursionDepth > this.maxRecursionDepth) { throw new Error(`Message nesting depth exceeds limit: ${this.maxRecursionDepth}`) } try { const fieldName = this.getFieldName(fieldNumber) ...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
b43bac42ba59d6b6d23740e185ed3db6d9e1abbf
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/MultiShopping/common/src/main/ets/utils/LocalDataManager.ets
arkts
insertShopCart
Insert data to shopCartData. @param props value of Product. @returns
insertShopCart(props: ShopProps): number { const result = commodityData.filter((item) => item.id === props.commodityId)[0]; const newShop: Product = { id: getID(), name: result.title, img: result.images, price: result.price, count: props.count, specifications: props.specifi...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertShopCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left props AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ShopProps AST#identifier#Right AST#)#Lef...
insertShopCart(props: ShopProps): number { const result = commodityData.filter((item) => item.id === props.commodityId)[0]; const newShop: Product = { id: getID(), name: result.title, img: result.images, price: result.price, count: props.count, specifications: props.specifi...
https://gitee.com/harmonyos/codelabs.git
cbd442718138adef30d0c0661da089cb0aaeb465
gitee
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/DownloadRecordTable.ets
arkts
queryByStatus
根据状态查询
async queryByStatus(status: number): Promise<DownloadRecordInfo[]> { return this.query(this.getPredicates().equalTo('status', status).orderByDesc('create_time')); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryByStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left status AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async queryByStatus(status: number): Promise<DownloadRecordInfo[]> { return this.query(this.getPredicates().equalTo('status', status).orderByDesc('create_time')); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/DownloadRecordTable.ets#L48-L50
cc84d01502565f8e51a42aea98a2383c0e61743d
github
XXYoLoong/FortuneBet
entry/src/main/ets/pages/profile/ProfilePage.ets
arkts
build
---------------- UI 构建 ----------------
build() { Column() { if (this.currentView === ProfileView.MAIN) { this.renderMainProfile(); } else if (this.currentView === ProfileView.SETTINGS) { this.renderSettingsPage(); } else if (this.currentView === ProfileView.EDIT_PROFILE) { this.renderEditProfilePage(); }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { if (this.currentView === ProfileView.MAIN) { this.renderMainProfile(); } else if (this.currentView === ProfileView.SETTINGS) { this.renderSettingsPage(); } else if (this.currentView === ProfileView.EDIT_PROFILE) { this.renderEditProfilePage(); }...
https://github.com/XXYoLoong/FortuneBet
91fd82e76802e5167585e304b9332d5232635f4c
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/loader/FlutterLoader.ets
arkts
ensureInitializationComplete
初始化dart虚拟机方法 <p>It does not support Impeller. Do not allow adding shellArgs "--enable-impeller". @param flutterShellArgs
ensureInitializationComplete(shellArgs: Array<string> | null) { if (this.initialized) { return; } if (shellArgs == null) { shellArgs = new Array<string>(); } shellArgs.push( "--icu-native-lib-path=" + this.flutterApplicationInfo!.nativeLibraryDir + FILE_SEPARATOR ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ensureInitializationComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#instantiation_expression#Left AST#identifier#Left shellArgs AST#identifier#Right AST#ERROR#Left AST#:#L...
ensureInitializationComplete(shellArgs: Array<string> | null) { if (this.initialized) { return; } if (shellArgs == null) { shellArgs = new Array<string>(); } shellArgs.push( "--icu-native-lib-path=" + this.flutterApplicationInfo!.nativeLibraryDir + FILE_SEPARATOR ...
https://gitee.com/openharmony-sig/flutter_engine.git
86bd9b0f4169da7540472dde9c7697ae4ed589f0
gitee
arkui-x/samples
CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/view/CustomAddressPicker.ets
arkts
getFontColor
获取省、市、区名需要显示的字体颜色 @param addressType 省/市/区类型 @param item 省、市、区地址项 @returns 需要显示的字体颜色
getFontColor(addressType: AddressType, item: CommonAddressList): Color | string | Resource { // 省/市/区名字体颜色 let isSelect: boolean = false; if (addressType === AddressType.Province) { isSelect = this.currentSelectInfo.province !== '' && item.name === this.currentSelectInfo.province; } else if (add...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFontColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addressType AST#identifier#Right AST#:#Left : AST#:#Right AST...
getFontColor(addressType: AddressType, item: CommonAddressList): Color | string | Resource { // 省/市/区名字体颜色 let isSelect: boolean = false; if (addressType === AddressType.Province) { isSelect = this.currentSelectInfo.province !== '' && item.name === this.currentSelectInfo.province; } else if (add...
https://gitcode.com/arkui-x/samples
f185e6178ba9badd92d2561c23596229e4181d50
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/parking/ParkingService.ets
arkts
getFeeRates
获取停车费率配置
getFeeRates(): FeeRateConfig { return getMockFeeRates(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFeeRates 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 FeeRateConfig AST#identifier#Right AST#ERROR#Right...
getFeeRates(): FeeRateConfig { return getMockFeeRates(); }
https://github.com/LJ666-ui/harmony-health-care
44a7bb981b35a0754edbfcff96fde01caba6a818
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractDualSenseController.ets
arkts
inputLoop
输入读取线程 (ArkTS 后备方案)
private async inputLoop(): Promise<void> { console.info(`${TAG} 输入循环启动 - 等待数据...`); // 初始化完成,标记就绪并通知 this.notifyDeviceAdded(); console.info(`${TAG} 设备已添加通知发送完成`); let readCount = 0; let successCount = 0; let detectedHardwareError = false; // 智能恢复状态 let consecutiveErr...
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 inputLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
private async inputLoop(): Promise<void> { console.info(`${TAG} 输入循环启动 - 等待数据...`); // 初始化完成,标记就绪并通知 this.notifyDeviceAdded(); console.info(`${TAG} 设备已添加通知发送完成`); let readCount = 0; let successCount = 0; let detectedHardwareError = false; // 智能恢复状态 let consecutiveErr...
https://github.com/AlkaidLab/moonlight-harmony
1d1f47ff9c5a65782fe5575a18ceca4e1e2ec9b5
github
751496032/DSBridge-HarmonyOS
library/src/main/ets/core/WebViewControllerProxy.ets
arkts
hasJavascriptMethod
判断JS方法是否存在 @param method @returns
hasJavascriptMethod(method: string): Promise<boolean> { return this.bridge.hasJavascriptMethod(method) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left hasJavascriptMethod AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left me...
hasJavascriptMethod(method: string): Promise<boolean> { return this.bridge.hasJavascriptMethod(method) }
https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L69-L71
84f59915e9ab32e1880d132b423fa84e8da60d20
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/SandboxManager.ets
arkts
cleanupExpiredFiles
清理过期文件
public async cleanupExpiredFiles(): Promise<void> { try { const now = Date.now(); const cacheDir = this.directories.cache; const tempDir = this.directories.temp; await this.cleanupDirectoryByAge(cacheDir, now - this.config.maxFileAge); await this.cleanupDirectoryByAge(tempDir,...
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 cleanupExpiredFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public async cleanupExpiredFiles(): Promise<void> { try { const now = Date.now(); const cacheDir = this.directories.cache; const tempDir = this.directories.temp; await this.cleanupDirectoryByAge(cacheDir, now - this.config.maxFileAge); await this.cleanupDirectoryByAge(tempDir,...
https://github.com/DaLongZhuaZi/manxia
b1814f66375770397f3bbfbede18fa2222cc19b0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint8Clamped with all elements. @returns a new Uint8ClampedArray with elements of current Uint8ClampedArray
public slice(): Uint8ClampedArray { return new Uint8ClampedArray(this) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public slice(): Uint8ClampedArray { return new Uint8ClampedArray(this) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
42196f6d12c9888eef3c6ebe9b8680feef7c8a0c
gitee
HarmonyOS_Samples/MultiVideoApplication
common/multivideobase/src/main/ets/utils/WindowUtil.ets
arkts
getCalDegree
Calculate the rotation angle of the device within the screen plane.
getCalDegree(x: number, y: number, z: number): number { let degree: number = 0; // three is Effective Delta Angle Threshold Coefficient. if ((x * x + y * y) * 3 < z * z) { return degree; } degree = 90 - (Number)(Math.round(Math.atan2(y, -x) / Math.PI * 180)); return degree >= 0 ? degree ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCalDegree AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,...
getCalDegree(x: number, y: number, z: number): number { let degree: number = 0; // three is Effective Delta Angle Threshold Coefficient. if ((x * x + y * y) * 3 < z * z) { return degree; } degree = 90 - (Number)(Math.round(Math.atan2(y, -x) / Math.PI * 180)); return degree >= 0 ? degree ...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
826521d500919733fcba5d12fb4080fa53e4b10f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/FTP/FTPNativeClient.ets
arkts
setCurrentPath
设置当前路径
setCurrentPath(path: string): void { this.currentPath = path; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCurrentPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
setCurrentPath(path: string): void { this.currentPath = path; }
https://github.com/DaLongZhuaZi/manxia
4d9a7121aeed871da6d0f76fd84b9b47bd7b7b2c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
map
Creates a new Int32Array using fn(arr[i]) over all elements of current Int32Array. @param { function } fn - a function to apply for each element of current Int32Array @returns { Int32Array } - a new Int32Array where for each element from current Int32Array fn was applied @syscap SystemCapability.Utils.Lang @FaAndStageM...
public map(fn: (val: number, index: int, array: Int32Array) => number): Int32Array { let resBuf = new ArrayBuffer(this.lengthInt * Int32Array.BYTES_PER_ELEMENT) let res = new Int32Array(resBuf, 0, (resBuf.getByteLength() / Int32Array.BYTES_PER_ELEMENT).toInt()) for (let i = 0; i < this.lengt...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number, index: int, array: Int32Array) => number): Int32Array { let resBuf = new ArrayBuffer(this.lengthInt * Int32Array.BYTES_PER_ELEMENT) let res = new Int32Array(resBuf, 0, (resBuf.getByteLength() / Int32Array.BYTES_PER_ELEMENT).toInt()) for (let i = 0; i < this.lengt...
https://gitcode.com/iop123123/arkts-static-skills
8641c080353807ca8b708f261267515342f894f1
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
clearPassword
清空最近文件的密码 @param filePath 最近文件 @returns 结果
public static clearPassword(filePath: string): Promise<boolean> { return RecentFilesService.getRecentFile(filePath).then((recentFile) => { if (!recentFile) { return false; } recentFile.password = undefined; return RecentFilesService.addRecentFile(recentFile).then(result => { ...
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 clearPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public static clearPassword(filePath: string): Promise<boolean> { return RecentFilesService.getRecentFile(filePath).then((recentFile) => { if (!recentFile) { return false; } recentFile.password = undefined; return RecentFilesService.addRecentFile(recentFile).then(result => { ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L454-L467
1e012a79b0d3a6a319a2ebe386bfb39929708f9f
github
2763981847/Clock-Alarm
entry/src/main/ets/viewmodel/DetailViewModel.ets
arkts
setAlarmRemind
设置闹钟提醒。 @param alarmItem AlarmItem
public async setAlarmRemind(alarmItem: AlarmItem) { alarmItem.hour = this.getAlarmTime(0); alarmItem.minute = this.getAlarmTime(1); let index = await this.findAlarmWithId(alarmItem.id); if (index !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) { this.reminderService.deleteReminder(alarmItem.id); ...
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 setAlarmRemind AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmItem AST#identifier#Right AST#:#Left...
public async setAlarmRemind(alarmItem: AlarmItem) { alarmItem.hour = this.getAlarmTime(0); alarmItem.minute = this.getAlarmTime(1); let index = await this.findAlarmWithId(alarmItem.id); if (index !== CommonConstants.DEFAULT_NUMBER_NEGATIVE) { this.reminderService.deleteReminder(alarmItem.id); ...
https://github.com/2763981847/Clock-Alarm
ea56a2d380c2dfba411b3c5bc5fc18628e348852
github
ASweetBite/HarmonyPulse
entry/src/main/ets/type/GlobalMusic.ets
arkts
resetToMusic
切换当前选中的音乐信息(不包含播放逻辑,只更新状态)
private resetToMusic(index: number) { const item = this.songList[index]; if (item) { this.currentMusic = index; this.currentID = item.id; this.name = item.name; this.author = item.author; this.img = item.img; this.lyricPath = item.lyricPath this.hasLyric = item.hasLyr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetToMusic 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...
private resetToMusic(index: number) { const item = this.songList[index]; if (item) { this.currentMusic = index; this.currentID = item.id; this.name = item.name; this.author = item.author; this.img = item.img; this.lyricPath = item.lyricPath this.hasLyric = item.hasLyr...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/type/GlobalMusic.ets#L64-L78
e5bb13e741fbf098ad916418fe129c729ca6a853
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
createOrder
创建订单 @param {CreateOrderRequest} params - 创建订单参数 @returns {Promise<NetworkResponse<Order>>} 创建成功的订单信息
async createOrder(params: CreateOrderRequest): Promise<NetworkResponse<Order>> { const resp: AxiosResponse<NetworkResponse<Order>> = await NetworkClient.http.post("order/info/create", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createOrder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async createOrder(params: CreateOrderRequest): Promise<NetworkResponse<Order>> { const resp: AxiosResponse<NetworkResponse<Order>> = await NetworkClient.http.post("order/info/create", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
d1c3c55d8e9b349f8e972ad27f411935efba248d
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/pages/chatPage.ets
arkts
buf2String
ArrayBuffer转utf8字符串
function buf2String(buf: ArrayBuffer) { let msgArray = new Uint8Array(buf); let textDecoder = util.TextDecoder.create('utf-8'); return textDecoder.decodeWithStream(msgArray) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buf2String AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buf AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function buf2String(buf: ArrayBuffer) { let msgArray = new Uint8Array(buf); let textDecoder = util.TextDecoder.create('utf-8'); return textDecoder.decodeWithStream(msgArray) }
https://gitee.com/openharmony/vendor_unionman.git
840f3d556f67ef38b0d2368c096ef82e3a800204
gitee
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/view/MonthViewItem.ets
arkts
getMonthViewData
获取指定月份数据
getMonthViewData(year: number, month: number) { this.monthDays = [...TimeUtils.byMonthDayForYear(year, month)]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getMonthViewData 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 number AST#identifier#Ri...
getMonthViewData(year: number, month: number) { this.monthDays = [...TimeUtils.byMonthDayForYear(year, month)]; }
https://gitcode.com/arkui-x/samples
aab8c0874cc72b09635dfa49b3ccaa4d721c19bc
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
timeFormatUTC
UTC时间格式化
timeFormatUTC(time: number, format: string, offset: number): string { const date = new Date(time + offset * 3600 * 1000); return date.toISOString(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left timeFormatUTC AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , A...
timeFormatUTC(time: number, format: string, offset: number): string { const date = new Date(time + offset * 3600 * 1000); return date.toISOString(); }
https://github.com/DaLongZhuaZi/manxia
2a0548df874254e76c511582abaae3b0d0b64de8
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/Transformer.ets
arkts
getPixelForValues
Returns a recyclable MPPointD instance. Returns the x and y coordinates (pixels) for a given x and y value in the chart. @param x @param y @return
public getPixelForValues(x: number, y: number): MPPointD { this.ptsBuffer[0] = x; this.ptsBuffer[1] = y; this.pointValuesToPixel(this.ptsBuffer); let xPx: number = this.ptsBuffer[0]; let yPx: number = this.ptsBuffer[1]; return MPPointD.getInstance(xPx, yPx); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPixelForValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public getPixelForValues(x: number, y: number): MPPointD { this.ptsBuffer[0] = x; this.ptsBuffer[1] = y; this.pointValuesToPixel(this.ptsBuffer); let xPx: number = this.ptsBuffer[0]; let yPx: number = this.ptsBuffer[1]; return MPPointD.getInstance(xPx, yPx); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9f133c1ec03ee0a9e2306a5febd625952836644e
gitee
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
getProviderByIdAsync
异步查找:缓存未命中时做一次 loadAll 回源再取
async getProviderByIdAsync(providerId: string): Promise<ModelProvider | null> { const cached = this.getProviderById(providerId) if (cached !== null) { return cached } await this.loadAll() return this.getProviderById(providerId) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getProviderByIdAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerId AST#identifier#Right AST#type_annotation#Left A...
async getProviderByIdAsync(providerId: string): Promise<ModelProvider | null> { const cached = this.getProviderById(providerId) if (cached !== null) { return cached } await this.loadAll() return this.getProviderById(providerId) }
https://github.com/LongLiveY96/chatcube
1019c261a3212f7875268d89a712f16e12726b33
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/components/SessionView.ets
arkts
onPixelMapChanged
Handle pixel map changes
onPixelMapChanged(): void { // Force refresh when pixel map changes }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPixelMapChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressi...
onPixelMapChanged(): void { // Force refresh when pixel map changes }
https://github.com/tangwengang-del/freerdp-harmonyos
80d24d29de059694b6d5094bab36f4f6ee1510e8
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
getPlaybackState
获取当前播放状态
getPlaybackState(): PlaybackState { return this.playbackState }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPlaybackState 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 PlaybackState AST#identifier#Right AST#ERROR#...
getPlaybackState(): PlaybackState { return this.playbackState }
https://gitcode.com/openharmony/codelabs
b2dd2da51e2fdf1d00c3fa1302c6382581fdf0f1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
format
Formats a number according to the locale and formatting options of this Intl.NumberFormat object. @param value A number or BigInt or long to format @returns A string representing the given number formatted according to the locale and formatting options of this Intl.NumberFormat object.
public format(value: number | bigint | long): string { if (value instanceof BigInt) { return this.formatDecStr(value.toString()); } else if (value instanceof Long) { return this.formatLong(value); } return this.formatDouble(value); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left format 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#binary_expression#Left A...
public format(value: number | bigint | long): string { if (value instanceof BigInt) { return this.formatDecStr(value.toString()); } else if (value instanceof Long) { return this.formatLong(value); } return this.formatDouble(value); ...
https://gitcode.com/iop123123/arkts-static-skills
056029f010bfa8662846b1aa09b88523491bffdd
gitcode
2763981847/Accounting-app
entry/src/main/ets/pages/MainPage.ets
arkts
deleteListItem
删除选中的列表项
deleteListItem() { this.accountTable.batchDelete(this.deleteList, () => { this.onAccountsChange(); }); this.deleteList = []; this.isEdit = false; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteListItem 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...
deleteListItem() { this.accountTable.batchDelete(this.deleteList, () => { this.onAccountsChange(); }); this.deleteList = []; this.isEdit = false; }
https://github.com/2763981847/Accounting-app
4008d637ec3ccf77666cd2ce789081ba41922407
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/api/ZoteroClient.ets
arkts
parseCreatedAnnotation
---------- typed parsers ---------- Each parser takes either the raw JSON string (top-level entry points) or an already-decoded record (called recursively for nested objects). We validate the fields the MVP actually depends on and tolerate unknown fields rather than failing closed — Zotero adds new fields without bumpi...
function parseCreatedAnnotation(body: string): ZoteroAnnotationLite { const root = parseJsonObject(body, 'createAnnotation'); const successfulRaw = root['successful']; if (successfulRaw === undefined || !isPlainObject(successfulRaw)) { // No successful map → check if 'failed' has details const failedRaw =...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseCreatedAnnotation AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left body AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function parseCreatedAnnotation(body: string): ZoteroAnnotationLite { const root = parseJsonObject(body, 'createAnnotation'); const successfulRaw = root['successful']; if (successfulRaw === undefined || !isPlainObject(successfulRaw)) { // No successful map → check if 'failed' has details const failedRaw =...
https://github.com/Vincent-Leon/zotero-harmony
e77d54f41c65a802fd1e06e35200917ceea2f9ee
github
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/DisplaySettings.ets
arkts
load
从持久化对象加载显示字段
load(saved: SettingsState): void { if (saved.fontSize) this.ctx.state.fontSize = saved.fontSize if (saved.domainIndex) this.ctx.state.domainIndex = saved.domainIndex if (saved.holdingHand !== undefined) this.ctx.state.holdingHand = saved.holdingHand if (saved.smartGrip !== undefined) this.ctx.state.sm...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left load AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saved AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SettingsState AST#identifier#Right AST#)#Left ) AS...
load(saved: SettingsState): void { if (saved.fontSize) this.ctx.state.fontSize = saved.fontSize if (saved.domainIndex) this.ctx.state.domainIndex = saved.domainIndex if (saved.holdingHand !== undefined) this.ctx.state.holdingHand = saved.holdingHand if (saved.smartGrip !== undefined) this.ctx.state.sm...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/DisplaySettings.ets#L45-L53
6e5924bd3d666227d043eaee8a6b3e805b65b68b
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
requestRefresh
==================== Screen Refresh ==================== Request full screen refresh Use after unlock/foreground to prevent static screen
static requestRefresh(inst: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } if (inst === 0) { return false; } try { return freerdpNative!.freerdpRequestRefresh(inst); } catch (e) { console.error(`${LibFreeRDP.TAG}: requestRefresh error:`, e); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left requestRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static requestRefresh(inst: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } if (inst === 0) { return false; } try { return freerdpNative!.freerdpRequestRefresh(inst); } catch (e) { console.error(`${LibFreeRDP.TAG}: requestRefresh error:`, e); ...
https://github.com/tangwengang-del/freerdp-harmonyos
3b4e5e056511968f1ccfcc97b66037af0a77e2bb
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
backupToCloud
==================== Backup / Restore ====================
async backupToCloud(): Promise<WebDavSyncResult> { const missing = this.requireConfigured(); if (missing !== null) return missing; this.status = WebDavSyncStatus.SYNCING; try { const client = this.createClient(); const preflight = await this.preflightRemoteRoot(client); if (prefligh...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left backupToCloud 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#generi...
async backupToCloud(): Promise<WebDavSyncResult> { const missing = this.requireConfigured(); if (missing !== null) return missing; this.status = WebDavSyncStatus.SYNCING; try { const client = this.createClient(); const preflight = await this.preflightRemoteRoot(client); if (prefligh...
https://github.com/CLMC2025/Vignette
3e488594cec1f9273085a03736c412560aae9189
github
zhangmeng1847/Preference
entry/src/main/ets/utils/MyPreferenceUtil.ets
arkts
getPreferenceValue
获取指定名称的preferences对象中存储的指定的key的数据
async getPreferenceValue(name: string, key: string, defaultValue: preferences.ValueType){ if (!this.preferenceMap.has(name)) { console.log('preferencesUtilTag', `Preferences[${name}]尚未初始化!`) return } try { let preference = this.preferenceMap.get(name) // 读数据 let value = await...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPreferenceValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right ...
async getPreferenceValue(name: string, key: string, defaultValue: preferences.ValueType){ if (!this.preferenceMap.has(name)) { console.log('preferencesUtilTag', `Preferences[${name}]尚未初始化!`) return } try { let preference = this.preferenceMap.get(name) // 读数据 let value = await...
https://github.com/zhangmeng1847/Preference
18c19241116e14e14735124e7cb1cc055e71074e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets
arkts
buildContextVars
构建上下文变量代码
private buildContextVars(context: JsContext): string { const vars: string[] = []; if (context.result !== undefined) { vars.push(`var result = ${JSON.stringify(context.result)};`); } else { vars.push(`var result = '';`); } if (context.baseUrl !== undefined) { vars.push(`...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildContextVars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private buildContextVars(context: JsContext): string { const vars: string[] = []; if (context.result !== undefined) { vars.push(`var result = ${JSON.stringify(context.result)};`); } else { vars.push(`var result = '';`); } if (context.baseUrl !== undefined) { vars.push(`...
https://github.com/DaLongZhuaZi/manxia
3aae947e8e3e1fdc72632da3d9531b62cbbc20c2
github
Yebingiscn/SweetVideo
entry/src/main/ets/component/VideoItemComponent/ImportProgressBuilder.ets
arkts
getStageText
获取阶段文本
function getStageText(stage: 'extracting' | 'cover' | 'saving'): string { switch (stage) { case 'extracting': return '正在提取: ' case 'cover': return '正在生成封面: ' case 'saving': return '正在保存: ' default: return '正在处理: ' } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getStageText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stage AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function getStageText(stage: 'extracting' | 'cover' | 'saving'): string { switch (stage) { case 'extracting': return '正在提取: ' case 'cover': return '正在生成封面: ' case 'saving': return '正在保存: ' default: return '正在处理: ' } }
https://github.com/Yebingiscn/SweetVideo
ac259eac89cd2324fdc3a504df6d7c0524180d3c
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/FavoritesVM.ets
arkts
init
启动时把本地 ID + 缓存的 Book 列表刷到 AppStorage,确保重启后不为空。
static async init(): Promise<void> { try { const ids: number[] = await FavoritesStore.list(); AppStorage.setOrCreate<number[]>(AppStorageKeys.FAVORITE_IDS, ids); // 从本地缓存恢复 Book 列表(即使服务端不可达也能显示) const cachedJson: BookJson[] = await PreferencesStore.getObject<BookJson[]>('settings', BOOKS_C...
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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS...
static async init(): Promise<void> { try { const ids: number[] = await FavoritesStore.list(); AppStorage.setOrCreate<number[]>(AppStorageKeys.FAVORITE_IDS, ids); // 从本地缓存恢复 Book 列表(即使服务端不可达也能显示) const cachedJson: BookJson[] = await PreferencesStore.getObject<BookJson[]>('settings', BOOKS_C...
https://github.com/LZZLHY/hlib
bc5aee6ec1a553faec1242aeaaf67d1f9098a85d
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/utils/TiktokCollection.ets
arkts
delCollection
删除收藏 @param item 视频
static async delCollection(item: mediaType) { const store = TiktokCollection.getStore() const list = TiktokCollection.getCollectionData() if (TiktokCollection.hasCollection(item)) { list.splice(list.findIndex(obj => obj === item), 1) store.putSync(Constants.GLOBAL_VIDEO_COLLECTION, JSON.string...
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 delCollection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST...
static async delCollection(item: mediaType) { const store = TiktokCollection.getStore() const list = TiktokCollection.getCollectionData() if (TiktokCollection.hasCollection(item)) { list.splice(list.findIndex(obj => obj === item), 1) store.putSync(Constants.GLOBAL_VIDEO_COLLECTION, JSON.string...
https://github.com/SMAT-Lab/PhantomRendering
a6f6645356a1ec54a7cc5bf41c3ca07a9a27db2d
github
openharmony/app_samples
ETSUI/Game2048/entry/src/main/ets/MainAbility/pages/Game2048.ets
arkts
onGameOver
gameStatus listener
onGameOver() { if (this.gameStatus === GameStatus.OVER) { this.curScore = this.gameRule.score this.dialogController.open() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onGameOver 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...
onGameOver() { if (this.gameStatus === GameStatus.OVER) { this.curScore = this.gameRule.score this.dialogController.open() } }
https://gitee.com/openharmony/app_samples.git
24edb5122cb0a4879cb7a1c18a7b92ef14657782
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/PreferencesUtil.ets
arkts
getString
获取字符串值 @param key 键 @param defaultValue 默认值
static async getString(key: string, defaultValue: string = ''): Promise<string> { try { const prefs = await PreferencesUtil.getPreferences(); const value = await prefs.get(key, defaultValue); return value as string; } catch (error) { console.error(`获取字符串失败: ${key}`, error); retur...
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 getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri...
static async getString(key: string, defaultValue: string = ''): Promise<string> { try { const prefs = await PreferencesUtil.getPreferences(); const value = await prefs.get(key, defaultValue); return value as string; } catch (error) { console.error(`获取字符串失败: ${key}`, error); retur...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
df2cef8631c02ad0ab881f9ec155a430196e8cca
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
tryGetString
Attempts to get a string value from an object by key. Returns the fallback value if the key is not found or if the value is not a string. @param {string} key - The key to look up @param {string} [fallback=""] - The fallback value to return if the key is not found @returns {string} The string value if found, fallback va...
tryGetString(key: string, fallback: string = ""): string { return this.tryGetElement(key)?.tryAsString() ?? fallback }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left tryGetString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST...
tryGetString(key: string, fallback: string = ""): string { return this.tryGetElement(key)?.tryAsString() ?? fallback }
https://gitcode.com/iop123123/arkts-static-skills
95a5e44f94212c9a22969e8aec1a9415fb931c83
gitcode
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
sortAlarmListById
根据id排序闹钟列表 sortAlarmListById 根据id排序闹钟列表 @return 当前条件对应的闹钟
async sortAlarmListById(): Promise<AlarmInfo [] | undefined> { const alarmList = await this.getAllAlarmsToShow(); LogUtil.info(TAG, 'intentExecutor createAlarm alarmList is : ' + JSON.stringify(alarmList)) let idList = alarmList.map((alarmInfo) => { return alarmInfo.id }) let sortedIdList = ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left sortAlarmListById 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 sortAlarmListById(): Promise<AlarmInfo [] | undefined> { const alarmList = await this.getAllAlarmsToShow(); LogUtil.info(TAG, 'intentExecutor createAlarm alarmList is : ' + JSON.stringify(alarmList)) let idList = alarmList.map((alarmInfo) => { return alarmInfo.id }) let sortedIdList = ...
https://gitee.com/openharmony-sig/applications_clock.git
3156248a7df78c6f8c41ceb43234f844c24cafbd
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toFraction
Return an array representing the value of this Decimal as a simple fraction with an integer numerator and an integer denominator. The denominator will be a positive non-zero value less than or equal to `max_denominator`. @param { Value } maxDenominator {double | string | Decimal} @returns { Decimal[] } the Decimal[] ty...
public toFraction(maxDenominator: Value): Decimal[] { return this.fraction(maxDenominator); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toFraction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxDenominator AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Value AST#i...
public toFraction(maxDenominator: Value): Decimal[] { return this.fraction(maxDenominator); }
https://gitcode.com/iop123123/arkts-static-skills
ec1f0f01b2a556fbca4c4ac802f2aa590e0db15e
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
getInputModeDescription
获取当前输入模式的描述
getInputModeDescription(): string { if (this.useGameControllerKit && this.useUsbDriverMode) { return 'Game Controller Kit + USB 驱动 (混合模式)'; } else if (this.useGameControllerKit) { return 'Game Controller Kit (系统统一输入)'; } else { return 'USB 驱动 (直接设备控制)'; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInputModeDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS...
getInputModeDescription(): string { if (this.useGameControllerKit && this.useUsbDriverMode) { return 'Game Controller Kit + USB 驱动 (混合模式)'; } else if (this.useGameControllerKit) { return 'Game Controller Kit (系统统一输入)'; } else { return 'USB 驱动 (直接设备控制)'; } }
https://github.com/AlkaidLab/moonlight-harmony
54e3c7dca89f915436027705687972be09344905
github
dingzhilin1990/zhilinclaw
src/plugins/PluginManager.ets
arkts
register
注册插件 @param plugin 插件实例
public async register(plugin: Plugin): Promise<void> { const name = plugin.metadata.name; if (this.plugins.has(name)) { throw new Error(`插件已存在:${name}`); } // 创建插件包装器 const wrapper: PluginWrapper = { plugin, enabled: false, loadTime: Date.now() }; this.plugin...
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 register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left plugin AST#identifier#Right AST#:#Left : AST#:#...
public async register(plugin: Plugin): Promise<void> { const name = plugin.metadata.name; if (this.plugins.has(name)) { throw new Error(`插件已存在:${name}`); } // 创建插件包装器 const wrapper: PluginWrapper = { plugin, enabled: false, loadTime: Date.now() }; this.plugin...
https://github.com/dingzhilin1990/zhilinclaw
3f778374dbbad4130289bc31c736d1f4956ec4aa
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
performOCR
执行OCR识别(模拟实现)
private static async performOCR( _imagePath: string, _provider: string ): Promise<OCRPerformResult> { try { // TODO: 实际项目中需要集成真实的OCR API // 这里提供模拟实现 // 模拟OCR识别延迟 await new Promise<void>((resolve) => setTimeout(resolve, 500)); // 模拟识别结果 const mockResult = ` 华润万家超市 地址...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left performOCR AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _imagePath AST#iden...
private static async performOCR( _imagePath: string, _provider: string ): Promise<OCRPerformResult> { try { // TODO: 实际项目中需要集成真实的OCR API // 这里提供模拟实现 // 模拟OCR识别延迟 await new Promise<void>((resolve) => setTimeout(resolve, 500)); // 模拟识别结果 const mockResult = ` 华润万家超市 地址...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
eef75c998554cf142d5d429e34c3559ff8b585fb
github