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
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WidgetDataSync.ets
arkts
updateRecentReads
更新最近阅读列表
public async updateRecentReads(recentReads: RecentReadItem[]): Promise<void> { if (!this.context) return; try { const pref = await preferences.getPreferences(this.context, WIDGET_DATA_STORE); const existingStr = (await pref.get('widgetData', '')) as string; let data: WidgetData = { ...
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 updateRecentReads AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recentReads AST#identifier#Right AST#:...
public async updateRecentReads(recentReads: RecentReadItem[]): Promise<void> { if (!this.context) return; try { const pref = await preferences.getPreferences(this.context, WIDGET_DATA_STORE); const existingStr = (await pref.get('widgetData', '')) as string; let data: WidgetData = { ...
https://github.com/DaLongZhuaZi/manxia
ab0140307c1cb448e0994bc53dd9fbfd606133a4
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets
arkts
removeAGenUIContainer
Unmounts the AGenUIContainer for the given surface. Called by SurfaceListenerImpl when the native engine signals that a surface has been destroyed. Clears currentSurfaceId so the ForEach renders nothing. @param surfaceId - The identifier of the destroyed surface.
removeAGenUIContainer(surfaceId: string) { hilog.info(DOMAIN, TAG, 'Removing AGenUIContainer, surfaceId: %{public}s', surfaceId); if (this.currentSurfaceId === surfaceId) { this.currentSurfaceId = ''; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeAGenUIContainer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#...
removeAGenUIContainer(surfaceId: string) { hilog.info(DOMAIN, TAG, 'Removing AGenUIContainer, surfaceId: %{public}s', surfaceId); if (this.currentSurfaceId === surfaceId) { this.currentSurfaceId = ''; } }
https://github.com/AGenUI/AGenUI
2c129df5c58c7792d07659ca75334c9298831ded
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
saveImageToFile
保存图片到文件
private static async saveImageToFile(imageData: ArrayBuffer, basePath: string, originalName: string): Promise<string | null> { try { // 确定文件扩展名 const ext = EBookCoverExtractor.getImageExtension(originalName, imageData); const fileName = `cover_${Date.now()}.webp`; const fullPath = `${baseP...
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 saveImageToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
private static async saveImageToFile(imageData: ArrayBuffer, basePath: string, originalName: string): Promise<string | null> { try { // 确定文件扩展名 const ext = EBookCoverExtractor.getImageExtension(originalName, imageData); const fileName = `cover_${Date.now()}.webp`; const fullPath = `${baseP...
https://github.com/DaLongZhuaZi/manxia
8e7b2571db2a43c33ad9b5aeb0f23194a51698e9
github
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/common/src/main/ets/location/ThirdAppManager.ets
arkts
isAppInstall
第三方应用是否安装
isAppInstall(thirdApp: ThirdApp): boolean { try { return bundleManager.canOpenLink(thirdApp) } catch (e) { let code = (e as BusinessError)?.code let msg = (e as BusinessError)?.message ?? '' if (code !== undefined) { if (code === 17700056) { msg += ` Please include "$...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAppInstall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left thirdApp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ThirdApp AST#identifier#Right AST#)#Lef...
isAppInstall(thirdApp: ThirdApp): boolean { try { return bundleManager.canOpenLink(thirdApp) } catch (e) { let code = (e as BusinessError)?.code let msg = (e as BusinessError)?.message ?? '' if (code !== undefined) { if (code === 17700056) { msg += ` Please include "$...
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
7524db24b5ab73720fdaa1a1f05aabb9ea81524b
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
getContacts
============ 联系人 ============ 获取联系人列表
async getContacts(params?: { keyword?: string; department?: string; page?: number; pageSize?: number }): Promise<ApiResponse<{ contacts: Contact[]; total: number }>> { return this.client.get<{ contacts: Contact[]; total: number }>('/api/v1/im/contacts', params as Record<string, any>) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getContacts AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_annot...
async getContacts(params?: { keyword?: string; department?: string; page?: number; pageSize?: number }): Promise<ApiResponse<{ contacts: Contact[]; total: number }>> { return this.client.get<{ contacts: Contact[]; total: number }>('/api/v1/im/contacts', params as Record<string, any>) }
https://github.com/David8Idira/AI-OA
386dd0464288168c7bfe8ea7a5b826e3760405bc
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/DistributedKVService.ets
arkts
getConnectedDeviceIds
获取在线设备的 networkId 列表
public static getConnectedDeviceIds(): string[] { try { if (!DistributedKVService.deviceManager) { hilog.warn(DOMAIN, TAG, 'Device manager is not initialized'); return []; } const devices = DistributedKVService.deviceManager.getAvailableDeviceListSync(); const deviceIds: st...
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 getConnectedDeviceIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
public static getConnectedDeviceIds(): string[] { try { if (!DistributedKVService.deviceManager) { hilog.warn(DOMAIN, TAG, 'Device manager is not initialized'); return []; } const devices = DistributedKVService.deviceManager.getAvailableDeviceListSync(); const deviceIds: st...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L164-L183
ef636df2abc7c28dea77b08a72502bfa764eb692
github
Joker-x-dev/HarmonyKit
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
handleTabChanged
切换 Tab 时更新索引 @param {number} index - 选中的索引 @returns {void} 无返回值
handleTabChanged(index: number): void { this.updateCurrentPage(index); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleTabChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left...
handleTabChanged(index: number): void { this.updateCurrentPage(index); }
https://github.com/Joker-x-dev/HarmonyKit
ec75d50eca0e986c410071b681c3255b22d17bda
github
IoTAccessControl/ArkTSAnalysis
TestApps1/9.PaymentKit_CodelabDemo/entry/src/main/ets/pages/Index.ets
arkts
showSuccessDialog
显示支付成功对话框
showSuccessDialog() { this.dialogTitle = '支付结果'; this.dialogMessage = '支付成功'; this.showDialog = true; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showSuccessDialog 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#...
showSuccessDialog() { this.dialogTitle = '支付结果'; this.dialogMessage = '支付成功'; this.showDialog = true; }
https://github.com/IoTAccessControl/ArkTSAnalysis
1056754dc27e23ea2ca891839f98d9c2ca223b91
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/User.ets
arkts
fixHtml
简单修复 cooked HTML 里的相对资源路径(src/href="/...")
private static fixHtml(html: string): string { if (html.length === 0) return html; try { let out: string = html; out = out.replace(/src=(['"])(\/[^'"]+)\1/g, (_m: string, quote: string, path: string) => { return `src=${quote}${UrlUtils.resolveUrl(path)}${quote}`; }); out = out....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left fixHtml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:...
private static fixHtml(html: string): string { if (html.length === 0) return html; try { let out: string = html; out = out.replace(/src=(['"])(\/[^'"]+)\1/g, (_m: string, quote: string, path: string) => { return `src=${quote}${UrlUtils.resolveUrl(path)}${quote}`; }); out = out....
https://github.com/Amaz1ny/HarmonyDO-public
744137d28801672528d54e178eba01874746ca02
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/PieChartRenderer.ets
arkts
drawEntryLabel
Draws an entry label at the specified position. @param c @param label @param x @param y
protected drawEntryLabel(c: CanvasRenderingContext2D, label: string, x: number, y: number): void { // c.drawText(label, x, y, this.mEntryLabelsPaint); Utils.resetContext2DWithoutLine(c, this.mEntryLabelsPaint); c.beginPath(); c.fillText(label, x, y); c.closePath(); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawEntryLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
protected drawEntryLabel(c: CanvasRenderingContext2D, label: string, x: number, y: number): void { // c.drawText(label, x, y, this.mEntryLabelsPaint); Utils.resetContext2DWithoutLine(c, this.mEntryLabelsPaint); c.beginPath(); c.fillText(label, x, y); c.closePath(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
953e95007b40302b99947bbb02236410054a5144
gitee
pangpang20/antennaPodHM
entry/src/main/ets/service/PlayerService.ets
arkts
handlePlaybackCompleted
处理播放完成
private async handlePlaybackCompleted(): Promise<void> { try { console.info('[PlayerService] handlePlaybackCompleted start'); const settingsService = SettingsService.getInstance(); // 检查是否开启了自动删除已播放,并且当前单集是已下载的 const autoDeletePlayed = settingsService.getAutoDeletePlayed(); ...
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 handlePlaybackCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async handlePlaybackCompleted(): Promise<void> { try { console.info('[PlayerService] handlePlaybackCompleted start'); const settingsService = SettingsService.getInstance(); // 检查是否开启了自动删除已播放,并且当前单集是已下载的 const autoDeletePlayed = settingsService.getAutoDeletePlayed(); ...
https://github.com/pangpang20/antennaPodHM
a587486adece6874821822f8f8d91ff39cfde509
github
LongLiveY96/chatcube
entry/src/main/ets/utils/ThrottleUtil.ets
arkts
flush
立即刷新(强制执行所有待处理内容) 用于流式结束时,确保所有内容同步落盘,避免异步打字导致保存时数据不完整
flush(callback: (content: string) => void): void { if (this.timerId !== -1) { clearTimeout(this.timerId) this.timerId = -1 } // 立即合并剩余的所有字符 const remaining = this.pendingContent this.pendingContent = '' this.lastExecuteTime = Date.now() if (remaining !== '') { callback(...
AST#program#Left AST#ERROR#Left AST#identifier#Left flush AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifie...
flush(callback: (content: string) => void): void { if (this.timerId !== -1) { clearTimeout(this.timerId) this.timerId = -1 } // 立即合并剩余的所有字符 const remaining = this.pendingContent this.pendingContent = '' this.lastExecuteTime = Date.now() if (remaining !== '') { callback(...
https://github.com/LongLiveY96/chatcube
848c9ad4b5131ccc5b82cbc9b41a3ef48ae531f3
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
doTransform
Convert the input data. After the conversion, Transform.push can be called to send the input to the read stream. Transform.push should not be called Transform.write to call. @param { string } chunk - Input data to be converted. @param { string } encoding - If the chunk is a string, then this is the encoding type. If ch...
doTransform(chunk: string, encoding: string, callback: Function): void { throw ERR_DOTRANSFORM_NOT_IMPLEMENTED; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left doTransform AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunk AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS...
doTransform(chunk: string, encoding: string, callback: Function): void { throw ERR_DOTRANSFORM_NOT_IMPLEMENTED; }
https://gitcode.com/iop123123/arkts-static-skills
d880c249f3e881e603c64aa0be58475ba0a73b91
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setTransparentCircleColor
Sets the color the transparent-circle should have. @param color
public setTransparentCircleColor(color: number): void { if (!this.mRenderer) { return; } let p: Paint = ( /*(PieChartRenderer) */ this.mRenderer as PieChartRenderer).getPaintTransparentCircle(); let alpha: number | undefined = p.getGlobalAlpha(); p.setColor(color); if (alpha) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTransparentCircleColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public setTransparentCircleColor(color: number): void { if (!this.mRenderer) { return; } let p: Paint = ( /*(PieChartRenderer) */ this.mRenderer as PieChartRenderer).getPaintTransparentCircle(); let alpha: number | undefined = p.getGlobalAlpha(); p.setColor(color); if (alpha) { ...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2dbaaaf2312c5a6fcf4957ee80c6920b963aff1f
gitee
arkui-x/samples
CodeLab/Cases/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
arkts
transitionFromRight
右侧弹出动画 @param duration 动画时间 @returns
static transitionFromRight(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.END).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ dela...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left transitionFromRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignme...
static transitionFromRight(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.END).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ dela...
https://gitcode.com/arkui-x/samples
af62d49921526ea8527c24bfe183c65fee8f11e7
gitcode
erosTeam/NextE
shared/src/main/ets/settings/CookieJarSettings.ets
arkts
syncAuthState
Push the jar's login facts into the reactive AuthState (non-sensitive fields only).
static syncAuthState(): void { const store: EhCookieStore = EhCookieStore.getInstance() const auth: AuthState = connectAuth() const previousMemberId: string = auth.memberId const nextMemberId: string = store.get(EhConstants.COOKIE_MEMBER_ID) auth.isLogin = store.isLogin() auth.hasIgneous = sto...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left syncAuthState 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#expressi...
static syncAuthState(): void { const store: EhCookieStore = EhCookieStore.getInstance() const auth: AuthState = connectAuth() const previousMemberId: string = auth.memberId const nextMemberId: string = store.get(EhConstants.COOKIE_MEMBER_ID) auth.isLogin = store.isLogin() auth.hasIgneous = sto...
https://github.com/erosTeam/NextE
5ce4337e27fd0d2e2607451b8679cd2539e02130
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/MessageManager.ets
arkts
markConversationAsRead
Mark messages as read in a conversation.
static async markConversationAsRead(conversationId: string, currentUsername: string): Promise<boolean> { try { const allMessages = await MessageManager.getAllMessages(); let updated = false; for (const message of allMessages) { // Mark as read if: it's in this conversation AND sent TO 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 markConversationAsRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left conversationId AST#identifier#Right AST#ERROR#Le...
static async markConversationAsRead(conversationId: string, currentUsername: string): Promise<boolean> { try { const allMessages = await MessageManager.getAllMessages(); let updated = false; for (const message of allMessages) { // Mark as read if: it's in this conversation AND sent TO c...
https://github.com/Harrisonls2004/WaterFlow
8840a2608f2414f1c1bf7b67042fc5111b45195c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setGCThreadHold
设置绘制多少次后调用垃圾回收的阈值 @param gcThreshold
public setGCThreadHold(gcThreshold: number) { GCUtil.gcThreshold = gcThreshold; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setGCThreadHold AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gcThreshold AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
public setGCThreadHold(gcThreshold: number) { GCUtil.gcThreshold = gcThreshold; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f084a9cfcaf0bcd77143b5c264a4268e280c0f16
gitee
HarmonyOS_Samples/guide-snippets
Ability/InsightIntentConfigDevelopment/entry/src/main/ets/abilities/MusicPlayerAbility.ets
arkts
onCreate
UIAbility创建时触发(后台/前台模式均会进入)
onCreate(want: Want) { hilog.info(DOMAIN, 'testTag', `[MusicPlayerAbility] onCreate:${JSON.stringify(want)}`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#)#...
onCreate(want: Want) { hilog.info(DOMAIN, 'testTag', `[MusicPlayerAbility] onCreate:${JSON.stringify(want)}`); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
f0d491dd6760b451e21ddfe2b5177a894090ce5a
gitcode
openharmony/arkcompiler_taihe_ffi_gen
test/ani_overload/user/main.ets
arkts
testShort
测试 short (i16)
function testShort() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let res = instance.overloadFunc((42).toShort(), (42).toShort()); arktest.assertEQ(res, 42); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testShort AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declarati...
function testShort() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let res = instance.overloadFunc((42).toShort(), (42).toShort()); arktest.assertEQ(res, 42); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
99d14fa29b48c31910ebcbdcafc6b9bf36c52e19
gitcode
LiHuaJZOAQ/GuardSysAPP
entry/src/main/ets/pages/WifiManager.ets
arkts
scanWifi
扫描WiFi列表
static async scanWifi(): Promise<boolean> { try { await wifiManager.scan(); return true; } catch (err) { console.error('scanWifi failed: ' + JSON.stringify(err)); return false; } }
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 scanWifi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
static async scanWifi(): Promise<boolean> { try { await wifiManager.scan(); return true; } catch (err) { console.error('scanWifi failed: ' + JSON.stringify(err)); return false; } }
https://github.com/LiHuaJZOAQ/GuardSysAPP
dfe5776d1db186bbac2bba762502648afd620398
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
isImageUrl
检查是否为图片URL
static isImageUrl(url: string): boolean { const extension = WebViewImageUtils.getFileExtension(url); const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'svg']; return imageExtensions.includes(extension); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isImageUrl 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...
static isImageUrl(url: string): boolean { const extension = WebViewImageUtils.getFileExtension(url); const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'svg']; return imageExtensions.includes(extension); }
https://github.com/DaLongZhuaZi/manxia
ac40970bdaba9028022c149d93be276c51551e7b
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Message.ets
arkts
mergeFromBinary
从二进制数据合并 @param data 二进制数据 @returns this(支持链式调用)
mergeFromBinary(data: Uint8Array): Message { try { return this.fromBinary(data, true) // partial=true } catch (e) { throw new Error(`Merge from binary failed: ${e}`) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mergeFromBinary 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 Uint8Array AST#identifier#Right AST#)#Le...
mergeFromBinary(data: Uint8Array): Message { try { return this.fromBinary(data, true) // partial=true } catch (e) { throw new Error(`Merge from binary failed: ${e}`) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
28eaea0afcccaac5d333e13f95283e34152c76ff
gitcode
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
insertHealthEvent
════════════════════════════════════════════════════════════ 健康事件 CRUD(摔倒 / 久坐) ════════════════════════════════════════════════════════════ 插入健康事件,写入前自动滚动清理超出保留天数的旧记录,返回 rowId
public async insertHealthEvent(event: HealthEvent): Promise<number> { // 🔄 滚动清理:删除早于 retentionDays 天前的旧事件 const cutoff = event.eventTime - this.getRetentionDays() * 24 * 60 * 60 * 1000; const oldPred = new relationalStore.RdbPredicates("t_health_event"); oldPred.lessThan("event_time", cutoff); tr...
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 insertHealthEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left ...
public async insertHealthEvent(event: HealthEvent): Promise<number> { // 🔄 滚动清理:删除早于 retentionDays 天前的旧事件 const cutoff = event.eventTime - this.getRetentionDays() * 24 * 60 * 60 * 1000; const oldPred = new relationalStore.RdbPredicates("t_health_event"); oldPred.lessThan("event_time", cutoff); tr...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L462-L504
bf818452668c64d8794323de24ca4f04393b7baf
github
openharmony/vendor_unionman
unionpi_tiger/sample_api10/app/metartc_app/entry/src/main/ets/pages/Index.ets
arkts
onBackPress
页面返回:手机按钮上的返回
onBackPress(){ //打印出页面返回的提醒 console.log('This Page is onBackPress') }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
onBackPress(){ //打印出页面返回的提醒 console.log('This Page is onBackPress') }
https://gitee.com/openharmony/vendor_unionman.git
1406fca915208e1370b04cfbfe958ca8275dc840
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/StreamViewModel.ets
arkts
sendGamepadState
发送手柄完整状态(用于物理手柄输入)
sendGamepadState( controllerIndex: number, buttons: number, leftStickX: number, leftStickY: number, rightStickX: number, rightStickY: number, leftTrigger: number, rightTrigger: number, controllerType: number = CONTROLLER_TYPE_XBOX ): void { this.streamingSession?.sendGamepadS...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left sendGamepadState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerIndex AST#identifier#Right AST#ERROR#...
sendGamepadState( controllerIndex: number, buttons: number, leftStickX: number, leftStickY: number, rightStickX: number, rightStickY: number, leftTrigger: number, rightTrigger: number, controllerType: number = CONTROLLER_TYPE_XBOX ): void { this.streamingSession?.sendGamepadS...
https://github.com/AlkaidLab/moonlight-harmony
02e1eaa2a11f873cce2838cf8ff9c4f8c9e32dae
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/heima/mixed/MixedIndexPage.ets
arkts
sendMessage
发送消息到h5
sendMessage() { this.currentPorts[1].postMessageEvent(Date.now().toString()) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
sendMessage() { this.currentPorts[1].postMessageEvent(Date.now().toString()) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
b7dd9968f69534566926661c070b6fcc60a715b1
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/PersonalizedBudgetService.ets
arkts
getPersonalizedWeights
获取个性化算法权重 根据用户画像调整不同算法的权重
static getPersonalizedWeights(profile: UserProfile | null): PersonalizedWeights { // 默认权重(平衡型) let weights: PersonalizedWeights = { sma: 0.15, wma: 0.20, es: 0.25, hw: 0.25, lr: 0.15 }; if (!profile) { return weights; } // 根据消费性格调整 if (profile.spending...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPersonalizedWeights AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left profile AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary...
static getPersonalizedWeights(profile: UserProfile | null): PersonalizedWeights { // 默认权重(平衡型) let weights: PersonalizedWeights = { sma: 0.15, wma: 0.20, es: 0.25, hw: 0.25, lr: 0.15 }; if (!profile) { return weights; } // 根据消费性格调整 if (profile.spending...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
4bbd21765a073ac08e1c1dc08e9b07eba9f23c55
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int8Array from FixedArray<number> @param { FixedArray<number> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: FixedArray<number>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, Int8Array.doubleToInt(numbers[i])) } }
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 numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public constructor(numbers: FixedArray<number>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, Int8Array.doubleToInt(numbers[i])) } }
https://gitcode.com/iop123123/arkts-static-skills
1c9674174c346a364c64feafa35e291642e00651
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
toLocaleTimeString
Gets a string with a language-sensitive representation of the time portion of the date. @returns { string } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toLocaleTimeString(): string { return this.toLocaleTimeString(undefined) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleTimeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string ...
public toLocaleTimeString(): string { return this.toLocaleTimeString(undefined) }
https://gitcode.com/iop123123/arkts-static-skills
1f59082a9debe11137b26d09e7084af5914a077c
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
set
Sets the byte value wrapped in this ByteBox. @param { byte } value - The new byte value to set @returns { byte } The newly set byte value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public set(value: byte): byte { return (this.value = value); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public set(value: byte): byte { return (this.value = value); }
https://gitcode.com/iop123123/arkts-static-skills
a3932013caf3d5d3321613b95b5c47386680deb3
gitcode
openharmony/applications_mms
entry/src/main/ets/service/NotificationService.ets
arkts
buildWantAgentInfo
Constructing distributed startup parameters @param actionData
buildWantAgentInfo(actionData): any { let parameters = { pageFlag: 'conversation', contactObjects: actionData.contactObjects }; let wantAgentInfo = { wants: [ { deviceId: '', bundleName: common.string...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildWantAgentInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#any#Lef...
buildWantAgentInfo(actionData): any { let parameters = { pageFlag: 'conversation', contactObjects: actionData.contactObjects }; let wantAgentInfo = { wants: [ { deviceId: '', bundleName: common.string...
https://gitee.com/openharmony/applications_mms.git
9b025d6707a884932c5e4a4eb5be03da1d626882
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
getInBackground
Check if in background mode
getInBackground(): boolean { return this.isInBackground; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#sta...
getInBackground(): boolean { return this.isInBackground; }
https://github.com/tangwengang-del/freerdp-harmonyos
95deae9b510f4fa313965f3abd46810b108823eb
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/StringBuilder.ets
arkts
append
Appends a byte as string to the builder's internal buffer @param i value to be appended @returns builder with updated internal buffer
public append(i: byte): StringBuilder { this.append(StringBuilder.toString(i)); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left append AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left byte AST#ide...
public append(i: byte): StringBuilder { this.append(StringBuilder.toString(i)); return this; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
33edd031ba0fe17edc1b77776b3ce68372315be1
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
$_get
Returns an instance of BigInt at passed index. @param { int } index - index to look at @returns { BigInt } - a primitive at index @syscap SystemCapability.Utils.Lang @FaAndStageModel
public $_get(index: int): BigInt { return new BigInt(this.getLong(index)) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public $_get(index: int): BigInt { return new BigInt(this.getLong(index)) }
https://gitcode.com/iop123123/arkts-static-skills
8cd65941f0c76d8eeff20f53f061b2d12d735278
gitcode
CLMC2025/Vignette
entry/src/main/ets/context/OfflineContext.ets
arkts
getDatabaseSize
获取数据库大小
getDatabaseSize(): number { return this.wordDatabase.size; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDatabaseSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statem...
getDatabaseSize(): number { return this.wordDatabase.size; }
https://github.com/CLMC2025/Vignette
eaff7064eb29fe3170e16b763451ed5cc213e7c2
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Description.ets
arkts
setPosition
Sets a custom position for the description text in pixels on the screen. @param x - xcoordinate @param y - ycoordinate
public setPosition(x: number, y: number): void { if (this.mPosition == null) { this.mPosition = MPPointF.getInstance(x, y); } else { this.mPosition.x = x; this.mPosition.y = y; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPosition 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 ...
public setPosition(x: number, y: number): void { if (this.mPosition == null) { this.mPosition = MPPointF.getInstance(x, y); } else { this.mPosition.x = x; this.mPosition.y = y; } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
ea42f39626cc316ec431a74f9840f2643f2c7d52
gitee
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/HighLightInfoOfComponent.ets
arkts
getOptions
获取高亮区域的额外配置
getOptions(): HighLightOptions | null { return this.options; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOptions 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 AST#identifier#Left HighLightOptions AST#ide...
getOptions(): HighLightOptions | null { return this.options; }
https://github.com/wuba/omni-ui
3cb93045fba7a4faaf36274f265a040621219161
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/components/SwipeMenuItemLayout.ets
arkts
aboutToAppear
aboutToAppear 是执行初始化逻辑的正确位置
aboutToAppear() { logger.debug(`SwipeMenuItemLayout-${this.itemPosition} initializing with close animation: ${this.closeAnimationConfig.interpolator}, ${this.closeAnimationConfig.duration}ms`); // 根据传入的 menu 对象,动态计算菜单总宽度 this.updateMenuWidth(); // 初始化动画回调映射 this.initAnimationCallbacks(); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { logger.debug(`SwipeMenuItemLayout-${this.itemPosition} initializing with close animation: ${this.closeAnimationConfig.interpolator}, ${this.closeAnimationConfig.duration}ms`); // 根据传入的 menu 对象,动态计算菜单总宽度 this.updateMenuWidth(); // 初始化动画回调映射 this.initAnimationCallbacks(); ...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
b9a410fb3fe56dbca78c396bf7446fb3654b4983
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsEngine.ets
arkts
prefetchUrls
预先通过ArkTS发起网络请求,并将结果注入到WebView缓存中
private async prefetchUrls(urls: string[]): Promise<void> { if (urls.length === 0 || !this.webviewController) { return; } logger.debug(TAG, `[Prefetch] 预先获取 ${urls.length} 个URL`); // 并行发起所有请求 const results: PrefetchResult[] = []; for (const url of urls) { const result = a...
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 prefetchUrls AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left urls AST#identifier#Right AST#:#Left : A...
private async prefetchUrls(urls: string[]): Promise<void> { if (urls.length === 0 || !this.webviewController) { return; } logger.debug(TAG, `[Prefetch] 预先获取 ${urls.length} 个URL`); // 并行发起所有请求 const results: PrefetchResult[] = []; for (const url of urls) { const result = a...
https://github.com/DaLongZhuaZi/manxia
7edb42a8aa8c5449a9f2b5ca8393cad54f4effeb
github
harmonyos/codelabs
HarmonyOS_NEXT/MusicHome/products/phone/src/main/ets/viewmodel/IndexViewModel.ets
arkts
getIndexItemList
Data information on the home page. @returns IndexItem array.
getIndexItemList(): IndexItem[] { let IndexItemList: IndexItem[] = []; IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), $r('app.string.button_music'), $r('app.media.ic_music'), '@bundle:com.huawei.music.musichome/musicList/ets/pages/Index')); I...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIndexItemList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left IndexItem AST#i...
getIndexItemList(): IndexItem[] { let IndexItemList: IndexItem[] = []; IndexItemList.push(new IndexItem($r('app.string.music_title'), $r('app.string.music_description'), $r('app.string.button_music'), $r('app.media.ic_music'), '@bundle:com.huawei.music.musichome/musicList/ets/pages/Index')); I...
https://gitee.com/harmonyos/codelabs.git
4878586ae07eb85d0507a1ec9b620fd030e3e3c9
gitee
arkui-x/samples
CodeLab/Cases/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
batchInsert
批量插入数据 @param tableName 表名 @param data 数据 @returns 插入条数
async batchInsert(tableName: string, data: ValuesBucket[]): Promise<void> { if (store === undefined) { return; } await store.batchInsert(tableName, data); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left batchInsert AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AS...
async batchInsert(tableName: string, data: ValuesBucket[]): Promise<void> { if (store === undefined) { return; } await store.batchInsert(tableName, data); }
https://gitcode.com/arkui-x/samples
3f554bc997c30eb353ac786e7c77a2bb3941ca10
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelContentProcessor.ets
arkts
processContent
处理章节内容
processContent( content: string, chapterTitle: string, bookName: string, customConfig: ContentProcessConfig | null = null ): ContentProcessResult { const defaultCfg = createDefaultConfig(); const cfg = mergeConfig(defaultCfg, customConfig); let mContent = content; let titleRemoved = ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left processContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,...
processContent( content: string, chapterTitle: string, bookName: string, customConfig: ContentProcessConfig | null = null ): ContentProcessResult { const defaultCfg = createDefaultConfig(); const cfg = mergeConfig(defaultCfg, customConfig); let mContent = content; let titleRemoved = ...
https://github.com/DaLongZhuaZi/manxia
85100d0d5218c82b6dd25b9b2c0d1c4f313ee454
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
toJSON
Converts this Buffer instance into a JsonElement. @returns {JsonElement} A new JsonElement containing the Buffer
public toJSON(): jsonx.JsonElement { const arr = new Array<jsonx.JsonElement>; for (let i: int = 0; i < this.length; ++i) { const intElement = new jsonx.JsonElement(); intElement.setInteger(this.at(i).toInt()); arr.push(intElement); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toJSON 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#member_expression#Left AST#iden...
public toJSON(): jsonx.JsonElement { const arr = new Array<jsonx.JsonElement>; for (let i: int = 0; i < this.length; ++i) { const intElement = new jsonx.JsonElement(); intElement.setInteger(this.at(i).toInt()); arr.push(intElement); ...
https://gitcode.com/iop123123/arkts-static-skills
1ae5affff0f2ad3bde74f0ea5933d1c938a3638c
gitcode
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/presentation/progress/components/CircleProgress.ets
arkts
aboutToDisappear
Cleans up resources when the component is about to be destroyed
aboutToDisappear() { // Mark the component as destroyed immediately this.isComponentDestroyed = true; this.clearTimer(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { // Mark the component as destroyed immediately this.isComponentDestroyed = true; this.clearTimer(); }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
9f0807cbf4ebb311a9e4ac5b3a1b2d76321b77af
gitcode
openharmony-sig/applications_calculator
common/src/main/ets/util/RdbHelper.ets
arkts
getRdbStore
getRdbStore
async getRdbStore(): Promise<void> { if (this.rdbStore === null) { try { let rdbStoreV9: relationalStore.RdbStore = await relationalStore.getRdbStore(this.context, DB.STORE_CONFIGV9.config); rdbStoreV9.executeSql(DB.table.expression); this.rdbStore = rdbStoreV9; Log...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST...
async getRdbStore(): Promise<void> { if (this.rdbStore === null) { try { let rdbStoreV9: relationalStore.RdbStore = await relationalStore.getRdbStore(this.context, DB.STORE_CONFIGV9.config); rdbStoreV9.executeSql(DB.table.expression); this.rdbStore = rdbStoreV9; Log...
https://gitee.com/openharmony-sig/applications_calculator.git
df6cfb354400d30d4b59c8c0a20cbf0f15eb30a0
gitee
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
getInstance
单例--升级管理类对象实例 @return 升级管理类对象实例
static getInstance(): OtaUpdateManager { return globalThis.otaUpdateManager ?? new OtaUpdateManager(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 OtaUpdateM...
static getInstance(): OtaUpdateManager { return globalThis.otaUpdateManager ?? new OtaUpdateManager(); }
https://gitee.com/openharmony/update_update_app.git
c5b6eb115e613293ba300454fb8153c0451b6d44
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
keys
Returns elements from the LightWeightMap as an keys Iterator @returns ValueIterator with hash map keys
keys(): IterableIterator<K> { return new LightWeightMapIterator<K, V, K>(this, (index: int) => this.buckets.entryKeys[index] as K); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left keys 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 AST#identifier#Left IterableIterator AST#identifie...
keys(): IterableIterator<K> { return new LightWeightMapIterator<K, V, K>(this, (index: int) => this.buckets.entryKeys[index] as K); }
https://gitcode.com/iop123123/arkts-static-skills
9eb1bcfc05a2567bd52960cfb961553a93fbd574
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/UnifiedOperationInterface.ets
arkts
executeExtensionOperation
执行扩展操作
private async executeExtensionOperation(action: string, data?: OperationBusinessData): Promise<ExecuteOperationResult> { if (action === 'register') { if (data && Object.keys(data).includes('name') && Object.keys(data).includes('path')) { const extensionData = data as ExtensionOperationData; ...
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 executeExtensionOperation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right...
private async executeExtensionOperation(action: string, data?: OperationBusinessData): Promise<ExecuteOperationResult> { if (action === 'register') { if (data && Object.keys(data).includes('name') && Object.keys(data).includes('path')) { const extensionData = data as ExtensionOperationData; ...
https://github.com/DaLongZhuaZi/manxia
4bdac99545626fc28060d1e588173f8153b20807
github
erosTeam/NextE
feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets
arkts
loadPreviousToplist
After a page jump, FE treats pull-to-refresh as "load previous page" instead of reloading page 1.
private async loadPreviousToplist(afterPrepend?: (prependedCount: number) => void): Promise<number> { DiagnosticLogger.info('home-list-anchor', 'toplist_prev_enter', this.debugState()) const requestedPage: number = this.toplistPrevPage if (requestedPage < 0 || requestedPage > this.maxPage) { Diagnos...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left loadPreviousToplist AST#identifier#Right AST#(#Left ( AST#(#Right AST#member_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#id...
private async loadPreviousToplist(afterPrepend?: (prependedCount: number) => void): Promise<number> { DiagnosticLogger.info('home-list-anchor', 'toplist_prev_enter', this.debugState()) const requestedPage: number = this.toplistPrevPage if (requestedPage < 0 || requestedPage > this.maxPage) { Diagnos...
https://github.com/erosTeam/NextE
2b213406e98571bb638d8d7653463a2f5d81facd
github
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subBenchmarkTest/sppClientBandWidthBenchmarkTest.ets
arkts
aboutToAppear
08:FB:EA:1B:3C:63
aboutToAppear() { AppStorage.setOrCreate('inputDeviceId' , this.deviceId); AppStorage.setOrCreate('inputUuid' , this.uuid); AppStorage.setOrCreate("writeClientDataBW" , this.writeClientDataBW); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { AppStorage.setOrCreate('inputDeviceId' , this.deviceId); AppStorage.setOrCreate('inputUuid' , this.uuid); AppStorage.setOrCreate("writeClientDataBW" , this.writeClientDataBW); }
https://gitee.com/openharmony/communication_bluetooth_service.git
f3eee8b242eb6aac4637a67a0ec76787171a4217
gitee
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/component/Medicine/MedicineDetail.ets
arkts
addToCart
点击加入购物车按钮的处理逻辑
addToCart() { if (this.isLoading) { promptAction.showToast({ message: '正在加载处方信息,请稍候...' }); return; } if (this.medicine.id === 0) return; // 处方药购买限制逻辑 if (this.medicine.isPrescription) { // 1. 查找所有可用处方 this.validPrescriptions = this.findValidPrescriptions(this.medicine.n...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addToCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
addToCart() { if (this.isLoading) { promptAction.showToast({ message: '正在加载处方信息,请稍候...' }); return; } if (this.medicine.id === 0) return; // 处方药购买限制逻辑 if (this.medicine.isPrescription) { // 1. 查找所有可用处方 this.validPrescriptions = this.findValidPrescriptions(this.medicine.n...
https://github.com/luojiang001/Pulse
d076cfdef055c7f5b8917ab43200a2901dfd4d03
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setHeight
弹窗高度,仅限于wrap = true,默认50%
setHeight(height: Length): Builder { this.popupConfig.height = height return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left height AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Length AST#identifier#Right AST#)#Left ) AST...
setHeight(height: Length): Builder { this.popupConfig.height = height return this }
https://github.com/wuba/omni-ui
a45cfbcd394c6d278ae37491ba678cd8c4f9a749
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
unmuteConversation
取消静音会话 @param conversationId 会话ID
async unmuteConversation(conversationId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/im/conversations/${conversationId}/mute`) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unmuteConversation AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left...
async unmuteConversation(conversationId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/im/conversations/${conversationId}/mute`) }
https://github.com/David8Idira/AI-OA
696bb17ac242af910d9a85f1f4eaa12a690c1d50
github
XXYoLoong/SchoolSmart
entry/src/main/ets/pages/Index.ets
arkts
build
build 方法用于构建当前组件的UI布局
build() { // 最外层使用 Column 组件,垂直排列所有子组件 Column() { // 嵌套的 Column 用于包裹整个标签页区域 Column() { // Tabs 组件用于创建底部标签栏,barPosition 设置为 End 表示标签栏显示在末尾 Tabs({ barPosition: BarPosition.End }) { // 第一个 TabContent,用于显示主页面内容 TabContent() { // 调用 MainCompoments 组件,显示主...
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 组件,垂直排列所有子组件 Column() { // 嵌套的 Column 用于包裹整个标签页区域 Column() { // Tabs 组件用于创建底部标签栏,barPosition 设置为 End 表示标签栏显示在末尾 Tabs({ barPosition: BarPosition.End }) { // 第一个 TabContent,用于显示主页面内容 TabContent() { // 调用 MainCompoments 组件,显示主...
https://github.com/XXYoLoong/SchoolSmart
1cdba0428d40514de33c35f2365415021082b1b2
github
openharmony-tpc/mp4parser
library/src/main/ets/mp4parser/MP4Parser.ets
arkts
openNativeLog
open native log
static openNativeLog() { mp4parser_napi.openNativeLog(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left openNativeLog 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 {...
static openNativeLog() { mp4parser_napi.openNativeLog(); }
https://gitee.com/openharmony-tpc/mp4parser.git
c069da5506e6c1dfaeccd35973c6d58b33de4f2d
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/auth/AuthService.ets
arkts
getIsLoggedIn
获取登录状态
getIsLoggedIn(): boolean { return this.isLoggedIn; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIsLoggedIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state...
getIsLoggedIn(): boolean { return this.isLoggedIn; }
https://github.com/Amaz1ny/HarmonyDO-public
73a9306881f8760d34a745945da59885e0a2e2d9
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
spliceNamespace
Handles the namespace processing for the current element in the stack. @param {StringBuilder} stringBuilder - The `StringBuilder` instance used to append namespace declarations to the XML output.
private spliceNamespace(stringBuilder: StringBuilder): void { if (this.depth === 0) { return; } this.elementStack[this.depth].prefix = this.elementStack[this.depth - OffsetDepth].prefix; this.elementStack[this.depth].namespace_ = this.elementStack...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left spliceNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stringBuilder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private spliceNamespace(stringBuilder: StringBuilder): void { if (this.depth === 0) { return; } this.elementStack[this.depth].prefix = this.elementStack[this.depth - OffsetDepth].prefix; this.elementStack[this.depth].namespace_ = this.elementStack...
https://gitcode.com/iop123123/arkts-static-skills
b5b886f17712762c5b27babb888e4758bc7d6320
gitcode
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
rawQuerySafe
执行原生 SQL 查询(只读,严格参数化) 要求使用 ? 占位符且参数数量严格匹配 @param sql SQL 查询语句 @param args 查询参数 @returns Promise<Array<EntityData>>
async rawQuerySafe(sql: string, args: Array<ValueType> = []): Promise<Array<EntityData>> { const normalizedSql = validateRawQuerySql(sql) const placeholderCount = countSqlPlaceholders(normalizedSql) if (placeholderCount <= 0) { throw new ExecutionError('RAW_QUERY', 'RAW_QUERY_SAFE 仅允许参数化 SQL(必须使用 ? ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left rawQuerySafe AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sql AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async rawQuerySafe(sql: string, args: Array<ValueType> = []): Promise<Array<EntityData>> { const normalizedSql = validateRawQuerySql(sql) const placeholderCount = countSqlPlaceholders(normalizedSql) if (placeholderCount <= 0) { throw new ExecutionError('RAW_QUERY', 'RAW_QUERY_SAFE 仅允许参数化 SQL(必须使用 ? ...
https://github.com/offlinecat-dev/OCNetORM
e4b4ff426d27a11a16e5c2b6a48fb237ec4febba
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
getAppAssetCached
获取应用图标并缓存到本地文件 @param appId 应用 ID @returns 本地文件路径,如果失败返回 null
async getAppAssetCached(appId: number): Promise<string | null> { if (!this.context) { console.warn('NvHttp: 无法缓存图标,context 未设置'); return null; } // 缓存目录 const cacheDir = this.context.cacheDir + '/app_icons'; // 将地址中的特殊字符替换为下划线,避免文件名无效(如 IPv6 地址中的冒号) const safeAddress = this.addres...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAppAssetCached AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left appId AST#identifier#Right ...
async getAppAssetCached(appId: number): Promise<string | null> { if (!this.context) { console.warn('NvHttp: 无法缓存图标,context 未设置'); return null; } // 缓存目录 const cacheDir = this.context.cacheDir + '/app_icons'; // 将地址中的特殊字符替换为下划线,避免文件名无效(如 IPv6 地址中的冒号) const safeAddress = this.addres...
https://github.com/AlkaidLab/moonlight-harmony
6e0c58caa53b5058e1f179da06c93f693f7d4265
github
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/executor.ets
arkts
handleAlert
========== 主处理函数 ==========
async function handleAlert(alert: AnyAlert): Promise<void> { switch (alert.type) { case 'expedition_return': await handleExpeditionReturn(alert); break; case 'yasen_prompt': await handleYasenPrompt(alert); break; case 'taiha_warning': await handleTaihaWarning(alert); br...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left handleAlert AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alert AST#identifier#Right AST#type_a...
async function handleAlert(alert: AnyAlert): Promise<void> { switch (alert.type) { case 'expedition_return': await handleExpeditionReturn(alert); break; case 'yasen_prompt': await handleYasenPrompt(alert); break; case 'taiha_warning': await handleTaihaWarning(alert); br...
https://github.com/CsCesium/KantaiHomo
44065c5ab6024f9caa1aae2accdf49a041387011
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/ExpressionsModel.ets
arkts
insertRecord
insert record @param valueBucket history record entry
insertRecord(valueBucket: relationalStore.ValuesBucket): void { LogUtil.info(TAG, 'insertRecord'); let promise: Promise<boolean> = this.rdbHelper.isTableFull(); promise.then(res => { if (res) { this.rdbHelper.delOldestRecord(); } this.rdbHelper.insert(valueBucket); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left valueBucket AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left relationa...
insertRecord(valueBucket: relationalStore.ValuesBucket): void { LogUtil.info(TAG, 'insertRecord'); let promise: Promise<boolean> = this.rdbHelper.isTableFull(); promise.then(res => { if (res) { this.rdbHelper.delOldestRecord(); } this.rdbHelper.insert(valueBucket); }); }
https://gitee.com/openharmony-sig/applications_calculator.git
b3ccb6c2cde845c384ecd2132f49583b163559ca
gitee
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
videoToImages
视频批量截图 @param input 输入视频路径 @param outputPattern 输出图片路径模式,如 "/path/frame_%04d.jpg" @param fps 每秒截取帧数,默认 1(每秒1张)
public static videoToImages(input: string, outputPattern: string, fps: number = 1): string[] { return [ 'ffmpeg', '-i', input, '-vf', `fps=${fps}`, '-q:v', '2', '-y', outputPattern ]; }
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 videoToImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : A...
public static videoToImages(input: string, outputPattern: string, fps: number = 1): string[] { return [ 'ffmpeg', '-i', input, '-vf', `fps=${fps}`, '-q:v', '2', '-y', outputPattern ]; }
https://github.com/jjjjjjava/ffmpeg_tools
d5f31f1c35bb79925a685cf4d07a16c4582061ef
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/count-down/TnCountDown.ets
arkts
build
========== 构建 ==========
build() { Row() { // 天 —— 每个 Text 直接调用方法读取 this.remain,不使用 const 中间变量 if (this.shouldShowDay()) { Text(this.getDaysText()) .fontSize(this.getTextFontSize()) .fontColor(this.getTextColor()) .fontWeight(FontWeight.Medium) .lineHeight(this.baseStyle.lineHei...
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() { Row() { // 天 —— 每个 Text 直接调用方法读取 this.remain,不使用 const 中间变量 if (this.shouldShowDay()) { Text(this.getDaysText()) .fontSize(this.getTextFontSize()) .fontColor(this.getTextColor()) .fontWeight(FontWeight.Medium) .lineHeight(this.baseStyle.lineHei...
https://github.com/codelably/tuniao-ui
ceeca0e0db48553b549ddd8573201810ef8cf6dd
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
expand
Creates the smallest range that includes the current range and a given value. @param { ScopeType } value - A ScopeType value @returns { ScopeHelper } Returns the smallest range that includes the current range and a given value.
expand(value: T): ScopeHelper<T> { let lowerLimit = this._lowerLimit.compareTo(value) ? value : this._lowerLimit let upperLimit = this._upperLimit.compareTo(value) ? this._upperLimit : value return new ScopeHelper<T>(lowerLimit, upperLimit) }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left expand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Righ...
expand(value: T): ScopeHelper<T> { let lowerLimit = this._lowerLimit.compareTo(value) ? value : this._lowerLimit let upperLimit = this._upperLimit.compareTo(value) ? this._upperLimit : value return new ScopeHelper<T>(lowerLimit, upperLimit) }
https://gitcode.com/iop123123/arkts-static-skills
0f135e173302f5f69d09f4a650ea52f43f3e50f4
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ImageEditTaskPool/entry/src/main/ets/view/newBuffer1.ets
arkts
mergeArrayBuffers
[Start buffer_test] Merge the calculation results of all tasks.
function mergeArrayBuffers(buffers: ArrayBuffer[]) { // Calculate the combined total length. let totalLength = buffers.reduce((length, buffer) => { length += buffer.byteLength; return length; }, 0); // Create a new ArrayBuffer. let mergedBuffer = new ArrayBuffer(totalLength); // Create a Uint8Array ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeArrayBuffers AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buffers AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function mergeArrayBuffers(buffers: ArrayBuffer[]) { // Calculate the combined total length. let totalLength = buffers.reduce((length, buffer) => { length += buffer.byteLength; return length; }, 0); // Create a new ArrayBuffer. let mergedBuffer = new ArrayBuffer(totalLength); // Create a Uint8Array ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
12409f410e26b38462cb5b5d59450dfe8e2be915
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/utils/IsoFileUtil.ets
arkts
isIsoFile
检查文件是否为ISO文件 @param filePath 文件路径 @returns 是否为ISO文件
static isIsoFile(filePath: string): boolean { const extension = filePath.toLowerCase().split('.').pop() return extension === 'iso' }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isIsoFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ...
static isIsoFile(filePath: string): boolean { const extension = filePath.toLowerCase().split('.').pop() return extension === 'iso' }
https://github.com/Yebingiscn/SweetVideo
504137106c592db89f0c5e562cdf2445c09c25db
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/TransactionDao.ets
arkts
getMonthlyCategoryStats
按月份和分类统计交易金额 用于生成月度分类统计报告 @param year 年份 @param month 月份 (1-12) @param type 交易类型 (0=支出,1=收入) @returns 按分类统计的结果
public async getMonthlyCategoryStats(year: number, month: number, type: number): Promise<MonthlyCategoryStats[]> { // 计算月份的开始和结束时间戳 const startDate: number = new Date(year, month - 1, 1).getTime(); const endDate: number = new Date(year, month, 1).getTime() - 1; const sql: string = ` SELECT ...
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 getMonthlyCategoryStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#...
public async getMonthlyCategoryStats(year: number, month: number, type: number): Promise<MonthlyCategoryStats[]> { // 计算月份的开始和结束时间戳 const startDate: number = new Date(year, month - 1, 1).getTime(); const endDate: number = new Date(year, month, 1).getTime() - 1; const sql: string = ` SELECT ...
https://github.com/fuhhhhhhhh/openharmony
ba315df82b4b66cefd4a67361e56c64c23700cb3
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getExtraRightOffset
@return the extra offset to be appended to the viewport's right
public getExtraRightOffset(): number { return this.mExtraRightOffset; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getExtraRightOffset 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...
public getExtraRightOffset(): number { return this.mExtraRightOffset; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
42f06e8b73013966c5045aa6288fe1bd6af04c65
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
downloadFileWithProgress
带进度回调的文件下载
private async downloadFileWithProgress( url: string, filePath: string, onProgress: (progress: number) => void ): Promise<void> { if (!this.context) { throw new Error('应用上下文未设置'); } try { const downloadConfig: request.DownloadConfig = { url: url, filePath: fileP...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left downloadFileWithProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AS...
private async downloadFileWithProgress( url: string, filePath: string, onProgress: (progress: number) => void ): Promise<void> { if (!this.context) { throw new Error('应用上下文未设置'); } try { const downloadConfig: request.DownloadConfig = { url: url, filePath: fileP...
https://github.com/DaLongZhuaZi/manxia
bf79f2062d1efd64d50cabbec3a069bd4a0e271e
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
encodeAndSendVideo
视频编码 + RTP 打包 + 发送(一体化,单次 NAPI 调用) 一体化:编码 + RTP 打包 + 发送,单次 NAPI 调用 @returns 发送的 RTP 包总数,-1 表示失败
public encodeAndSendVideo(trackId: string, yuvData: Uint8Array, timestampUs: number, rtpTimestamp: number): number { if (!this.client) return -1; return this.client.encodeAndSendVideo(trackId, yuvData, timestampUs, rtpTimestamp); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left encodeAndSendVideo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left trackId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
public encodeAndSendVideo(trackId: string, yuvData: Uint8Array, timestampUs: number, rtpTimestamp: number): number { if (!this.client) return -1; return this.client.encodeAndSendVideo(trackId, yuvData, timestampUs, rtpTimestamp); }
https://github.com/tdcare/tdwebrtc
833c9a88a1fc2ca8ccf0e4e7b5af29f84dcff55f
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SmartBudgetService.ets
arkts
calculateFlexibility
计算灵活性系数(0-1,越大越灵活)
private static calculateFlexibility(data: CategoryHistoricalData): number { // 基于消费的变异系数 if (data.monthlyAmounts.length < 2) { return 0.5; } const avg = data.average; if (avg === 0) { return 1; } const variance = data.monthlyAmounts.reduce((sum: number, amt: number) => { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateFlexibility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:...
private static calculateFlexibility(data: CategoryHistoricalData): number { // 基于消费的变异系数 if (data.monthlyAmounts.length < 2) { return 0.5; } const avg = data.average; if (avg === 0) { return 1; } const variance = data.monthlyAmounts.reduce((sum: number, amt: number) => { ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
8d9032a6d418fd7659089133d4b53a27cf4dbaf9
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModulePush.ets
arkts
redactUrl
Strip query/fragment from a URL before logging so we don't leak tokens.
private redactUrl(url: string): string { let cut: number = url.length; const q: number = url.indexOf('?'); if (q !== -1 && q < cut) cut = q; const h: number = url.indexOf('#'); if (h !== -1 && h < cut) cut = h; return url.substring(0, cut); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left redactUrl 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 stri...
private redactUrl(url: string): string { let cut: number = url.length; const q: number = url.indexOf('?'); if (q !== -1 && q < cut) cut = q; const h: number = url.indexOf('#'); if (h !== -1 && h < cut) cut = h; return url.substring(0, cut); }
https://github.com/Countly/countly-sdk-hos
7f886487be1090f582ddb786aad0f63345940375
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/api/ZoteroClient.ets
arkts
parseJsonObject
Wraps JSON.parse + shape check, converting SyntaxError into ZoteroApiError so the API surface only ever throws our typed error.
function parseJsonObject(body: string, label: string): Record<string, Object> { let parsed: Object; try { parsed = JSON.parse(body); } catch (err) { throw new ZoteroApiError(200, `${label}: invalid JSON: ${JSON.stringify(err)}`); } if (!isPlainObject(parsed)) { throw new ZoteroApiError(200, `${lab...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseJsonObject 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 : AST#:#...
function parseJsonObject(body: string, label: string): Record<string, Object> { let parsed: Object; try { parsed = JSON.parse(body); } catch (err) { throw new ZoteroApiError(200, `${label}: invalid JSON: ${JSON.stringify(err)}`); } if (!isPlainObject(parsed)) { throw new ZoteroApiError(200, `${lab...
https://github.com/Vincent-Leon/zotero-harmony
92f6aeb0599e1cbdeafd8cfe742e352047faac42
github
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
copyFile
拷贝文件 @param path 文件绝对路径及文件名
copyFile(oriPath: string, newPath: string) { fs.copyFileSync(oriPath, newPath); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left copyFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left oriPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Lef...
copyFile(oriPath: string, newPath: string) { fs.copyFileSync(oriPath, newPath); }
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
c50df4c476090a56f9c86770be8e76b85ddb5133
gitee
HarmonyOS_Samples/guide-snippets
ArkGraphics3D/entry/src/main/ets/material/pbr_normal.ets
arkts
setNormalStrength
Adjust the intensity of the normal map effect
setNormalStrength(v: number) { if (this.material) { const f: Vec4 = (this.material as MetallicRoughnessMaterial).normal.factor; f.x = 2 * v / RESO; (this.material as MetallicRoughnessMaterial).normal.factor = f; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setNormalStrength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ...
setNormalStrength(v: number) { if (this.material) { const f: Vec4 = (this.material as MetallicRoughnessMaterial).normal.factor; f.x = 2 * v / RESO; (this.material as MetallicRoughnessMaterial).normal.factor = f; } }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
fddefe406da2c1f75f881fd7262c5a0d2751fa4a
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/OphthalmologyAgent.ets
arkts
getEyeStrainAdvice
用眼疲劳缓解建议
private getEyeStrainAdvice(): string { return `【缓解用眼疲劳建议】 1. **20-20-20法则** - 每用眼20分钟 - 向20英尺(约6米)外看 - 持续20秒 2. **眼保健操** - 每天做1-2次 - 动作要标准、到位 - 配合深呼吸 3. **热敷缓解** - 使用热毛巾敷眼 - 温度40-42℃ - 每次10-15分钟 4. **环境调整** - 调整屏幕亮度和对比度 - 保持适当距离(50-70cm) - 确保环境光线充足 5. **人工泪液** - 可使用人工泪液...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getEyeStrainAdvice 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 stri...
private getEyeStrainAdvice(): string { return `【缓解用眼疲劳建议】 1. **20-20-20法则** - 每用眼20分钟 - 向20英尺(约6米)外看 - 持续20秒 2. **眼保健操** - 每天做1-2次 - 动作要标准、到位 - 配合深呼吸 3. **热敷缓解** - 使用热毛巾敷眼 - 温度40-42℃ - 每次10-15分钟 4. **环境调整** - 调整屏幕亮度和对比度 - 保持适当距离(50-70cm) - 确保环境光线充足 5. **人工泪液** - 可使用人工泪液...
https://github.com/LJ666-ui/harmony-health-care
fb2374de4d1b00b4ead1ba3efd7a55e12f31f579
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/windowInfo/WindowUtil.ets
arkts
setImmersiveType
设置窗口沉浸模式类型
setImmersiveType(type: ImmersiveType) { try { if (type === ImmersiveType.NORMAL) { // 普通模式设置 this.mainWindow.setWindowLayoutFullScreen(false) .then(() => { hilog.info(0x0000, 'testLog', `Succeeded in setting immersive mode.`); }) .catch((err: Busines...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setImmersiveType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImmersiveType AST#identi...
setImmersiveType(type: ImmersiveType) { try { if (type === ImmersiveType.NORMAL) { // 普通模式设置 this.mainWindow.setWindowLayoutFullScreen(false) .then(() => { hilog.info(0x0000, 'testLog', `Succeeded in setting immersive mode.`); }) .catch((err: Busines...
https://github.com/ZestBox-18/kitebook-frontend
5fc40eb75f9eccd015ceab0f630c8868b1714925
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/IndoorLocator.ets
arkts
fusePositions
融合多源定位结果
private fusePositions( wifiPos: PositioningResult, blePos: PositioningResult, arPos: PositioningResult | null ): Position3D { // 动态调整权重 let wifiWeight = this.weights.wifi; let bleWeight = this.weights.ble; let arWeight = this.weights.ar; // 如果AR定位可用,提高其权重 if (arPos !== null) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fusePositions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wifiPos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private fusePositions( wifiPos: PositioningResult, blePos: PositioningResult, arPos: PositioningResult | null ): Position3D { // 动态调整权重 let wifiWeight = this.weights.wifi; let bleWeight = this.weights.ble; let arWeight = this.weights.ar; // 如果AR定位可用,提高其权重 if (arPos !== null) { ...
https://github.com/LJ666-ui/harmony-health-care
821a0fffd335f52b10a0fb7863b350967f99958e
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
updateParentChildNumHandler
delay update all parentnodes child number handler @param parentNodeId parent node id @param nodeIdNodeItemMap nodeId and nodeItem relation map @param isAdd whether addNode or delete node @param count node count
function updateParentChildNumHandler(parentNodeId: number, nodeIdNodeItemMap: Map<number, NodeItem>, isAdd: boolean, count: int) { let tmpParentNodeId: number = parentNodeId; while (tmpParentNodeId >= 0) { if (nodeIdNodeItemMap.has(tmpParentNodeId)) { let parent: NodeItem = nodeIdNodeItemMap.get(tmpPare...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left updateParentChildNumHandler AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left parentNodeId AST#identifier#Right AST#type_annotation#Left...
function updateParentChildNumHandler(parentNodeId: number, nodeIdNodeItemMap: Map<number, NodeItem>, isAdd: boolean, count: int) { let tmpParentNodeId: number = parentNodeId; while (tmpParentNodeId >= 0) { if (nodeIdNodeItemMap.has(tmpParentNodeId)) { let parent: NodeItem = nodeIdNodeItemMap.get(tmpPare...
https://gitcode.com/openharmony/arkui_ace_engine
cbafe6e981d896dc0c492547908da47556dd73e5
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/29.conditional_expressions/02.numeric_conditional_expressions/type_of_numeric_condition_expression_type.ets
arkts
main
--- desc: Type of a numeric conditional expression tags: [compile-only, negative] ---
function main(): void { let x = {{operand.first}} ? {{operand.second}} : {{operand.third}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let x = {{operand.first}} ? {{operand.second}} : {{operand.third}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
0791c0ac0a0c930501e644acb12af475c9777a14
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Editor/FileEditorService.ets
arkts
applyLinkedSave
保存后执行应用联动
public async applyLinkedSave(saveTarget: FileEditorSaveTarget, content: string): Promise<FileEditorLinkedSaveResult> { if (saveTarget.shouldApplyToApp !== true) { return this.createLinkedSaveResult(true, saveTarget.type, '无需应用联动', saveTarget.id ?? '', saveTarget.name ?? ''); } if (saveTarget.type =...
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 applyLinkedSave AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saveTarget AST#identifier#Right AST#:#Le...
public async applyLinkedSave(saveTarget: FileEditorSaveTarget, content: string): Promise<FileEditorLinkedSaveResult> { if (saveTarget.shouldApplyToApp !== true) { return this.createLinkedSaveResult(true, saveTarget.type, '无需应用联动', saveTarget.id ?? '', saveTarget.name ?? ''); } if (saveTarget.type =...
https://github.com/DaLongZhuaZi/manxia
fcf6162b14ae91ce10ed582be4bbd5757d28ba08
github
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
sftpWrite
Write binary data to an open file descriptor.
async sftpWrite(fd: number, data: ArrayBuffer): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { await ssh.sftpWrite(this.handle, fd, data); } catch (err) { const msg = (err as Error).message ?? 'SFTP write failed'; throw new SshErr...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpWrite AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fd AST#identifier#Right AST#type_annotation#Left A...
async sftpWrite(fd: number, data: ArrayBuffer): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { await ssh.sftpWrite(this.handle, fd, data); } catch (err) { const msg = (err as Error).message ?? 'SFTP write failed'; throw new SshErr...
https://github.com/UnbalancedCat/ohos-ssh-core
70386f63e5662a616a76c543a31376a1333e685b
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/CacheManager.ets
arkts
set
设置缓存数据 @param key 缓存键 @param value 要缓存的值 @param ttl 过期时间(毫秒),默认 5 分钟 功能: - 存储数据到内存 - 设置过期时间 - 支持自定义 TTL
static set<T extends Object>(key: string, value: T, ttl: number = CacheManager.DEFAULT_TTL): void { const expireAt = Date.now() + ttl; CacheManager.cache.set(key, { value, expireAt }); console.log(`[CacheManager] 缓存已设置: ${key}, TTL: ${ttl}ms, 过期时间: ${new Date(expireAt).toLocaleString...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#exte...
static set<T extends Object>(key: string, value: T, ttl: number = CacheManager.DEFAULT_TTL): void { const expireAt = Date.now() + ttl; CacheManager.cache.set(key, { value, expireAt }); console.log(`[CacheManager] 缓存已设置: ${key}, TTL: ${ttl}ms, 过期时间: ${new Date(expireAt).toLocaleString...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
688a24da994899e008136a16108404b316dc4546
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
getEbookReadingStyle
获取电子书阅读文字样式参数
public static getEbookReadingStyle(): TextStyleParams { return { fontFamily: FontAwareHelper.globalState.ebookFontFamily, fontSize: FontAwareHelper.globalState.ebookFontSize, lineHeight: FontAwareHelper.globalState.ebookLineHeight }; }
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 getEbookReadingStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
public static getEbookReadingStyle(): TextStyleParams { return { fontFamily: FontAwareHelper.globalState.ebookFontFamily, fontSize: FontAwareHelper.globalState.ebookFontSize, lineHeight: FontAwareHelper.globalState.ebookLineHeight }; }
https://github.com/DaLongZhuaZi/manxia
3d62a87ac37a288ef644cfaa5eff626ff1420ad5
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets
arkts
generateRecommendations
生成个性化建议
private static generateRecommendations( riskFactors: RiskFactor[], chronicRisks: ChronicDiseaseRisk[] ): string[] { const recommendations: string[] = []; // 根据高风险因子给出建议 const highRiskFactors = riskFactors.filter(f => f.level === 'high' || f.level === 'very_high'); highRiskFactors.forEa...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left generateRecommendations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left riskFactors AST#identifier#R...
private static generateRecommendations( riskFactors: RiskFactor[], chronicRisks: ChronicDiseaseRisk[] ): string[] { const recommendations: string[] = []; // 根据高风险因子给出建议 const highRiskFactors = riskFactors.filter(f => f.level === 'high' || f.level === 'very_high'); highRiskFactors.forEa...
https://github.com/LJ666-ui/harmony-health-care
1a768fed41bfceb5143293bcd132436e073e0020
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformViewFactory.ets
arkts
getCreateArgsCodec
Returns the codec to be used for decoding the args parameter of {@link #create}.
getCreateArgsCodec(): MessageCodec<Any> { return this.createArgsCodec; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCreateArgsCodec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#...
getCreateArgsCodec(): MessageCodec<Any> { return this.createArgsCodec; }
https://gitee.com/openharmony-sig/flutter_engine.git
6077568cdbbed639f0efe5ede8c8c451efd86a0e
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/MetadataStorage.ets
arkts
clear
清除所有注册的元数据(主要用于测试)
clear(): void { this.entities.clear() this.instanceEntityMap.clear() this.relations.clear() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): void { this.entities.clear() this.instanceEntityMap.clear() this.relations.clear() }
https://github.com/offlinecat-dev/OCNetORM
3afa954ca2820938ea8fd51348b16325e7e1f4ad
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/net/base/BaseAxiosDelegate.ets
arkts
getRequest
封装get请求 @param path @param config @returns
protected getRequest<T = any>(path: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T, any>> { return this.instance.get<T>(path, config) }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left getRequest AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#=#Left = AST#=#Right AST#identifier#Left any AST#identifier#Right AST#>#Left > AST#>#Right AST#formal_parameters#Le...
protected getRequest<T = any>(path: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T, any>> { return this.instance.get<T>(path, config) }
https://github.com/RedRackham-R/WanAndroidHarmoney
346856a02b32aba8af1910a876ed134a2c4b1c72
github
openharmony/arkui_ace_engine
advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets
arkts
aboutToDisappear
component disappear
aboutToDisappear() { animateTo({ duration: ENTER_EXIT_ICON_DURATION, curve: COMMON_BEZIER, }, () => { this.gridComState = false; }); this.menuSwitch = false; this.selected = this.copySelected; this.unSelected = this.copyUnSelected; if (this.callbackId) { this.getUIC...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { animateTo({ duration: ENTER_EXIT_ICON_DURATION, curve: COMMON_BEZIER, }, () => { this.gridComState = false; }); this.menuSwitch = false; this.selected = this.copySelected; this.unSelected = this.copyUnSelected; if (this.callbackId) { this.getUIC...
https://gitcode.com/openharmony/arkui_ace_engine
12ec790cd8bbede0cb4a0e73c6a22818db7ebe21
gitcode
codelably/HCompass
core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets
arkts
enable
手动开启所有日志输出
static enable() { Logger.option.close = false; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left enable 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#{#...
static enable() { Logger.option.close = false; }
https://github.com/codelably/HCompass
46590d79187d14647934eb381360da27be9c9c0a
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/model/ScanSize.ets
arkts
getDisplay
获取屏幕Display @returns
public getDisplay(): display.Display | null { let displayClass: display.Display | null = null; try { displayClass = display.getDefaultDisplaySync(); } catch (error) { logger.error(`Failed to getDefaultDisplaySync. Code: ` + error.code); } return displayClass; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDisplay 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_...
public getDisplay(): display.Display | null { let displayClass: display.Display | null = null; try { displayClass = display.getDefaultDisplaySync(); } catch (error) { logger.error(`Failed to getDefaultDisplaySync. Code: ` + error.code); } return displayClass; }
https://gitcode.com/arkui-x/samples
484fa72a02506927fe7c01c48a1ccdc80fc6356b
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
removeNode
remove node @param currentNodeId current node id @param parentNodeId parent node id @returns node id list which is removed
public removeNode(currentNodeId: number, parentNodeId: number): number[] { if (this.nodeIdNodeItemMap.has(parentNodeId) && this.nodeIdNodeItemMap.has(currentNodeId)) { let parent: NodeItem = this.nodeIdNodeItemMap.get(parentNodeId) as NodeItem; let current: NodeItem = this.nodeIdNodeItemMap.get(curren...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentNodeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
public removeNode(currentNodeId: number, parentNodeId: number): number[] { if (this.nodeIdNodeItemMap.has(parentNodeId) && this.nodeIdNodeItemMap.has(currentNodeId)) { let parent: NodeItem = this.nodeIdNodeItemMap.get(parentNodeId) as NodeItem; let current: NodeItem = this.nodeIdNodeItemMap.get(curren...
https://gitcode.com/openharmony/arkui_ace_engine
b7e3b622f9e0a54c2bf2deb92ea81d7f9f643d6a
gitcode
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/ExpressionsDataSource.ets
arkts
getData
return data @param index list of index @return data item for index
public getData(index: number): LooseObject | null { if (this.expList == null || index >= this.expList?.length) { LogUtil.info(TAG, 'getData is empty'); return null; } else { let looseObject: LooseObject = (this.expList[index]) as LooseObject; return looseObject; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public getData(index: number): LooseObject | null { if (this.expList == null || index >= this.expList?.length) { LogUtil.info(TAG, 'getData is empty'); return null; } else { let looseObject: LooseObject = (this.expList[index]) as LooseObject; return looseObject; } }
https://gitee.com/openharmony-sig/applications_calculator.git
7c0492e28233314d30e6899e4949f65ade208205
gitee
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/utils/PlaySpeedManager.ets
arkts
getPreferences
获取首选项存储
private getPreferences() { try { return preferences.getPreferencesSync(this.context || getContext(), { name: 'play_speed_preferences' }) } catch (error) { console.error('获取播放速度存储失败:', error) return null } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getPreferences 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#{#Le...
private getPreferences() { try { return preferences.getPreferencesSync(this.context || getContext(), { name: 'play_speed_preferences' }) } catch (error) { console.error('获取播放速度存储失败:', error) return null } }
https://github.com/SMAT-Lab/PhantomRendering
4260b991ca5ecc90e6fe03b1784ea096023c1f43
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/ComicInfoParser.ets
arkts
createDefaultComicInfo
创建默认的ComicInfo对象 @param fileName 文件名,用于生成默认标题 @returns 默认的ComicInfo对象
public static createDefaultComicInfo(fileName: string): ComicInfo { // 从文件名提取标题(去除扩展名) const title = fileName.replace(/\.[^/.]+$/, ''); return { title: title, series: title, format: 'Archive', languageISO: 'zh-CN' }; }
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 createDefaultComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AS...
public static createDefaultComicInfo(fileName: string): ComicInfo { // 从文件名提取标题(去除扩展名) const title = fileName.replace(/\.[^/.]+$/, ''); return { title: title, series: title, format: 'Archive', languageISO: 'zh-CN' }; }
https://github.com/DaLongZhuaZi/manxia
f1f76fc3e57de3d4f589725b36ffb9ae803cfba4
github
OHPG/FinSdk
jellyfin/src/main/ets/api/SessionApi.ets
arkts
sendMessageCommand
sendMessageCommand @summary Issues a command to a client to display a message to the user. @param {SessionApiSendMessageCommandRequest} requestParameters Request parameters. @throws {RequiredError} @memberof SessionApi
public async sendMessageCommand(requestParameters: SessionApiSendMessageCommandRequest): Promise<void> { this.assertParam(requestParameters.sessionId) return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Message`, data: requestParameters.messageCommand}) }
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 sendMessageCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Righ...
public async sendMessageCommand(requestParameters: SessionApiSendMessageCommandRequest): Promise<void> { this.assertParam(requestParameters.sessionId) return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Message`, data: requestParameters.messageCommand}) }
https://github.com/OHPG/FinSdk
76ab60bee0e4a2a45895ff77797fa0edbd8a4206
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
getRequestStats
获取网络请求统计信息
static getRequestStats(): RequestStats { // 这里可以添加请求统计逻辑 return { success: 0, failed: 0, total: 0 } as RequestStats; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRequestStats 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 Reques...
static getRequestStats(): RequestStats { // 这里可以添加请求统计逻辑 return { success: 0, failed: 0, total: 0 } as RequestStats; }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
2a5961d1dae40ce5307fd807f861a248ff7ac1f5
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/component/ResourceItem.ets
arkts
getImg
判断类型获取图标
getImg() { switch (this.resource.resourceType) { case ResourceType.Dictionary: return $r("app.media.icon_dictionary") break case ResourceType.File: return $r("app.media.icon_file") break } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getImg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#switch_statement#Left AST#swit...
getImg() { switch (this.resource.resourceType) { case ResourceType.Dictionary: return $r("app.media.icon_dictionary") break case ResourceType.File: return $r("app.media.icon_file") break } }
https://gitee.com/openharmony-sig/online_event.git
c6a8a0f8602fbe6b4f59a466406daad83e06a42f
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
cleanupLegacyTimestampKeys
清理旧版本遗留的 timestamp_ 键 旧版用 timestamp_<key> 存储在 SettingsService 中,新版用内存 versionMap 替代
private static cleanupLegacyTimestampKeys(): void { try { const allSettings = SettingsService.getAll(); const allKeys = Object.keys(allSettings); const timestampKeys = allKeys.filter(key => key.startsWith('timestamp_')); for (const key of timestampKeys) { SettingsService.deleteSyn...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left cleanupLegacyTimestampKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expres...
private static cleanupLegacyTimestampKeys(): void { try { const allSettings = SettingsService.getAll(); const allKeys = Object.keys(allSettings); const timestampKeys = allKeys.filter(key => key.startsWith('timestamp_')); for (const key of timestampKeys) { SettingsService.deleteSyn...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L468-L485
5827e173f7fac12f09c3d40189749c677a66c3a1
github