nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
download
下载 @param downloadNetwork 下载网络类型,默认为wifi
async download(downloadNetwork: update.NetType = update.NetType.WIFI): Promise<void> { UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); let versionDigest: string = await VersionUtils.getNewVersionDigest(); this.setDownloadProgress(0); this.updateManager.download(versionDigest, downloadNe...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left download AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left downloadNetwork AST#identifier#Right AST#type_annotation#Left...
async download(downloadNetwork: update.NetType = update.NetType.WIFI): Promise<void> { UpgradeAdapter.getInstance().getNotifyInstance()?.cancelAll(); let versionDigest: string = await VersionUtils.getNewVersionDigest(); this.setDownloadProgress(0); this.updateManager.download(versionDigest, downloadNe...
https://gitee.com/openharmony/update_update_app.git
2e23f73a157d61b1a69ffbe782b917cc49bbe707
gitee
openharmony-sig/ohos_checksum
library/src/main/ets/md5.ets
arkts
rstr_md5
Calculate the MD5 of a raw string
rstr_md5(s: string) :string { return this.binl2rstr(this.binl_md5(this.rstr2binl(s), s.length * 8)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rstr_md5 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig...
rstr_md5(s: string) :string { return this.binl2rstr(this.binl_md5(this.rstr2binl(s), s.length * 8)); }
https://gitee.com/openharmony-sig/ohos_checksum.git
fb1a033302515725f24177409b8b663b033dceeb
gitee
popsiclelmlm/Hey
entry/src/main/ets/storage/SubscriptionStore.ets
arkts
restoreProfile
用整份订阅档案覆盖现有数据(配置恢复用)。normalize 负责字段归一化与容错。
static async restoreProfile(context: common.Context, profile: SubscriptionProfile): Promise<SubscriptionProfile> { await SubscriptionStore.save(context, SubscriptionStore.normalize(profile)); return SubscriptionStore.load(context); }
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 restoreProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :...
static async restoreProfile(context: common.Context, profile: SubscriptionProfile): Promise<SubscriptionProfile> { await SubscriptionStore.save(context, SubscriptionStore.normalize(profile)); return SubscriptionStore.load(context); }
https://github.com/popsiclelmlm/Hey
d7541470ae4888a64d762c5055266007fdb5c534
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/MediaTools.ets
arkts
fill
Pads a time segment to two digits (e.g. 3 -> "03").
private static fill(value: number): string { return value.toString().padStart(2, '0'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#...
private static fill(value: number): string { return value.toString().padStart(2, '0'); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
412eaf8f48b200ff62d84057de69d92870997544
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock_realdata.ets
arkts
generateAlerts
获取6条真实告警记录(涵盖所有类型和状态)
public generateAlerts(): ExtendedWardAlert[] { const now = Date.now(); return [ // 告警1: 心率过高(CRITICAL) - 已解决 { alertId: '1', deviceId: 'MONITOR-301-B1', deviceName: '床1多参数监护仪', category: AlertCategory.VITAL_SIGN, level: AlertLevel.CRITICAL, title: '...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateAlerts 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 Extende...
public generateAlerts(): ExtendedWardAlert[] { const now = Date.now(); return [ // 告警1: 心率过高(CRITICAL) - 已解决 { alertId: '1', deviceId: 'MONITOR-301-B1', deviceName: '床1多参数监护仪', category: AlertCategory.VITAL_SIGN, level: AlertLevel.CRITICAL, title: '...
https://github.com/LJ666-ui/harmony-health-care
08ac742c8a1db11ef90932506536ae85457502b4
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
convertObject
Converts object to this tuple type @param {Any} obj Object to convert @returns {Any} Converted object @throws {Error} Not implemented yet @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override convertObject(obj: Any): Any { throw new Error("todo(kprokopenko): add when tuple becomes available") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : A...
public override convertObject(obj: Any): Any { throw new Error("todo(kprokopenko): add when tuple becomes available") }
https://gitcode.com/iop123123/arkts-static-skills
81ff2e705430e5f7c211d2950ea4ec099e293650
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/utils/PatchExporter.ets
arkts
exportUnifiedToClipboard
将 Unified Diff 导出到剪贴板
static exportUnifiedToClipboard( chunks: DiffChunk[], linesA: DiffLine[], linesB: DiffLine[], options?: ExportOptions ): boolean { const patch = this.generateUnifiedDiff(chunks, linesA, linesB, options); return this.exportToClipboard(patch); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left exportUnifiedToClipboard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chunks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subsc...
static exportUnifiedToClipboard( chunks: DiffChunk[], linesA: DiffLine[], linesB: DiffLine[], options?: ExportOptions ): boolean { const patch = this.generateUnifiedDiff(chunks, linesA, linesB, options); return this.exportToClipboard(patch); }
https://github.com/XJTUWYD/ArkDiff
6c3dd57ac7716c569f43989de9a8035966c3fe7d
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/AdminAuthService.ets
arkts
isTokenValid
检查管理员Token是否有效 @returns Token是否有效
static async isTokenValid(): Promise<boolean> { try { const token = AppStorage.get<string>('adminToken'); return token !== undefined && token !== null && token.length > 0; } catch (error) { console.error('检查管理员Token失败:', error); 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 isTokenValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
static async isTokenValid(): Promise<boolean> { try { const token = AppStorage.get<string>('adminToken'); return token !== undefined && token !== null && token.length > 0; } catch (error) { console.error('检查管理员Token失败:', error); return false; } }
https://github.com/LJ666-ui/harmony-health-care
f6a690d2b3b801c329506d66cc27b0cd08f230b1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
setSelectorToAction
设置操作的选择器
private setSelectorToAction(action: Action, selector: string): void { switch (action.type) { case ActionType.WAIT: (action as WaitAction).selector = selector; break; case ActionType.CLICK: (action as ClickAction).selector = selector; break; case ActionType.INPUT: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setSelectorToAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private setSelectorToAction(action: Action, selector: string): void { switch (action.type) { case ActionType.WAIT: (action as WaitAction).selector = selector; break; case ActionType.CLICK: (action as ClickAction).selector = selector; break; case ActionType.INPUT: ...
https://github.com/DaLongZhuaZi/manxia
ae3a7c66b0b8b280cb802ed9b7cb2d50e912482a
github
revalue-o/HarmonyOS-Next-Hook-demo
source_codes/ArkTS-inject/entry/src/main/ets/utils/LocationUtil.ets
arkts
formatLocationToString
格式化位置数据为JSON字符串
static formatLocationToString(data: LocationData): string { return JSON.stringify(data, null, 2); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatLocationToString 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#identifie...
static formatLocationToString(data: LocationData): string { return JSON.stringify(data, null, 2); }
https://github.com/revalue-o/HarmonyOS-Next-Hook-demo
297d44daa3b9a5e180d477eec99f3163b7e46f7f
github
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/pages/SettingPage.ets
arkts
build
模拟开关状态
build() { Column() { // 1. 顶部导航 Row() { Button({ type: ButtonType.Circle, stateEffect: true }) { Text('<').fontSize(26).fontWeight(FontWeight.Bold).fontColor('#333') } .width(40).height(40).backgroundColor('#FFF') .onClick(() => router.back()) Text("系...
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() { // 1. 顶部导航 Row() { Button({ type: ButtonType.Circle, stateEffect: true }) { Text('<').fontSize(26).fontWeight(FontWeight.Bold).fontColor('#333') } .width(40).height(40).backgroundColor('#FFF') .onClick(() => router.back()) Text("系...
https://gitcode.com/openharmony/codelabs
c9cffef006011616befcc184c75e4512ce4e6436
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videoplaycomponents/XComponentVideo.ets
arkts
setSurfaceID
TODO 知识点:XComponent和AVPlayer通过surfaceId绑定
setSurfaceID(): void { logger.info(TAG, 'play video: surfaceID is:' + this.surfaceID); this.avPlayer.surfaceId = this.surfaceID; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSurfaceID 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...
setSurfaceID(): void { logger.info(TAG, 'play video: surfaceID is:' + this.surfaceID); this.avPlayer.surfaceId = this.surfaceID; }
https://github.com/openharmony/applications_app_samples
289591b52fc1fe52507910e9453df5e7a0bc96c9
github
openharmony/applications_calendar_data
datamanager/src/main/ets/utils/CalendarDataHelper.ets
arkts
getRdbStore
get the instance of rdbStore
public async getRdbStore() { if (this.rdbStore === null || this.rdbStore === undefined) { await CalendarDataHelper.getInstance().initRdbStore(); } return this.rdbStore; }
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 getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERRO...
public async getRdbStore() { if (this.rdbStore === null || this.rdbStore === undefined) { await CalendarDataHelper.getInstance().initRdbStore(); } return this.rdbStore; }
https://gitee.com/openharmony/applications_calendar_data.git
fe95ffb93cb2c8a5f83fac48559b88ac2c7095c8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Parser.ets
arkts
parseRawText
解析原始文本内容 优化:避免在循环中重复调用substring和toLowerCase,使用indexOf查找结束标签
private parseRawText(element: HTMLElement, tagName: string): void { const endTag = `</${tagName}`; const start = this.pos; // 优化:使用indexOf查找结束标签位置,避免逐字符遍历 // 先尝试精确匹配 let endPos = this.html.indexOf(endTag, this.pos); // 如果精确匹配失败,尝试不区分大小写匹配 if (endPos === -1) { const htmlLowe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseRawText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left element AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private parseRawText(element: HTMLElement, tagName: string): void { const endTag = `</${tagName}`; const start = this.pos; // 优化:使用indexOf查找结束标签位置,避免逐字符遍历 // 先尝试精确匹配 let endPos = this.html.indexOf(endTag, this.pos); // 如果精确匹配失败,尝试不区分大小写匹配 if (endPos === -1) { const htmlLowe...
https://github.com/DaLongZhuaZi/manxia
717d72f70ede499fce43f7a2fb9b014fa63f778d
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/accessibility/AccessibilityConfig.ets
arkts
updateSettings
更新配置 @param newSettings 部分新配置
public async updateSettings(newSettings: Partial<AccessibilitySettings>): Promise<void> { // 合并新旧配置 this.settings = { ...this.settings, ...newSettings }; // 应用配置到全局 this.applySettings(); // 通知所有监听器 this.notifyListeners(); // 持久化配置 await this.persistSettings(); c...
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 updateSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left newSettings AST#identi...
public async updateSettings(newSettings: Partial<AccessibilitySettings>): Promise<void> { // 合并新旧配置 this.settings = { ...this.settings, ...newSettings }; // 应用配置到全局 this.applySettings(); // 通知所有监听器 this.notifyListeners(); // 持久化配置 await this.persistSettings(); c...
https://github.com/LJ666-ui/harmony-health-care
9a8fde6a2cc6fed5bfae3ddfea2981f68f0aeffc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/DownloadDirManager.ets
arkts
getImageSavePath
获取图片保存路径
public getImageSavePath(mangaTitle: string, chapterTitle: string, pageIndex: number, extension: string = 'jpg'): string { const chapterPath = this.getMangaDownloadPath(mangaTitle, chapterTitle); return `${chapterPath}/page_${String(pageIndex + 1).padStart(4, '0')}.${extension}`; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getImageSavePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
public getImageSavePath(mangaTitle: string, chapterTitle: string, pageIndex: number, extension: string = 'jpg'): string { const chapterPath = this.getMangaDownloadPath(mangaTitle, chapterTitle); return `${chapterPath}/page_${String(pageIndex + 1).padStart(4, '0')}.${extension}`; }
https://github.com/DaLongZhuaZi/manxia
9da863614c16dd47745a6f01cf5436baf117dca0
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets
arkts
oscillation
震荡插值器
static oscillation(frequency: number = 2): curves.ICurve { return curves.springCurve(1, 0.4, 0.2, frequency); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left oscillation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left frequency AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expr...
static oscillation(frequency: number = 2): curves.ICurve { return curves.springCurve(1, 0.4, 0.2, frequency); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
7f1db650d443e76e6424a2ceef9553390c855896
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
resolveDeviceIdForKeyEvent
解析按键事件的目标设备 ID @returns 解析后的设备 ID,-1 表示无法处理
private resolveDeviceIdForKeyEvent(deviceId: number, keyCode: number, isSpecialKey: boolean): number { if (this.connectedDevices.has(deviceId)) { return deviceId; } // 特殊按键:路由到第一个已连接设备 if (isSpecialKey) { const existingDevices = Array.from(this.connectedDevices.keys()); if (exis...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveDeviceIdForKeyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left nu...
private resolveDeviceIdForKeyEvent(deviceId: number, keyCode: number, isSpecialKey: boolean): number { if (this.connectedDevices.has(deviceId)) { return deviceId; } // 特殊按键:路由到第一个已连接设备 if (isSpecialKey) { const existingDevices = Array.from(this.connectedDevices.keys()); if (exis...
https://github.com/AlkaidLab/moonlight-harmony
0521e80e42b36b5a99cd59e3009608b58534ec93
github
LongLiveY96/chatcube
entry/src/main/ets/services/WebDAVSyncService.ets
arkts
cleanupLocal
取消时清理本地遗留文件
cleanupLocal(localPath: string): void { this.deleteFileSafely(localPath) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanupLocal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left localPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)...
cleanupLocal(localPath: string): void { this.deleteFileSafely(localPath) }
https://github.com/LongLiveY96/chatcube
b1a0ad1cb83f25beb5aa9c6d7732f6a7db280830
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/pages/Calendar/statisticsComponent.ets
arkts
drawWeightLine
--- 绘图逻辑微调 ---
drawWeightLine(data: HealthChartData[]) { if (data.length === 0) { return } // 这一步确保 Canvas 内部尺寸与显示尺寸一致,防止坐标偏移 const width = this.context.width const height = 100 this.context.clearRect(0, 0, width, height) this.context.strokeStyle = '#52C41A' this.context.lineWidth = 2 thi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawWeightLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#L...
drawWeightLine(data: HealthChartData[]) { if (data.length === 0) { return } // 这一步确保 Canvas 内部尺寸与显示尺寸一致,防止坐标偏移 const width = this.context.width const height = 100 this.context.clearRect(0, 0, width, height) this.context.strokeStyle = '#52C41A' this.context.lineWidth = 2 thi...
https://gitcode.com/openharmony/codelabs
1a92d7edf7312eb668b37f5fa5aa553995e139fd
gitcode
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/EventEmitter.ets
arkts
emit
Emit an event, calling all subscribed callbacks.
protected emit(event: string, payload?: EventPayload): void { const callbacks = this.listeners.get(event); if (callbacks) { callbacks.forEach(callback => { try { callback(payload); } catch (e) { // Prevent one bad listener from breaking the emit chain consol...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left emit AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#...
protected emit(event: string, payload?: EventPayload): void { const callbacks = this.listeners.get(event); if (callbacks) { callbacks.forEach(callback => { try { callback(payload); } catch (e) { // Prevent one bad listener from breaking the emit chain consol...
https://github.com/UnbalancedCat/ohos-ssh-core
af310e61bc870dc1b17a5caf3bcf528634464487
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
constructor
`Date` constructor. @param year @param month @param day @param hours @see ECMA-262, 21.4.2.1
constructor(year: double, month: double, day: double, hours: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, 0.0, 0.0, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right A...
constructor(year: double, month: double, day: double, hours: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, 0.0, 0.0, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4e5d20dc1473f600864d578339356d1bfd0518f6
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SmartCategoryService.ets
arkts
cleanupLowPerformanceRules
清理低效规则
static async cleanupLowPerformanceRules(userId: number): Promise<number> { try { return await SmartCategoryRuleDAO.cleanupLowAccuracyRules(userId, 0.3, 10); } catch (error) { console.error('[SmartCategoryService] 清理低效规则失败:', error); return 0; } }
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 cleanupLowPerformanceRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right A...
static async cleanupLowPerformanceRules(userId: number): Promise<number> { try { return await SmartCategoryRuleDAO.cleanupLowAccuracyRules(userId, 0.3, 10); } catch (error) { console.error('[SmartCategoryService] 清理低效规则失败:', error); return 0; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
96a77b4b4468a45e52ca4f1131834e705c1757df
github
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/MaxLinesPerFunctionCheck/ets/MaxLinesPerFunction.ets
arkts
foo3
eslint max-lines-per-function: ["error", {"max": 2, "skipBlankLines": true}]
function foo3() { let x = 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo3 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_declaration#Le...
function foo3() { let x = 0; }
https://github.com/SMAT-Lab/Homecheck-Sec2026
a34ff4c709d94d7509e8f90b7f593663228dc221
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
requestRaw
执行原始 HTTP 请求,保留状态码并允许空响应体。 适用于 GitHub Star 检查这类用 204/404 表达业务结果的 API。
static async requestRaw( url: string, method: HttpMethod, body?: string, config?: HttpClientConfig ): Promise<HttpResponse> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TI...
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 requestRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#R...
static async requestRaw( url: string, method: HttpMethod, body?: string, config?: HttpClientConfig ): Promise<HttpResponse> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TI...
https://github.com/AlkaidLab/moonlight-harmony
18eb9cb62eccb48c7f878586cf5ca70f1c7e9b0c
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/LightSensingService.ets
arkts
startMonitoring
启动环境光监测(每秒采样)
startMonitoring(): void { if (this.isMonitoring) { return; } try { sensor.on( sensor.SensorId.AMBIENT_LIGHT, (data: Object): void => { const light = (data as Record<string, number>)['light']; if (typeof light === 'number') { this.currentLux = lig...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startMonitoring AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#met...
startMonitoring(): void { if (this.isMonitoring) { return; } try { sensor.on( sensor.SensorId.AMBIENT_LIGHT, (data: Object): void => { const light = (data as Record<string, number>)['light']; if (typeof light === 'number') { this.currentLux = lig...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
de09a993ce69651f8c05e17b4235fdaf4c2a19bd
github
751496032/DSBridge-HarmonyOS
library/src/main/ets/core/WebViewControllerProxy.ets
arkts
injectDS2Js
注入DS2.0的JS, 默认是3.0
injectDS2Js(): void { this.bridge.injectDS2Js() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left injectDS2Js 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#...
injectDS2Js(): void { this.bridge.injectDS2Js() }
https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L41-L43
edcb4191b75f1288b046fcbd3f32192941001ecb
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxLoadService.ets
arkts
handleLoadMessage
处理加载进度消息 @param data @param onLoadMessage
private static handleLoadMessage(data: WorkerMessage, onLoadMessage?: (message: LoadMessage) => void) { const loadMessage = data as LoadMessage; hilog.debug(DOMAIN, TAG, 'Received loading message: %{public}s', ResourceManager.getString(loadMessage.message)); if (onLoadMessage) { onLoadMessage(loadM...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left handleLoadMessage AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private static handleLoadMessage(data: WorkerMessage, onLoadMessage?: (message: LoadMessage) => void) { const loadMessage = data as LoadMessage; hilog.debug(DOMAIN, TAG, 'Received loading message: %{public}s', ResourceManager.getString(loadMessage.message)); if (onLoadMessage) { onLoadMessage(loadM...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxLoadService.ets#L94-L100
19aa55db3c4ccfaa6a2fce28a3708ee71bb033c6
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/components/Form/index.ets
arkts
buildLabelAndValue
buildLabelAndValue(label: ResourceStr, value: ResourceStr) {
buildLabelAndValue($$: IBuildLabelAndValue) { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Text($$.label) .fontSize($r('sys.float.Body_L')) .fontColor($r('sys.color.font_primary')) .margin({ right: $r('app.float.card_tag_margin_end') }) .fo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildLabelAndValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left $$ AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IBuildLabelAndValue AST#...
buildLabelAndValue($$: IBuildLabelAndValue) { Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { Text($$.label) .fontSize($r('sys.float.Body_L')) .fontColor($r('sys.color.font_primary')) .margin({ right: $r('app.float.card_tag_margin_end') }) .fo...
https://gitee.com/openharmony-sig/applications_clock.git
f480c5d14af8ba28a5c79fbc23a6f0c35e566fc9
gitee
xblLab/HarmonyProjectTemplate
components/module_feedback/src/main/ets/services/FuncService.ets
arkts
addFeedback
新增提交反馈 @param params
public addFeedback(params: SubmitFeedbackParams): Promise<void> { return new Promise((resolve) => { const item: FeedbackResponseParams = { id: Date.now().toString(), createTime: Date.now(), problemDesc: params.problemDesc, screenShots: params.screenShots, contactPhone...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addFeedback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Su...
public addFeedback(params: SubmitFeedbackParams): Promise<void> { return new Promise((resolve) => { const item: FeedbackResponseParams = { id: Date.now().toString(), createTime: Date.now(), problemDesc: params.problemDesc, screenShots: params.screenShots, contactPhone...
https://github.com/xblLab/HarmonyProjectTemplate
2aab86f21c11a0ee4702f00e9367deb429dd9105
github
zhen666555-sketch/HarmonyOS-community
entry/src/main/ets/common/utils.ets
arkts
doRequest
执行接口请求
doRequest(methods,uri,params,successFun) { // 每一个httpRequest对应一个http请求任务,不可复用 let httpRequest = http.createHttp(); console.info('requestInfo' + JSON.stringify(params)) httpRequest.request( // 填写http请求的url地址,可以带参数也可以不带参数。URL地址需要开发者自定义。GET请求的参数可以在extraData中指定 CommonConstants.server+uri, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left methods AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left uri AST#identifier#Right AST#,#Left , AST#,#Right AST#ident...
doRequest(methods,uri,params,successFun) { // 每一个httpRequest对应一个http请求任务,不可复用 let httpRequest = http.createHttp(); console.info('requestInfo' + JSON.stringify(params)) httpRequest.request( // 填写http请求的url地址,可以带参数也可以不带参数。URL地址需要开发者自定义。GET请求的参数可以在extraData中指定 CommonConstants.server+uri, ...
https://github.com/zhen666555-sketch/HarmonyOS-community
fac5207b24bc621a2793c95673ade7734a198c16
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
setDrawZeroLine
Set this to true to draw the zero-line regardless of weather other grid-lines are enabled or not. Default: false @param mDrawZeroLine
public setDrawZeroLine(mDrawZeroLine: boolean): void { this.mDrawZeroLine = mDrawZeroLine; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawZeroLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mDrawZeroLine AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AS...
public setDrawZeroLine(mDrawZeroLine: boolean): void { this.mDrawZeroLine = mDrawZeroLine; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8a8facc3f9cecaf08593963ea9c7e98abca056f0
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
setLoggedIn
设置登录状态
setLoggedIn(sourceId: string, isLoggedIn: boolean, cookies?: Record<string, string>): void { this.loginStatus.set(sourceId, { sourceId, isLoggedIn, lastLoginTime: isLoggedIn ? Date.now() : undefined, cookies }); if (cookies) { this.cookies.set(sourceId, cookies); } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLoggedIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#R...
setLoggedIn(sourceId: string, isLoggedIn: boolean, cookies?: Record<string, string>): void { this.loginStatus.set(sourceId, { sourceId, isLoggedIn, lastLoginTime: isLoggedIn ? Date.now() : undefined, cookies }); if (cookies) { this.cookies.set(sourceId, cookies); } ...
https://github.com/DaLongZhuaZi/manxia
21e9fcd011816908556bc5570b2ecca1bbe61d3b
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
cancelOrder
取消订单 @param {CancelOrderRequest} params - 取消订单参数 @returns {Promise<NetworkResponse<boolean>>} 是否取消成功
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.post("order/info/cancel", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left cancelOrder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async cancelOrder(params: CancelOrderRequest): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.post("order/info/cancel", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
a36f6505a6eec12d9c08f26a88374e44a30a872b
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/Logger.ets
arkts
getLogLevel
获取当前文件日志写入级别
static getLogLevel(): LogLevel { return Logger.fileLogLevel; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLogLevel 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 LogLevel A...
static getLogLevel(): LogLevel { return Logger.fileLogLevel; }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
76b71799f7588c693fb1af1f56b92ab06f5289e9
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
init
初始化存储
static async init(context: common.UIAbilityContext): Promise<void> { try { SearchHistoryManager.context = context SearchHistoryManager.preferencesStore = await preferences.getPreferences( context, SearchHistoryManager.STORAGE_NAME ) console.info('[SearchHistory] 存储初始化成功') ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig...
static async init(context: common.UIAbilityContext): Promise<void> { try { SearchHistoryManager.context = context SearchHistoryManager.preferencesStore = await preferences.getPreferences( context, SearchHistoryManager.STORAGE_NAME ) console.info('[SearchHistory] 存储初始化成功') ...
https://github.com/cpdd5201314/harmonyOS-music-app
3ada7c5c6c6ff1bf483f4fed1fc6a88f173a4c55
github
dingzhilin1990/zhilinclaw
examples/WeatherPlugin.ets
arkts
onEnable
插件启用时注册技能
async onEnable(): Promise<void> { console.log('[WeatherPlugin] 插件启用中...'); // 获取事件总线并注册技能 // 实际使用中通过核心系统注入 this.eventBus = new EventBus(); this.skill = new WeatherQuerySkill(this.eventBus); console.log('[WeatherPlugin] 天气查询技能已就绪'); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onEnable 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#ge...
async onEnable(): Promise<void> { console.log('[WeatherPlugin] 插件启用中...'); // 获取事件总线并注册技能 // 实际使用中通过核心系统注入 this.eventBus = new EventBus(); this.skill = new WeatherQuerySkill(this.eventBus); console.log('[WeatherPlugin] 天气查询技能已就绪'); }
https://github.com/dingzhilin1990/zhilinclaw
6544b1db16180a26aee37f28a4b268fbec838526
github
openharmony-sig/applications_calculator
common/src/main/ets/util/DateUtil.ets
arkts
getInstance
single instance @return instance
public static getInstance(): DateUtil { if (DateUtil.instance == null) { DateUtil.instance = new DateUtil(); } return DateUtil.instance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): DateUtil { if (DateUtil.instance == null) { DateUtil.instance = new DateUtil(); } return DateUtil.instance; }
https://gitee.com/openharmony-sig/applications_calculator.git
b4755b45cbd2a80c511089b39a8931d8d170bbb2
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/DuplicateDetection/DuplicateDetectionService.ets
arkts
getCandidates
获取候选内容列表
private async getCandidates(input: DuplicateCheckInput, config: DuplicateDetectionConfig): Promise<DuplicateCandidateItem[]> { const candidates: DuplicateCandidateItem[] = []; const typesToCheck = this.getContentTypesToCheck(input.contentType, config.checkScope); logger.info(TAG, `getCandidates: 检查类型=[${...
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 getCandidates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left :...
private async getCandidates(input: DuplicateCheckInput, config: DuplicateDetectionConfig): Promise<DuplicateCandidateItem[]> { const candidates: DuplicateCandidateItem[] = []; const typesToCheck = this.getContentTypesToCheck(input.contentType, config.checkScope); logger.info(TAG, `getCandidates: 检查类型=[${...
https://github.com/DaLongZhuaZi/manxia
f819b57fa5c22b76283fbbe12db25c5b5b95b90a
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/display/TextClockDemo.ets
arkts
applyContent
返回指定的自定义 TextClock
applyContent(): WrappedBuilder<[TextClockConfiguration]> { return wrapBuilder(buildTextClock) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#L...
applyContent(): WrappedBuilder<[TextClockConfiguration]> { return wrapBuilder(buildTextClock) }
https://github.com/webabcd/HarmonyDemo
4fc540c0fbfd0c3909a8e0f95c372d13b7fd5927
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
setDecorButtonStyle
Sets title bar control button look (minimize / maximize / close) for free-window style on PC. @param style Decorator button style; must run on a valid main window.
setDecorButtonStyle(style: window.DecorButtonStyle): void { if (this.mainWindow === undefined) { Logger.error('setDecorButtonStyle: mainWindow is undefined'); return; } try { this.mainWindow.setDecorButtonStyle(style); } catch (error) { let err = error as BusinessError; L...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDecorButtonStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left style AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left window A...
setDecorButtonStyle(style: window.DecorButtonStyle): void { if (this.mainWindow === undefined) { Logger.error('setDecorButtonStyle: mainWindow is undefined'); return; } try { this.mainWindow.setDecorButtonStyle(style); } catch (error) { let err = error as BusinessError; L...
https://gitcode.com/HarmonyOS_Samples/MusicHome
b43bc8cdfe8e13b85a057919905ae3233c6b0b47
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets
arkts
inRangeOfView
判断触摸点是否在指定组件范围内 @param componentArea 组件的区域信息 @param touchPoint 触摸点坐标 @returns boolean 返回true表示触摸点在组件范围内
public static inRangeOfView( componentArea: Area, touchPoint: TouchPoint ): boolean { if (!componentArea || !componentArea.position) { return false; } const left = componentArea.position.x as number; const top = componentArea.position.y as number; const right = left + (compon...
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 inRangeOfView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentArea AST#identifier#Right AST#ERROR#Left AST#:#...
public static inRangeOfView( componentArea: Area, touchPoint: TouchPoint ): boolean { if (!componentArea || !componentArea.position) { return false; } const left = componentArea.position.x as number; const top = componentArea.position.y as number; const right = left + (compon...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
dcd796aac59200715979a7d79556915fc4f92219
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/BookOfMoeScraper.ets
arkts
getDetail
获取书籍详情 注意:BookOf.Moe可能没有独立的详情API,使用搜索API获取
public async getDetail(bookId: string): Promise<ScraperDetailResult> { try { logger.info(TAG, `获取BookOf.Moe书籍详情: ${bookId}`); // 尝试使用ID或标题搜索 const searchResult = await this.searchByTitle(bookId); if (searchResult.success && searchResult.results.length > 0) { // 查找匹配的结果 ...
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 getDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:...
public async getDetail(bookId: string): Promise<ScraperDetailResult> { try { logger.info(TAG, `获取BookOf.Moe书籍详情: ${bookId}`); // 尝试使用ID或标题搜索 const searchResult = await this.searchByTitle(bookId); if (searchResult.success && searchResult.results.length > 0) { // 查找匹配的结果 ...
https://github.com/DaLongZhuaZi/manxia
684a5b447659f8645f5af6f2ebdf53f6822d3186
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Int32Array
public sort(): Int32Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as int const b1 = b as double as int as int return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public sort(): Int32Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as int const b1 = b as double as int as int return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4b51aeb7e8ed600fff507e33930867f6b52fa5da
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPAuthManager.ets
arkts
getSessionStatus
获取会话状态
public getSessionStatus(vmName: string): RDPConnectionStatus { const session = this.sessions.get(vmName); return session?.status || RDPConnectionStatus.DISCONNECTED; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSessionStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public getSessionStatus(vmName: string): RDPConnectionStatus { const session = this.sessions.get(vmName); return session?.status || RDPConnectionStatus.DISCONNECTED; }
https://github.com/AetheriumSimulator/qemu-hmos
a41a0b8f6dfd630c2441c727186ac32bdcd33eca
github
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/common/utils/PreferenceUtils.ets
arkts
isExists
判断数据是否存在 @param context 应用上下文 @param name 首选项文件名 @param key 键 @returns true: 存在, false: 不存在
public static isExists(context: Context = new UIContext().getHostContext() as Context, name: string, key: string): boolean { const preferences = PreferenceUtils.getPreferences(context, name) try { return preferences.hasSync(key) } catch (error) { } return false }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#...
public static isExists(context: Context = new UIContext().getHostContext() as Context, name: string, key: string): boolean { const preferences = PreferenceUtils.getPreferences(context, name) try { return preferences.hasSync(key) } catch (error) { } return false }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
990d816d17ad181582ecfd1a88e56b7331868525
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/LRU.ets
arkts
put
Inserts or updates a key-value pair, making it the most recently used. If the cache is at capacity, the least recently used entry is evicted. @param { K } - the key @param { V } - the value @returns { void } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public put(key: K, value: V): void { ConcurrencyHelpers.mutexLock(this.mutex); try { let node: LRUNode<K, V> | undefined = this.map.get(key); if (node !== undefined) { // update existing node.value = value; this.moveToFront(node...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left put AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identi...
public put(key: K, value: V): void { ConcurrencyHelpers.mutexLock(this.mutex); try { let node: LRUNode<K, V> | undefined = this.map.get(key); if (node !== undefined) { // update existing node.value = value; this.moveToFront(node...
https://gitcode.com/iop123123/arkts-static-skills
74bca2f49cd6f018dd38bd26e368fb0933574265
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/DownloadsViewModel.ets
arkts
toggleEditMode
切换编辑模式
toggleEditMode() { this.isEditMode = !this.isEditMode; this.selectedIds.clear(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleEditMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
toggleEditMode() { this.isEditMode = !this.isEditMode; this.selectedIds.clear(); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L52-L55
4b0fca35664a9cc6e5398abeaf8d5cc6b6562cd4
github
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets
arkts
updatePassword
更新密码输入 @param {string} value - 密码值 @returns {void} 无返回值
updatePassword(value: string): void { this.password = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updatePassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
updatePassword(value: string): void { this.password = value; }
https://github.com/Joker-x-dev/CoolMallArkTS
8515b3a151ae5de01814cd7e728be40cf817055f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
registerCustomFontsForUIContext
在指定 UIContext 中重新注册所有自定义字体。
public async registerCustomFontsForUIContext(uiContext: UIContext | null): Promise<void> { await this.registerSavedCustomFonts(uiContext); this.syncToAppStorage(); }
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 registerCustomFontsForUIContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier...
public async registerCustomFontsForUIContext(uiContext: UIContext | null): Promise<void> { await this.registerSavedCustomFonts(uiContext); this.syncToAppStorage(); }
https://github.com/DaLongZhuaZi/manxia
e3356495467110bdd9a99f54e5d179883fe2bac6
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
updateCurState
更新AVSession实例状态 @param {AVSessionUpdateState} updateState 更新状态数据 @returns {void}
updateCurState(updateState: AVSessionUpdateState): void { const newState: string | undefined = updateState.playerState; const newElapsedTime: number | undefined = updateState.curTime; const newLoopMode: number | undefined = updateState.loopMode; logger.info('avsession updateCurState', newState + '', n...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateCurState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left updateState AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AVSessionUpdateState AST#identifie...
updateCurState(updateState: AVSessionUpdateState): void { const newState: string | undefined = updateState.playerState; const newElapsedTime: number | undefined = updateState.curTime; const newLoopMode: number | undefined = updateState.loopMode; logger.info('avsession updateCurState', newState + '', n...
https://gitcode.com/arkui-x/samples
0a5160a60844e75f679984d93d983f14a2cb005a
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onSessionStateChanged
Handle session state changes
private onSessionStateChanged(state: SessionState): void { let stateName = 'UNKNOWN'; switch (state) { case SessionState.DISCONNECTED: stateName = 'DISCONNECTED'; break; case SessionState.CONNECTING: stateName = 'CONNECTING'; break; case SessionState.CONNECTED: stateName = 'CONNECTED'; break...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onSessionStateChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private onSessionStateChanged(state: SessionState): void { let stateName = 'UNKNOWN'; switch (state) { case SessionState.DISCONNECTED: stateName = 'DISCONNECTED'; break; case SessionState.CONNECTING: stateName = 'CONNECTING'; break; case SessionState.CONNECTED: stateName = 'CONNECTED'; break...
https://github.com/tangwengang-del/freerdp-harmonyos
4b356ad4ab8d8f207eb4a751d4aae982f602c98b
github
zhui1234/Navix
entry/src/main/ets/utils/MapIO.ets
arkts
validateGraphData
验证导入的关系图数据
static validateGraphData(data: MapExportData): boolean { if (!data.graph) { return false } const g = data.graph if (g.visualRows <= 0 || g.visualCols <= 0) { return false } if (!Array.isArray(g.nodes) || !Array.isArray(g.edges)) { return false } // 验证节点 const node...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateGraphData 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#Lef...
static validateGraphData(data: MapExportData): boolean { if (!data.graph) { return false } const g = data.graph if (g.visualRows <= 0 || g.visualCols <= 0) { return false } if (!Array.isArray(g.nodes) || !Array.isArray(g.edges)) { return false } // 验证节点 const node...
https://github.com/zhui1234/Navix/blob/df5c3b4c83baa8ecdc9bf26350f9e16492c24d2b/entry/src/main/ets/utils/MapIO.ets#L161-L201
92f49e4b8dad24ff06f20e9d98495e595eb175db
github
Gramony/Gramony
features/home/src/main/ets/utils/push.ets
arkts
shouldRegisterPush
检查是否需要重新注册
async shouldRegisterPush(): Promise<boolean> { try { const lastRegisterTime = await this.getLastRegisterTime(); const now = Date.now(); if (lastRegisterTime === 0) { Logger.debug('shouldRegisterPush: Never registered before'); return true; } const elapsed = now - la...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left shouldRegisterPush AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g...
async shouldRegisterPush(): Promise<boolean> { try { const lastRegisterTime = await this.getLastRegisterTime(); const now = Date.now(); if (lastRegisterTime === 0) { Logger.debug('shouldRegisterPush: Never registered before'); return true; } const elapsed = now - la...
https://github.com/Gramony/Gramony
833d4618604bf067a5d34076473661a58d04a46b
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/AnomalyDetection.ets
arkts
detectByIQR
使用IQR方法检测异常
detectByIQR(value: number, multiplier: number = 1.5): AnomalyDetectionResult { const lowerBound = this.q1 - multiplier * this.iqr; const upperBound = this.q3 + multiplier * this.iqr; const isAnomaly = value < lowerBound || value > upperBound; let score = 0; if (isAnomaly) { if (value > uppe...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left detectByIQR AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AS...
detectByIQR(value: number, multiplier: number = 1.5): AnomalyDetectionResult { const lowerBound = this.q1 - multiplier * this.iqr; const upperBound = this.q3 + multiplier * this.iqr; const isAnomaly = value < lowerBound || value > upperBound; let score = 0; if (isAnomaly) { if (value > uppe...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
893484760202932f24a29f8b23962da5ab7a1b1a
github
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/FileImportManager.ets
arkts
parseCSVLine
解析CSV行(处理逗号在引号内的情况)
private static parseCSVLine(line: string): string[] { const result: string[] = [] let current = '' let inQuotes = false for (let i = 0; i < line.length; i++) { const char = line[i] if (char === '"') { inQuotes = !inQuotes } else if (char === ',' && !inQuotes) { ...
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 parseCSVLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : ...
private static parseCSVLine(line: string): string[] { const result: string[] = [] let current = '' let inQuotes = false for (let i = 0; i < line.length; i++) { const char = line[i] if (char === '"') { inQuotes = !inQuotes } else if (char === ',' && !inQuotes) { ...
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
8dc134a76362ae21d3ff38280dea3645590f3dba
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleNotificationJump
✅ 辅助方法:处理通知跳转逻辑
private handleNotificationJump(want: Want) { if (want && want.parameters && want.parameters['targetPage']) { const targetPage = want.parameters['targetPage'] as string; const eventId = want.parameters['eventId'] as number; // ✅ 使用 logger 输出日志 this.logger.info(`🔔 Notification Clicked! Pre...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleNotificationJump 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#identi...
private handleNotificationJump(want: Want) { if (want && want.parameters && want.parameters['targetPage']) { const targetPage = want.parameters['targetPage'] as string; const eventId = want.parameters['eventId'] as number; // ✅ 使用 logger 输出日志 this.logger.info(`🔔 Notification Clicked! Pre...
https://gitcode.com/openharmony/codelabs
264a4d3afc2bea077240c65ca221330d1d896185
gitcode
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/ScanAccessibility.ets
arkts
requestFocusForAccessibility
Requests accessibility focus for the specified custom ID. @param customId - The custom ID for which accessibility focus is requested. This method checks whether accessibility is enabled and sends an accessibility event containing the custom ID to request focus. If the event is successfully sent, a log message is record...
static requestFocusForAccessibility(customId: string): void { try { if (ScanAccessibility.isOpenAccessibilitySync()) { let eventInfo: accessibility.EventInfo = ({ type: 'requestFocusForAccessibility', bundleName: SampleConstants.BUNDLE_NAME, triggerAction: 'common', ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left requestFocusForAccessibility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left customId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left str...
static requestFocusForAccessibility(customId: string): void { try { if (ScanAccessibility.isOpenAccessibilitySync()) { let eventInfo: accessibility.EventInfo = ({ type: 'requestFocusForAccessibility', bundleName: SampleConstants.BUNDLE_NAME, triggerAction: 'common', ...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
dcecdec497b10dee7e573e94a0e21649cf87984d
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Set.ets
arkts
clear
Deletes all elements from the Set
clear(): void { this.map.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.map.clear(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
95bc97ddd8736a10491d47c8203adff387baf09c
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
setSpeed
设置播报速度 @param speed 速度(0.5-2.0)
public setSpeed(speed: number): void { this.speed = Math.max(0.5, Math.min(2.0, speed)); console.log('[VoiceGuide] 播报速度:', this.speed); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left speed AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public setSpeed(speed: number): void { this.speed = Math.max(0.5, Math.min(2.0, speed)); console.log('[VoiceGuide] 播报速度:', this.speed); }
https://github.com/LJ666-ui/harmony-health-care
bd0f374bc21a13b0c1e311b0a37306a09fa7ca42
github
HarmonyOS_Samples/BestPracticeSnippets
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
setDataArray
Set water flow data array. @param {ProductItem[]} productDataArray Displaying water flow Data.
public setDataArray(productDataArray: MediaItem[]): void { this.dataArray = productDataArray; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDataArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left MediaIt...
public setDataArray(productDataArray: MediaItem[]): void { this.dataArray = productDataArray; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
bed71fef1278910a87002afcd572a9a21829611c
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setOffset
弹窗相对alignment所在位置的偏移量 @param offset @returns
setOffset(offset?: Offset): Builder { this.dialogOptions.offset = offset return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Offset AST#identifi...
setOffset(offset?: Offset): Builder { this.dialogOptions.offset = offset return this }
https://github.com/wuba/omni-ui
2c9a869fcd1fa7cd0ca75d409d08821d630acf5f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
from
Creates a new `Array` instance from an `ArrayLike` object. @param { ArrayLike<T> } arr An array-like object to convert to an array. @returns { Array<T> } A new Array instance containing the elements from the array-like object. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from<T>(arr: ArrayLike<T>): Array<T> { const ret: Array<T> = new Array<T>(arr.length) let i: int = 0 iteratorForEach<T>(arr.$_iterator(), (x: T): void => { ret[i] = x i += 1 }) return ret }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#...
public static from<T>(arr: ArrayLike<T>): Array<T> { const ret: Array<T> = new Array<T>(arr.length) let i: int = 0 iteratorForEach<T>(arr.$_iterator(), (x: T): void => { ret[i] = x i += 1 }) return ret }
https://gitcode.com/iop123123/arkts-static-skills
bc77b7f558840a511541655ef5010866304a1422
gitcode
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
playButtonClick
播放按钮点击音效
static playButtonClick(): void { AudioManager.getInstance().playSound(SoundType.BUTTON_CLICK); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left playButtonClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres...
static playButtonClick(): void { AudioManager.getInstance().playSound(SoundType.BUTTON_CLICK); }
https://github.com/the-wwyang/kids-learning-app
5fd768acfdce818c5547ab83ea883867d126cf5b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
from
Creates an array from a set of type std.core.Set<int>. @param { Set<int> } set - A set object to convert to an array. @returns { Uint8Array } - A new Uint8Array @throws { RangeError } - Input parameter error. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(set: Set<int>): Uint8Array { const length = set.size; const result = new Uint8Array(length) let iter = set.$_iterator() for (let i:int = 0; i < length; ++i) { const x = iter.next() if (x.done) { throw new RangeError('Wrong Le...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ...
public static from(set: Set<int>): Uint8Array { const length = set.size; const result = new Uint8Array(length) let iter = set.$_iterator() for (let i:int = 0; i < length; ++i) { const x = iter.next() if (x.done) { throw new RangeError('Wrong Le...
https://gitcode.com/iop123123/arkts-static-skills
ebf57d28adab2e6fa1e1fcfceb2e3faa069d8304
gitcode
admundhou/mshijie
product/default/src/main/ets/controller/VideoController.ets
arkts
initProgressThis
Transfer this on the playProgress page. @param progressThis PlayProgress this object.
initProgressThis(progressThis) { this.progressThis = progressThis; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initProgressThis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left progressThis AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Righ...
initProgressThis(progressThis) { this.progressThis = progressThis; }
https://github.com/admundhou/mshijie
ca22ec58e04ec305f535e35f104dd078748c6147
github
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/service/AbstractService.ets
arkts
enableAutoReport
开启自动周期上报属性 @param reportInterval 上报周期,单位ms
public enableAutoReport(reportInterval: number): void { if (this.timer != null) { LogUtil.error("timer is already enabled"); return; } this.timer = setInterval(() => { this.firePropertiesChanged() }, reportInterval) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableAutoReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reportInterval AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
public enableAutoReport(reportInterval: number): void { if (this.timer != null) { LogUtil.error("timer is already enabled"); return; } this.timer = setInterval(() => { this.firePropertiesChanged() }, reportInterval) }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
65cce7f13bef6bbc550fa39d1570f98ef67d45b5
github
openharmony-sig/FastBle
library/src/main/ets/bluetooth/BleConnector.ets
arkts
handleCharacteristicNotifyCallback
************************************* Handle call back ***************************************** notify
private handleCharacteristicNotifyCallback(bleNotifyCallback: BleNotifyCallback, uuid_notify: string): void { if (bleNotifyCallback != null) { this.notifyMsgInit(); bleNotifyCallback.setKey(uuid_notify); bleNotifyCallback.setHandler(this.mHandler); this.mBleBluetooth.addNotifyCallback(uuid...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleCharacteristicNotifyCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bleNotifyCallback AST#identifier#Right AST#:#Left : AST#:#Right A...
private handleCharacteristicNotifyCallback(bleNotifyCallback: BleNotifyCallback, uuid_notify: string): void { if (bleNotifyCallback != null) { this.notifyMsgInit(); bleNotifyCallback.setKey(uuid_notify); bleNotifyCallback.setHandler(this.mHandler); this.mBleBluetooth.addNotifyCallback(uuid...
https://gitee.com/openharmony-sig/FastBle.git
b99931a93dd08c28414d18ff86934fc219c33632
gitee
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/batchselectcontacts/BatchSelectContactsPresenter.ets
arkts
initContactsList
Initializing Contact List Data
initContactsList() { HiLog.i(TAG, 'initContactsList start!'); let favoriteForm: Favorite = { favorite: 0, editContact: 0 } if (0 === this.addFavorite) { favoriteForm.favorite = 0; } else { favoriteForm.favorite = -1; } favoriteForm.editContact = this.editContact ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initContactsList 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...
initContactsList() { HiLog.i(TAG, 'initContactsList start!'); let favoriteForm: Favorite = { favorite: 0, editContact: 0 } if (0 === this.addFavorite) { favoriteForm.favorite = 0; } else { favoriteForm.favorite = -1; } favoriteForm.editContact = this.editContact ...
https://gitee.com/openharmony/applications_contacts.git
b4ccdc07c5c1f15d2842bc7944ca3743ddc36abb
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/components/ImageLoadStateManager.ets
arkts
initPage
初始化页面状态
initPage(pageId: string, pageIndex: number): void { if (!this.pageStates.has(pageId)) { const state: PageState = { pageId, pageIndex, loadState: ImageLoadState.IDLE, pixelMap: null }; this.pageStates.set(pageId, state); this.updateLoadState(pageId, ImageLoad...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#...
initPage(pageId: string, pageIndex: number): void { if (!this.pageStates.has(pageId)) { const state: PageState = { pageId, pageIndex, loadState: ImageLoadState.IDLE, pixelMap: null }; this.pageStates.set(pageId, state); this.updateLoadState(pageId, ImageLoad...
https://github.com/DaLongZhuaZi/manxia
5aa648e9302b0c3c749c7c7ad1fc76d65c7acf81
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractController.ets
arkts
getSupportedButtonFlags
获取支持的按钮标志
getSupportedButtonFlags(): number { return this.supportedButtonFlags; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSupportedButtonFlags 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 AS...
getSupportedButtonFlags(): number { return this.supportedButtonFlags; }
https://github.com/AlkaidLab/moonlight-harmony
7f2b2a8fae54771fe4786abeb3c6b38a067dc019
github
ibestservices/ibest-ui
library/src/main/ets/components/stepper/index.ets
arkts
handleInputNumChange
value变化
handleInputNumChange(trigger: string, val: string) { if (val == '') { this.validateTimeId = setTimeout(() => { if (this.validateTime !== 0) { this.inputNumValue = this.preValue this.inputValueChange() if(trigger != 'init'){ this.onChange(this.value) } } this.handleSetStepperB...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleInputNumChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left trigger AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig...
handleInputNumChange(trigger: string, val: string) { if (val == '') { this.validateTimeId = setTimeout(() => { if (this.validateTime !== 0) { this.inputNumValue = this.preValue this.inputValueChange() if(trigger != 'init'){ this.onChange(this.value) } } this.handleSetStepperB...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/stepper/index.ets#L197-L233
b4920271cd640ffd0782649ada6fcdbca883a7f4
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
createVideoEncoder
---- Phase 3: 视频编码器管理 + 一体化发送 ---- 创建 Rust 层内部视频编码器 H264 硬编码失败时自动回退到 VP8 软编码 @returns 实际使用的编解码器名称("H264" 或 "VP8"),失败返回空字符串
public createVideoEncoder(config: NapiVideoEncoderConfig, codec: string): string { if (!this.client) return ''; return this.client.createVideoEncoder(config, codec); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createVideoEncoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public createVideoEncoder(config: NapiVideoEncoderConfig, codec: string): string { if (!this.client) return ''; return this.client.createVideoEncoder(config, codec); }
https://github.com/tdcare/tdwebrtc
8f6f44b626a44d6c92bd21111c50f7b448d66174
github
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
startShell
Start an interactive shell session. Uses a PTY channel. Data from the server will be emitted via 'data' event.
async startShell(cols: number = 80, rows: number = 24): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); if (this.state !== SshState.CONNECTED) throw new SshError('Client is not connected', SshErrorCode.UNKNOWN); const onData = (data: string) => { t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startShell AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cols AST#identifier#Right AST#type_annotation#Lef...
async startShell(cols: number = 80, rows: number = 24): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); if (this.state !== SshState.CONNECTED) throw new SshError('Client is not connected', SshErrorCode.UNKNOWN); const onData = (data: string) => { t...
https://github.com/UnbalancedCat/ohos-ssh-core
f1d295f22e1ba85102d751a9c3cf51750243a755
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
clearCachedImageData
清除缓存的图片数据
clearCachedImageData(): void { this.cachedImageData = null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearCachedImageData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme...
clearCachedImageData(): void { this.cachedImageData = null; }
https://github.com/AlkaidLab/moonlight-harmony
00b6339c3753865f30787b31047f552efa80daa6
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets
arkts
startAlarm
Start alarm @param alarmInfo Alarm information
async startAlarm(alarmInfo: AlarmInfo): Promise<void> { if (!alarmInfo?.id) { LogUtil.error(TAG, 'Execute method startAlarm failed, params is incorrect.'); return; } const isFiring = await AlarmStateManager.isFiring(); if (isFiring) { const firingAlarmId = await AlarmStateManager.get...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startAlarm AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST...
async startAlarm(alarmInfo: AlarmInfo): Promise<void> { if (!alarmInfo?.id) { LogUtil.error(TAG, 'Execute method startAlarm failed, params is incorrect.'); return; } const isFiring = await AlarmStateManager.isFiring(); if (isFiring) { const firingAlarmId = await AlarmStateManager.get...
https://gitee.com/openharmony-sig/applications_clock.git
c93eba18395fbcbfe5526a09565e65394454dc74
gitee
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
getFileSizeInBytes
获取文件大小(字节)- 支持 URI 和普通路径 @param filePath 文件路径或 URI @returns 文件大小(字节)
static async getFileSizeInBytes(filePath: string): Promise<number> { try { if (LubanUtils.isUri(filePath)) { // 对于 URI,通过 fs.open 获取文件信息 LogUtil.debug(`📏 获取 URI 文件大小: ${filePath}`); const file = await fs.open(filePath, fs.OpenMode.READ_ONLY); try { const stat = awa...
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 getFileSizeInBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#L...
static async getFileSizeInBytes(filePath: string): Promise<number> { try { if (LubanUtils.isUri(filePath)) { // 对于 URI,通过 fs.open 获取文件信息 LogUtil.debug(`📏 获取 URI 文件大小: ${filePath}`); const file = await fs.open(filePath, fs.OpenMode.READ_ONLY); try { const stat = awa...
https://github.com/kumaleap/ArkLuban
e9c6bff8e28b3e1da0374e7c3cbe16444f29704f
github
yangyongzhen/hmmovie
entry/src/main/ets/utils/EfAVPlayer.ets
arkts
stop
用于停止播放。
async stop() { const avPlayer = await this.init(); await avPlayer.stop(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stop AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST...
async stop() { const avPlayer = await this.init(); await avPlayer.stop(); }
https://github.com/yangyongzhen/hmmovie
97a6015688a2661aede3dd74ad46d1ab36b00097
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
subarray
Creates a Uint8Array with the same ArrayBuffer @param begin start index, inclusive @returns new Uint8Array with the same ArrayBuffer
public subarray(begin: number): Uint8Array { return this.subarray(begin as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number): Uint8Array { return this.subarray(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
38a2f16ff76e55535c824a4a2ac9e809241cde15
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
codePointCount
Returns the amount of full codepoints between begin and end indexes. Characters outside the range are not counted, even if the range ends in the middle of a surrogate pair. @param { number } begin index to start from @param { number } end past the ending index @throws { StringIndexOutOfBoundsError } if begin is negativ...
public codePointCount(begin: number, end: number): number { return this.codePointCount(begin.toInt(), end.toInt()) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left codePointCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public codePointCount(begin: number, end: number): number { return this.codePointCount(begin.toInt(), end.toInt()) }
https://gitcode.com/iop123123/arkts-static-skills
cbd8abb856ea8fa1141367ba4b50abda0fe27edb
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
copySettings
复制设置对象
private copySettings(source: FontSettings): FontSettings { return { appFontType: source.appFontType, appSystemFontId: source.appSystemFontId, appCustomFontId: source.appCustomFontId, appFontSize: source.appFontSize, novelFontType: source.novelFontType, novelSystemFontId: source...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left copySettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private copySettings(source: FontSettings): FontSettings { return { appFontType: source.appFontType, appSystemFontId: source.appSystemFontId, appCustomFontId: source.appCustomFontId, appFontSize: source.appFontSize, novelFontType: source.novelFontType, novelSystemFontId: source...
https://github.com/DaLongZhuaZi/manxia
9c956c5fb5c0668d64c4de07a27700455624a824
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
hideCommentModal
隐藏商品评论弹窗 @returns {void} 无返回值
hideCommentModal(): void { this.commentModalVisible = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hideCommentModal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
hideCommentModal(): void { this.commentModalVisible = false; }
https://github.com/Joker-x-dev/CoolMallArkTS
0d85a01b404d8be3a50b73f0de5a15d514b71166
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
isSimActive
获取指定卡槽SIM卡是否激活。使用Promise异步回调。 @param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 @returns
static async isSimActive(slotId: number): Promise<boolean> { return sim.isSimActive(slotId); }
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 isSimActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#:#Left : AST...
static async isSimActive(slotId: number): Promise<boolean> { return sim.isSimActive(slotId); }
https://github.com/tdcare/tdwebrtc
c518bf0fc8934d1bd0c982f5dc59e341ed61ca15
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/ConfigFlow.ui.test.ets
arkts
tapConfigSaveButton
Tap ConfigPage circular back (`ConfigBackButton`) with light scroll nudges if the fixed chrome is temporarily off-screen.
async function tapConfigSaveButton(driver: Driver): Promise<void> { try { for (let attempt: number = 0; attempt < 4; attempt++) { const comp: Component | null = await driver.findComponent(ON.id('ConfigBackButton')); if (comp !== null) { await comp.click(); return; } ...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left tapConfigSaveButton AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right A...
async function tapConfigSaveButton(driver: Driver): Promise<void> { try { for (let attempt: number = 0; attempt < 4; attempt++) { const comp: Component | null = await driver.findComponent(ON.id('ConfigBackButton')); if (comp !== null) { await comp.click(); return; } ...
https://github.com/terryma2024/happyword
d7a8bf79eda8564c54f58565f5b0aa2037ac853b
github
axiomaster/bonio
harmonyos/entry/src/main/ets/node/NodeRuntime.ets
arkts
<arrow>
smsAvailable
() => true, // hasRecordAudioPermission
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#=>#Left => AST#=>#Right AST#true#Left true AST#true#Right AST#arrow_function#Right AST#,#Left , AST#,#Right AST#ERROR#Right AST#comment#Left // hasRecordAu...
() => true, // hasRecordAudioPermission
https://github.com/axiomaster/bonio
2514aac809cba4d120d1a27aad6787c8d8e63792
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/EventPersistenceManager.ets
arkts
addCollect
==================== 收藏缓存(local_collection_cache)====================
async addCollect(collectType: string, targetId: number, targetTitle: string, targetImage?: string, note?: string): Promise<number> { try { const values: relationalStore.ValuesBucket = {}; values[COLUMN_COLLECT_TYPE] = collectType; values[COLUMN_TARGET_ID] = String(targetId); values[COLUMN_...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addCollect AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left collectType AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async addCollect(collectType: string, targetId: number, targetTitle: string, targetImage?: string, note?: string): Promise<number> { try { const values: relationalStore.ValuesBucket = {}; values[COLUMN_COLLECT_TYPE] = collectType; values[COLUMN_TARGET_ID] = String(targetId); values[COLUMN_...
https://github.com/LJ666-ui/harmony-health-care
b2d7c1202473c86d14144b65e935fbef97521a5f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WindowManager.ets
arkts
getMainWindow
获取当前 Ability 的主窗口。 优先复用 initialize()/registerWindowStageStateMonitor() 保存的 WindowStage, 避免启动期没有 UIContext 时误判为无法获取主窗口。
private static getMainWindow(): window.Window | null { return WindowManager.getMainWindowFromWindowStageRef('WindowManager.getMainWindow'); }
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 getMainWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private static getMainWindow(): window.Window | null { return WindowManager.getMainWindowFromWindowStageRef('WindowManager.getMainWindow'); }
https://github.com/DaLongZhuaZi/manxia
c5002eb231342b11b76b9f114046cbbe65d14d8d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Creates a new Float64Array using initializer @param { FixedArray<Object> } data - initializer @returns { Float64Array } - a new Float64Array @throws { Error } - function not implemented @syscap SystemCapability.Utils.Lang @FaAndStageModel
public of(data: FixedArray<Object>): Float64Array { throw new Error("Float64Array.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public of(data: FixedArray<Object>): Float64Array { throw new Error("Float64Array.of: not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
0235ca6bf50206766d04af3aad7ac93b21f70b67
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/QuestionGenerator.ets
arkts
nextQuestionForWord
Generate a Choice question whose answer is locked to `answerEntry`. Distractors still come from the same-category pool first and fall back to the global pool, mirroring nextQuestion(). Used by PlanQuestionSource so today's adventure can show a specific wordId on Normal/Review/Elite/Boss slots without duplicating logic.
nextQuestionForWord(answerEntry: WordEntry, _lastWordId?: string): Question { const all: WordEntry[] = this.repo.all(); if (all.length < OPTIONS_PER_QUESTION) { throw new Error( `QuestionGenerator: repository has ${all.length} words, need at least ${OPTIONS_PER_QUESTION}` ); } cons...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nextQuestionForWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left answerEntry AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left WordEntry AST#identifier#Right AST#ERROR#Righ...
nextQuestionForWord(answerEntry: WordEntry, _lastWordId?: string): Question { const all: WordEntry[] = this.repo.all(); if (all.length < OPTIONS_PER_QUESTION) { throw new Error( `QuestionGenerator: repository has ${all.length} words, need at least ${OPTIONS_PER_QUESTION}` ); } cons...
https://github.com/terryma2024/happyword
5e75d93aeadce466d7e6578a4cca6c65a6a13dd6
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleAnswerRecorder.ets
arkts
applyAnswerOutcome
The full native per-answer body for the Cocos path, in BattlePage order: 1. medium step advances record nothing ("Do not record learning stats" — onOptionTap's advancedStep early return); 2. encounter for the monster the answer was submitted against (normally a dedup no-op — it was recorded when the monster appeared); ...
applyAnswerOutcome(event: CocosAnswerOutcomeEvent): void { if (event.outcome.advancedStep) { return; } this.recordEncounter(event.preMonsterCatalogIndex); this.recordAnswer(event.answeredWordId, event.outcome.correct); if (event.outcome.monsterDefeated) { this.recordMonsterDefeat(event...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyAnswerOutcome AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CocosAnswerOutcomeEvent AST#identifi...
applyAnswerOutcome(event: CocosAnswerOutcomeEvent): void { if (event.outcome.advancedStep) { return; } this.recordEncounter(event.preMonsterCatalogIndex); this.recordAnswer(event.answeredWordId, event.outcome.correct); if (event.outcome.monsterDefeated) { this.recordMonsterDefeat(event...
https://github.com/terryma2024/happyword
070cc2249098357e70c29ccc24fe37aaa76e5234
github
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/task/HttpProxyCacheServerTask.ets
arkts
performLRUCleanup
执行 LRU 清理操作
private performLRUCleanup(): void { LogUtil.info(`开始 LRU 清理 clientsMap,当前大小: ${this.clientsMap.length}`); // 按访问时间排序,找出最久未使用的客户端 const entries: Array<clientAccessTime> = []; this.clientsAccessTime.forEach((accessTime: number, url: string) => { entries.push({url, accessTime}); }); // 按访...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left performLRUCleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#e...
private performLRUCleanup(): void { LogUtil.info(`开始 LRU 清理 clientsMap,当前大小: ${this.clientsMap.length}`); // 按访问时间排序,找出最久未使用的客户端 const entries: Array<clientAccessTime> = []; this.clientsAccessTime.forEach((accessTime: number, url: string) => { entries.push({url, accessTime}); }); // 按访...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
4a54a7203c6a5bf2db893549977e23ce79c1796c
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
constructor
Creates an Uint8ClampedArray with respect to buf and byteOffset. @param buf data initializer @param byteOffset byte offset from begin of the buf
public constructor(buf: ArrayBuffer, byteOffset: number) { this(buf, byteOffset as int) }
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 buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: number) { this(buf, byteOffset as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
fea67e3252e625bd4cae79206c88fd9e9af0386c
gitee
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
postLogin
========== Step 4: 提交登录 ==========
async postLogin( username: string, password: string, fields: CasFormFields, onProgress?: (p: LoginProgress) => void ): Promise<boolean> { if (onProgress) { onProgress({ step: 'login', message: '正在提交登录...', percent: 60 }); } const encryptedPwd: string = await this.encryptPassword(p...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left postLogin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#t...
async postLogin( username: string, password: string, fields: CasFormFields, onProgress?: (p: LoginProgress) => void ): Promise<boolean> { if (onProgress) { onProgress({ step: 'login', message: '正在提交登录...', percent: 60 }); } const encryptedPwd: string = await this.encryptPassword(p...
https://github.com/PollenWang6/HiXD
6d702666575f69fef3b37f656c27b190f9b37033
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypedEntityData.ets
arkts
setNumber
设置数字类型的属性值(自动触发 UI 刷新) @param key 属性名 @param value 属性值
setNumber(key: string, value: number): void { this.data.set(key, value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#...
setNumber(key: string, value: number): void { this.data.set(key, value) }
https://github.com/offlinecat-dev/OCNetORM
230d1d90bb73f2ea0d482ee10a6bd75b62704d5b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/config/RouteConfigManager.ets
arkts
hasRoute
验证路由是否存在 @param path 路由路径 @returns boolean
public hasRoute(path: string): boolean { // 标准化路径 const normalizedPath = this.normalizePath(path); return this.routes.has(normalizedPath); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
public hasRoute(path: string): boolean { // 标准化路径 const normalizedPath = this.normalizePath(path); return this.routes.has(normalizedPath); }
https://github.com/LJ666-ui/harmony-health-care
788c062ba78e1e126ae3a2ee55e1dbf4316dba72
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/Transformer.ets
arkts
prepareMatrixOffset
Prepares the matrix that contains all offsets. @param inverted
public prepareMatrixOffset(inverted: boolean) { this.mMatrixOffset.reset(); // offset.postTranslate(mOffsetLeft, getHeight() - mOffsetBottom); if (!inverted) this.mMatrixOffset.postTranslate(this.mViewPortHandler.offsetLeft(), this.mViewPortHandler.getChartHeight() - this.mViewPortHandler...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left prepareMatrixOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inverted AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST...
public prepareMatrixOffset(inverted: boolean) { this.mMatrixOffset.reset(); // offset.postTranslate(mOffsetLeft, getHeight() - mOffsetBottom); if (!inverted) this.mMatrixOffset.postTranslate(this.mViewPortHandler.offsetLeft(), this.mViewPortHandler.getChartHeight() - this.mViewPortHandler...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f197ecf4d937b22c22b493a761df33f4c94783bd
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
convertWebViewChaptersToMangaChapters
转换WebView章节为MangaChapter格式 [修复] 使用原始章节的number字段,并进行智能排序
private convertWebViewChaptersToMangaChapters(chapters: WebViewChapterInfo[]): MangaChapter[] { const mangaChapters: MangaChapter[] = []; for (let i = 0; i < chapters.length; i++) { const ch = chapters[i]; // [修复] 使用原始章节的number字段,如果没有则从标题提取或使用索引 let chapterNumber = i; if (ch.numbe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertWebViewChaptersToMangaChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
private convertWebViewChaptersToMangaChapters(chapters: WebViewChapterInfo[]): MangaChapter[] { const mangaChapters: MangaChapter[] = []; for (let i = 0; i < chapters.length; i++) { const ch = chapters[i]; // [修复] 使用原始章节的number字段,如果没有则从标题提取或使用索引 let chapterNumber = i; if (ch.numbe...
https://github.com/DaLongZhuaZi/manxia
b6c9a0da2d5dbe7b0efce8868e824d52ac274dc7
github
kumaleap/ArkSwipeDeck
library/src/main/ets/utils/AnimationUtils.ets
arkts
createSpringBackAnimation
创建弹回动画参数 @returns 弹回动画参数
static createSpringBackAnimation(): AnimationParams { return { translateX: 0, translateY: 0, rotation: 0, scale: 1, opacity: 1 }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSpringBackAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#L...
static createSpringBackAnimation(): AnimationParams { return { translateX: 0, translateY: 0, rotation: 0, scale: 1, opacity: 1 }; }
https://github.com/kumaleap/ArkSwipeDeck
b2d3f5ef2d313160a7282db47d0e0ea466f9e616
github
LZZLHY/hlib
entry/src/main/ets/api/ZLibraryClient.ets
arkts
getMostPopular
站内最热门书目(全站统计,**不按用户语言过滤**)。 不推荐直接给首页用——zlib 服务端这个 endpoint 永远返回全站最热(英文为主), cookie/Accept-Language/languages query 都被忽略。建议使用 `getPopularByLanguage` 替代。
async getMostPopular(languages?: string[]): Promise<Book[]> { const query: QueryParams = {}; if (languages !== undefined && languages.length > 0) { query['languages'] = languages; } const json = await this.http.get<BooksEnvelope>('/eapi/book/most-popular', query); ZLibraryClient.assertOk(jso...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMostPopular AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left languages AST#identifier#Right AST#?#Left ? AST#?#Right AST#type...
async getMostPopular(languages?: string[]): Promise<Book[]> { const query: QueryParams = {}; if (languages !== undefined && languages.length > 0) { query['languages'] = languages; } const json = await this.http.get<BooksEnvelope>('/eapi/book/most-popular', query); ZLibraryClient.assertOk(jso...
https://github.com/LZZLHY/hlib
0d47565e724cf0e640a6bbb9902f861c0beace8e
github
SakuraNeko/Deepseek-Harmony
entry/src/main/ets/pages/Index.ets
arkts
onDeepLinkChange
响应热启动时 onNewWant 设置的 deepLinkUrl 变化(onPageShow 仅在冷/温启动触发)
onDeepLinkChange(): void { if (this.deepLinkUrl && this.deepLinkUrl !== '') { hilog.info(DOMAIN, TAG, 'DeepLink change detected: %{public}s', this.deepLinkUrl); this.navigateToUrl(this.deepLinkUrl); AppStorage.set<string>('deepLinkUrl', ''); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDeepLinkChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio...
onDeepLinkChange(): void { if (this.deepLinkUrl && this.deepLinkUrl !== '') { hilog.info(DOMAIN, TAG, 'DeepLink change detected: %{public}s', this.deepLinkUrl); this.navigateToUrl(this.deepLinkUrl); AppStorage.set<string>('deepLinkUrl', ''); } }
https://github.com/SakuraNeko/Deepseek-Harmony
b42a853c655c90a55ea28dea46fd30849d5dec24
github