nwo stringclasses 449
values | path stringlengths 9 173 | language stringclasses 1
value | identifier stringlengths 1 53 | docstring stringlengths 5 4.13k | function stringlengths 10 87.2k | ast_function stringlengths 351 354k | obf_function stringlengths 10 87.2k | url stringlengths 30 175 | function_sha stringlengths 40 40 | source stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Types/StatusEnums.ets | arkts | toDownloadStatus | 将字符串转换为DownloadStatus枚举 | static toDownloadStatus(status: string): DownloadStatus {
const normalizedStatus = status.toUpperCase().trim();
switch (normalizedStatus) {
case 'PENDING':
case '等待中':
case 'WAITING':
return DownloadStatus.PENDING;
case 'DOWNLOADING':
case '下载中':
case ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toDownloadStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static toDownloadStatus(status: string): DownloadStatus {
const normalizedStatus = status.toUpperCase().trim();
switch (normalizedStatus) {
case 'PENDING':
case '等待中':
case 'WAITING':
return DownloadStatus.PENDING;
case 'DOWNLOADING':
case '下载中':
case ... | https://github.com/DaLongZhuaZi/manxia | ed5fa4a0eed60a4cd63d4c0d92980c5a24eca435 | github |
751496032/ZRouter | RouterApi/src/main/ets/animation/NavAnimationMgr.ets | arkts | setNavBgColor | 设置背景色
@param color 颜色
@returns | public setNavBgColor(color: ResourceColor) {
this._navBgColor = color
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNavBgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left R... | public setNavBgColor(color: ResourceColor) {
this._navBgColor = color
return this
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L228-L231 | 2b3d92e4f33206d79ccf18ee8b350c5167af1025 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | setBracketPairs | ==================== Bracket Pair Highlight ==================== | setBracketPairs(openChars: number[], closeChars: number[]): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.editorSetBracketPairs(this.handle, openChars, closeChars));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBracketPairs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left openChars AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#[#Left [ AST#[#Right AST#]#... | setBracketPairs(openChars: number[], closeChars: number[]): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.editorSetBracketPairs(this.handle, openChars, closeChars));
} | https://github.com/FinalScave/SweetEditor | 3742251c4173a7a7f97e4fe74c94eea9261906e0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | sort | Sorts in-place
@param { function } [compareFn] - comparator _ used to determine the order of the elements.
compareFn returns a negative value if first argument is less than second argument,
zero if they're equal and a positive value otherwise.
@returns { this } - sorted Uint8ClampedArray
@syscap SystemCapability.Utils... | public sort(compareFn?: (a: number, b: number) => int): this {
if (compareFn == undefined) {
this.sort()
return this
}
let cmp = (l: int, r: int): int => {
return compareFn!(l, r)
}
const MAX_SHORT_LENGTH = 24
if (this.lengthInt > ... | 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#binary_expression#Left AST#call_expression#Left AST#identifier#Left compareFn AST#identifi... | public sort(compareFn?: (a: number, b: number) => int): this {
if (compareFn == undefined) {
this.sort()
return this
}
let cmp = (l: int, r: int): int => {
return compareFn!(l, r)
}
const MAX_SHORT_LENGTH = 24
if (this.lengthInt > ... | https://gitcode.com/iop123123/arkts-static-skills | 0aa4da025e386f0c704dceea780facd74b1877b5 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | findElementsBySingleSelector | 使用单个选择器查找元素
支持: tag, .class, #id, tag.class, 空格分隔的后代选择器
支持索引选择器: .0, .-1, [0,2,4], [!0,1], [0:10], [0:10:2]
支持Legado特殊选择器: class.xxx, tag.xxx, id.xxx, text.xxx, children | private findElementsBySingleSelector(html: string, selector: string): string[] {
// 先检查是否是CSS标准选择器格式(.class 或 #id)
// 这些选择器不应该被parseIndexSelector处理,因为.后面不是数字
const isCssClassSelector = selector.startsWith('.') && !/^\.\d/.test(selector);
const isCssIdSelector = selector.startsWith('#');
// 检查... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findElementsBySingleSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private findElementsBySingleSelector(html: string, selector: string): string[] {
// 先检查是否是CSS标准选择器格式(.class 或 #id)
// 这些选择器不应该被parseIndexSelector处理,因为.后面不是数字
const isCssClassSelector = selector.startsWith('.') && !/^\.\d/.test(selector);
const isCssIdSelector = selector.startsWith('#');
// 检查... | https://github.com/DaLongZhuaZi/manxia | 461417fa97aed13ba97e9931e6a10e848f7056ad | github |
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | entry/src/main/ets/utils/ExpressionEvaluator.ets | arkts | formatAsCardValue | 格式化数字为扑克牌显示值
@param num 数字
@returns 扑克牌显示值 (A, 2-10, J, Q, K) | static formatAsCardValue(num: number): string {
switch (num) {
case 1: return 'A';
case 11: return 'J';
case 12: return 'Q';
case 13: return 'K';
default: return num.toString();
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatAsCardValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static formatAsCardValue(num: number): string {
switch (num) {
case 1: return 'A';
case 11: return 'J';
case 12: return 'Q';
case 13: return 'K';
default: return num.toString();
}
} | https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp | 9deca76e41155969391b552424ab7ca8f126ff6c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | parseClientRefreshRateX100 | 解析帧率字符串并返回 clientRefreshRateX100
用于 NTSC 帧率支持 (如 119.88 Hz) | private parseClientRefreshRateX100(fpsStr: string): number {
// 检查是否是自定义帧率
if (fpsStr.startsWith('自定义:')) {
const customFps = parseInt(fpsStr.split(':')[1]);
return isNaN(customFps) ? 6000 : customFps * 100;
}
switch (fpsStr) {
case '30 FPS':
return 3000;
case '60 ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseClientRefreshRateX100 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fpsStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | private parseClientRefreshRateX100(fpsStr: string): number {
// 检查是否是自定义帧率
if (fpsStr.startsWith('自定义:')) {
const customFps = parseInt(fpsStr.split(':')[1]);
return isNaN(customFps) ? 6000 : customFps * 100;
}
switch (fpsStr) {
case '30 FPS':
return 3000;
case '60 ... | https://github.com/AlkaidLab/moonlight-harmony | dd1ed25ba9a9f33d88b5aa3651dcde340375b790 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CommonRepository.ets | arkts | getParam | 获取系统参数配置
@param key 参数键
@returns 系统参数配置值 | async getParam(key: string): Promise<NetworkResponse<string>> {
return this.networkDataSource.getParam(key);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getParam AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async getParam(key: string): Promise<NetworkResponse<string>> {
return this.networkDataSource.getParam(key);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 826eae619c4adbee9372a607954f687b9a87197b | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets | arkts | rebuildIndex | Index
Rebuilds the index of all chunks. | async rebuildIndex() {
if (this.isRebuilding) {
meow(`Rebuilding. Rejected rebuild`, 'meowHistorian][rebuildIndex', meowLevel.WARN);
return false;
}
this.isRebuilding = true;
await clearDirectory(`${this.indexBasePath}`); // Clear all built index files.
await buildAllIndexToDisk(`${th... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left rebuildIndex 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#{#R... | async rebuildIndex() {
if (this.isRebuilding) {
meow(`Rebuilding. Rejected rebuild`, 'meowHistorian][rebuildIndex', meowLevel.WARN);
return false;
}
this.isRebuilding = true;
await clearDirectory(`${this.indexBasePath}`); // Clear all built index files.
await buildAllIndexToDisk(`${th... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 175fd2b1a804af87208e7d6feced5e0cecab8ed8 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/AuthenticationHandler.ets | arkts | validateToken | 验证令牌是否有效 | async validateToken(token?: string): Promise<boolean> {
try {
const tokenToValidate = token || await this.getStoredToken();
if (!tokenToValidate) {
return false;
}
// 根据认证类型验证
switch (this.config.type) {
case 'jwt':
const leeway = this.config.tokenLeeway ||... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left validateToken AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left token AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_anno... | async validateToken(token?: string): Promise<boolean> {
try {
const tokenToValidate = token || await this.getStoredToken();
if (!tokenToValidate) {
return false;
}
// 根据认证类型验证
switch (this.config.type) {
case 'jwt':
const leeway = this.config.tokenLeeway ||... | https://github.com/DaLongZhuaZi/manxia | 997ae7ffdde00c071a5cbc2ac9cb0c5408eb4d9f | github |
the-wwyang/kids-learning-app | src/main/ets/services/LearningService.ets | arkts | getAllProgress | 获取所有模块学习进度 | public async getAllProgress(): Promise<LearningProgress[]> {
return await appStorage.getAllLearningProgress();
} | 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 getAllProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | public async getAllProgress(): Promise<LearningProgress[]> {
return await appStorage.getAllLearningProgress();
} | https://github.com/the-wwyang/kids-learning-app | ad49ad221b29cfdbac4641b5d0a939cfc698b93e | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/pages/StatisticsPage.ets | arkts | formatYAxisLabel | 格式化Y轴标签 | formatYAxisLabel(value: number): string {
if (value >= 10000 || value <= -10000) {
return (value / 10000).toFixed(1) + 'w';
} else if (value >= 1000 || value <= -1000) {
return (value / 1000).toFixed(1) + 'k';
} else {
return value.toFixed(0);
}
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatYAxisLabel 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... | formatYAxisLabel(value: number): string {
if (value >= 10000 || value <= -10000) {
return (value / 10000).toFixed(1) + 'w';
} else if (value >= 1000 || value <= -1000) {
return (value / 1000).toFixed(1) + 'k';
} else {
return value.toFixed(0);
}
... | https://github.com/qiuhaotc/HarmonyOSPlayground | 7d0c49f70b38468000315b5f2818dccecf8e4dec | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test44_original_index.ets | arkts | isLeapYear | --- Leap year check --- | function isLeapYear(year: number): boolean {
let div4: boolean = year % 4 === 0;
let div100: boolean = year % 100 === 0;
let div400: boolean = year % 400 === 0;
if (div4 && !div100) {
return true;
}
if (div400) {
return true;
}
return false;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isLeapYear AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function isLeapYear(year: number): boolean {
let div4: boolean = year % 4 === 0;
let div100: boolean = year % 100 === 0;
let div400: boolean = year % 400 === 0;
if (div4 && !div100) {
return true;
}
if (div400) {
return true;
}
return false;
} | https://github.com/miaochiahao/ark-ghidra | b55c945ca23e631c4d1066b5b9cee734851a9e5c | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/DdkUsbPoller.ets | arkts | isNativeRunning | 查询原生轮询线程是否仍在运行
用于检测线程异常退出(IO 错误等导致线程结束但 JS 层未感知) | isNativeRunning(): boolean {
if (this.pollerId < 0 || !ddkNative) return false;
try {
return ddkNative.isPollerRunning(this.pollerId);
} catch {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isNativeRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#sta... | isNativeRunning(): boolean {
if (this.pollerId < 0 || !ddkNative) return false;
try {
return ddkNative.isPollerRunning(this.pollerId);
} catch {
return false;
}
} | https://github.com/AlkaidLab/moonlight-harmony | 1a4960ab1b68dc4aef2f0061d37b8e37f5b6f5ed | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | handleDeviceRemoved | 处理设备移除 | private async handleDeviceRemoved(deviceId: number): Promise<void> {
if (!this.connectedDevices.has(deviceId)) {
return;
}
// USB 驱动模式下,USB 设备移除使用防抖机制:
// 某些手柄(如 Razer)会频繁闪断导致反复 disconnect/reconnect 通知。
// 延迟处理移除事件,如果设备在延迟内重新出现则取消移除。
const info = this.deviceInfoMap.get(deviceId);
if... | 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 handleDeviceRemoved AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST... | private async handleDeviceRemoved(deviceId: number): Promise<void> {
if (!this.connectedDevices.has(deviceId)) {
return;
}
// USB 驱动模式下,USB 设备移除使用防抖机制:
// 某些手柄(如 Razer)会频繁闪断导致反复 disconnect/reconnect 通知。
// 延迟处理移除事件,如果设备在延迟内重新出现则取消移除。
const info = this.deviceInfoMap.get(deviceId);
if... | https://github.com/AlkaidLab/moonlight-harmony | ec2784491d8fb8f6640b1329e09cb934826a084b | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/navigation/MainGraph.ets | arkts | register | 注册主模块导航路由 | register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
RouteBuild.register(MainRoutes.Home, wrapBuilder(HomeNav));
RouteBuild.register(MainRoutes.Category, wrapBuilder(CategoryNav));
RouteBuild.register(MainRoutes.Cart, wrapBuilder(CartNav));
RouteBuild.register(MainRoutes.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register 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#Lef... | register(): void {
RouteBuild.register(MainRoutes.Main, wrapBuilder(MainNav));
RouteBuild.register(MainRoutes.Home, wrapBuilder(HomeNav));
RouteBuild.register(MainRoutes.Category, wrapBuilder(CategoryNav));
RouteBuild.register(MainRoutes.Cart, wrapBuilder(CartNav));
RouteBuild.register(MainRoutes.... | https://github.com/Joker-x-dev/CoolMallArkTS | c51eee71db89ad6a5572a96d5904cbb6abf7bfab | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/CategoryViewModel.ets | arkts | aboutToBeDeleted | 页面销毁时清理计时器
@returns {void} 无返回值 | aboutToBeDeleted(): void {
this.clearSideBarUnlockTimer();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToBeDeleted 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... | aboutToBeDeleted(): void {
this.clearSideBarUnlockTimer();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 12161f0bd8dcd90f1dbca7582598b150db4fe505 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/model/Schedule.ets | arkts | isOnDate | 判断日程是否在指定日期 | isOnDate(date: Date): boolean {
const scheduleStart = new Date(this.startTime)
const scheduleEnd = new Date(this.endTime)
const targetDate = new Date(date.getFullYear(), date.getMonth(), date.getDate())
const nextDate = new Date(targetDate.getTime() + 24 * 60 * 60 * 1000)
return scheduleStart < n... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isOnDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date AST#identifier#Right AST#)#Left ) AST#)#Ri... | isOnDate(date: Date): boolean {
const scheduleStart = new Date(this.startTime)
const scheduleEnd = new Date(this.endTime)
const targetDate = new Date(date.getFullYear(), date.getMonth(), date.getDate())
const nextDate = new Date(targetDate.getTime() + 24 * 60 * 60 * 1000)
return scheduleStart < n... | https://gitcode.com/openharmony/codelabs | 94151644d15cfef3679f6ca4570407e9cefc32ed | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets | arkts | getTypeface | returns the Typeface used for the labels, returns null if none is set
@return | public getTypeface(): FontWeight /*Typeface*/ {
return this.mTypeface;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTypeface 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 FontWeight... | public getTypeface(): FontWeight /*Typeface*/ {
return this.mTypeface;
} | https://gitee.com/openharmony/developtools_profiler.git | 1883e2a744abdf751fbcc05aaea8e37b1baa4eb4 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | getSource | 获取原始书源对象 | getSource(sourceId: string): LegadoBookSource | null {
return this.sources.get(sourceId) || null;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSource 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#Ri... | getSource(sourceId: string): LegadoBookSource | null {
return this.sources.get(sourceId) || null;
} | https://github.com/DaLongZhuaZi/manxia | c4017dbcd50085d3edb3c57a205195f47f514bee | github |
imperson123/- | Harmonyos-Application/entry/src/main/ets/pages/ChatStore.ets | arkts | registerObserver | 注册观察者(UI更新) | registerObserver(observer: Observer<Message[]>) {
this.observer = observer;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerObserver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left observer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#id... | registerObserver(observer: Observer<Message[]>) {
this.observer = observer;
} | https://github.com/imperson123/- | 06d8df861d43d31518045156d3c0ce3d9714bf52 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | preloadQuestions | 预热题目池(应用启动时调用)
@param type 题型
@param difficulty 难度
@param count 预生成数量 | preloadQuestions(type: QuestionType, difficulty: Difficulty, count: number = 10): void {
const poolKey = this.getPoolKey(type, difficulty);
this.fillPool(poolKey, type, difficulty, count);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left preloadQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left QuestionType AST#identifier#Right AST#,... | preloadQuestions(type: QuestionType, difficulty: Difficulty, count: number = 10): void {
const poolKey = this.getPoolKey(type, difficulty);
this.fillPool(poolKey, type, difficulty, count);
} | https://github.com/the-wwyang/kids-learning-app | 6d489bd524ed2df2eef9253665dbdba992b41c09 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/userdata/settings/classes/meowManagedSettings.ets | arkts | setByIndex | Set a setting by index in an easier way (get lazy!).
Including: Check if the index is out of range, if the value is the same as the current value & if the type is mismatched.
Timeout for requestSaveToDisk is by default 250 ms for BOOLEAN and 500 ms for the rest.
@tutorial Does NOT accept arrays of strings. You should d... | setByIndex(index: number, value: string | number | boolean | string[] | [string, string][]) {
if (index < 0 || index >= this.settingsData.length) {
meow(`Rejected. Index out of range`, 'meowSettings][set', meowLevel.WARN);
return;
}
if (this.settingsData[index].value == value) {
return;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A... | setByIndex(index: number, value: string | number | boolean | string[] | [string, string][]) {
if (index < 0 || index >= this.settingsData.length) {
meow(`Rejected. Index out of range`, 'meowSettings][set', meowLevel.WARN);
return;
}
if (this.settingsData[index].value == value) {
return;
... | https://github.com/awaLiny2333/LinysBrowser_NEXT | a4593924af684d81afb7ff6c56b8dc329c48c8de | github |
arkui-x/samples | CodeLab/Cases/feature/cardswiperanimation/src/main/ets/model/CardModel.ets | arkts | registerDataChangeListener | Register data change listener | registerDataChangeListener(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDataChangeListener 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... | registerDataChangeListener(): void {
} | https://gitcode.com/arkui-x/samples | 4bc2390b09e6e766c124afa9a1a29d3e3d3fe48d | gitcode |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/util/PlayerDataUtil.ets | arkts | seek | Seeks current playback to the given position in milliseconds. | public static seek(ms: number): void {
MediaService.getInstance().seek(ms);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left seek AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#iden... | public static seek(ms: number): void {
MediaService.getInstance().seek(ms);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 6775ca9cb0be2d1292581ef59ff8805bdcfcca2d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/DownloadDirManager.ets | arkts | sanitizeFolderName | 清理文件夹名称,移除非法字符 | private sanitizeFolderName(name: string): string {
// 移除或替换文件系统不允许的字符
return name
.replace(/[\\/:*?"<>|]/g, '_') // 替换非法字符
.replace(/\s+/g, ' ') // 合并多个空格
.trim() // 去除首尾空格
.substring(0, 100); // 限制长度
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sanitizeFolderName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private sanitizeFolderName(name: string): string {
// 移除或替换文件系统不允许的字符
return name
.replace(/[\\/:*?"<>|]/g, '_') // 替换非法字符
.replace(/\s+/g, ' ') // 合并多个空格
.trim() // 去除首尾空格
.substring(0, 100); // 限制长度
} | https://github.com/DaLongZhuaZi/manxia | 426569ad810dad8a0696516e04bf8e7a701ed573 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HTMLElement.ets | arkts | firstChild | 获取第一个子元素 | get firstChild(): Node | null {
return this.childNodes.length > 0 ? this.childNodes[0] : null;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left firstChild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifie... | get firstChild(): Node | null {
return this.childNodes.length > 0 ? this.childNodes[0] : null;
} | https://github.com/DaLongZhuaZi/manxia | 2d944babe99d15e8eed54316a15053f00e9d82f8 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Int.ets | arkts | equals | Checks for equality this instance with provided object, treated as a Int
@param other object to be checked against
@returns true if provided object and this instance have same value, false otherwise
Returns false if type of provided object is not the same as this type | public override equals(other: Object|null): boolean {
if (other instanceof Int) {
return this.value == (other as Int).intValue();
}
return false;
} | 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 equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#... | public override equals(other: Object|null): boolean {
if (other instanceof Int) {
return this.value == (other as Int).intValue();
}
return false;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 38d2d4417af78ce11d026011a0fc68f1850b552a | gitee |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/CategoryDao.ets | arkts | update | 更新分类
@param id 分类 ID
@param valueBucket 要更新的数据
@returns Promise<number> 更新的行数 | async update(id: number, valueBucket: relationalStore.ValuesBucket): Promise<number> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left update AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | async update(id: number, valueBucket: relationalStore.ValuesBucket): Promise<number> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore... | https://github.com/Kira-Yagami-Light/Kira-Projects | 5efcf73c7637a1ac639fcb9b0a690108b711e291 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/components/CustomMarkdownComponent.ets | arkts | resetReportStateForReload | Called whenever new Markdown content starts loading. Resets the dedup state so the next valid
size will be reported, and arms a fallback timer in case the async renderer never triggers a
subsequent onSizeChange (e.g. content height equals previous content height after layout). | private resetReportStateForReload(): void {
this.lastReportedHeight = 0;
this.lastReportedWidth = 0;
if (this.pendingReportTimer >= 0) {
clearTimeout(this.pendingReportTimer);
this.pendingReportTimer = -1;
}
if (this.fallbackTimer >= 0) {
clearTimeout(this.fallbackTimer);
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetReportStateForReload 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#Rig... | private resetReportStateForReload(): void {
this.lastReportedHeight = 0;
this.lastReportedWidth = 0;
if (this.pendingReportTimer >= 0) {
clearTimeout(this.pendingReportTimer);
this.pendingReportTimer = -1;
}
if (this.fallbackTimer >= 0) {
clearTimeout(this.fallbackTimer);
}
... | https://github.com/AGenUI/AGenUI | 8fe1f480f1c1802103b031f58b9bfd60496939bb | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/pages/CommentDetailPage.ets | arkts | getSafeTop | 获取安全区域顶部高度 | getSafeTop(): number {
return this.getUIContext().px2vp(this.topRectHeight || 0);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSafeTop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_b... | getSafeTop(): number {
return this.getUIContext().px2vp(this.topRectHeight || 0);
} | https://github.com/Harrisonls2004/WaterFlow | 63848aee9365fe8c984aefe56d247b2e390b91be | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | getRealAlertTime | Obtains the real start time of the alarm.
@param alarmInfo AlarmInfo
@return Real start time of the alarm in milliseconds. | async getRealAlertTime(alarmInfo: AlarmInfo): Promise<number> {
if (!alarmInfo?.id) {
LogUtil.error(TAG, 'Execute method getRealAlertTime failed, params is incorrect.');
return ALERT_TIME_DEFAULT_DATA;
}
const delayedAlarmTime = await SnoozeManager.getNextAlertTime(alarmInfo.id);
LogUtil.i... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRealAlertTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Rig... | async getRealAlertTime(alarmInfo: AlarmInfo): Promise<number> {
if (!alarmInfo?.id) {
LogUtil.error(TAG, 'Execute method getRealAlertTime failed, params is incorrect.');
return ALERT_TIME_DEFAULT_DATA;
}
const delayedAlarmTime = await SnoozeManager.getNextAlertTime(alarmInfo.id);
LogUtil.i... | https://gitee.com/openharmony-sig/applications_clock.git | 4cf4ef68d85c550a8c9eefdb31b7ab39ddc0e381 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/BatchQueryHelper.ets | arkts | bulkSoftDelete | 批量软删除数据
@param tableName 表名
@param ids 要删除的记录 ID 数组
@param idColumnName ID 列名(默认为表名_id)
@returns 删除成功的记录数
性能优化:
- 使用 IN 子句批量更新,减少数据库往返次数
- 使用事务确保原子性
- 比逐条删除快 5-10 倍 | static async bulkSoftDelete(
tableName: string,
ids: number[],
idColumnName?: string
): Promise<number> {
if (!ids || ids.length === 0) {
console.log('[BatchQueryHelper] 没有数据需要删除');
return 0;
}
const store = DatabaseManager.getDatabase();
const idColumn = idColumnName || `${... | 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 bulkSoftDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left... | static async bulkSoftDelete(
tableName: string,
ids: number[],
idColumnName?: string
): Promise<number> {
if (!ids || ids.length === 0) {
console.log('[BatchQueryHelper] 没有数据需要删除');
return 0;
}
const store = DatabaseManager.getDatabase();
const idColumn = idColumnName || `${... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | adbae4f6c08f2efb338af452fb3d3f09c8a56210 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CheatManager.ets | arkts | getLocalCheatsXmlPath | 本地导入的 cheats.xml 路径 | private getLocalCheatsXmlPath(): string {
return `${this.getCheatsDir()}/cheats.xml`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLocalCheatsXmlPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left s... | private getLocalCheatsXmlPath(): string {
return `${this.getCheatsDir()}/cheats.xml`;
} | https://github.com/richshaw2015/nds | bbfd309974d59b7d49ab154614a6648ba42be197 | github |
zmuxuny/ai-guardian-star | entry/src/main/ets/common/UserManager.ets | arkts | isLoggedIn | 检查是否已登录
@returns true表示已登录,false表示未登录 | public isLoggedIn(): boolean {
const username = AppStorage.get<string>(UserManager.STORAGE_KEY);
return username !== undefined && username.trim() !== '' && username !== UserManager.DEFAULT_USERNAME;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLoggedIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo... | public isLoggedIn(): boolean {
const username = AppStorage.get<string>(UserManager.STORAGE_KEY);
return username !== undefined && username.trim() !== '' && username !== UserManager.DEFAULT_USERNAME;
} | https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/UserManager.ets#L52-L55 | 0a5285552b7aa4c9ea7822552d095ea41fcbeefe | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/ThemeUtil.ets | arkts | destroy | 销毁主题系统 | static destroy(): void {
ThemeUtil.listeners = [];
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left destroy 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_sta... | static destroy(): void {
ThemeUtil.listeners = [];
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | c6ec4c8dc9f9d9508709bbd75393d8bcfa590427 | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | isAutomaticCrashHandlerInstalled | Test seam — surfaces whether the HarmonyOS `errorManager` observer is
currently registered. Lets acr precedence tests verify the actual install
decision instead of just the underlying flag. | public isAutomaticCrashHandlerInstalled(): boolean {
return this.crashesModule.isErrorHandlerInstalled();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAutomaticCrashHandlerInstalled 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#boole... | public isAutomaticCrashHandlerInstalled(): boolean {
return this.crashesModule.isErrorHandlerInstalled();
} | https://github.com/Countly/countly-sdk-hos | 45a91b81cf742d5d34b3c1c826460a7c819f09a3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets | arkts | exec | Executes a match search on the string starting from the specified index.
@param { String } str The string to match.
@param { int } index The index to start matching from.
@returns { RegExpExecArray | null } If match succeeds, returns an array containing match results,
otherwise returns null.
@syscap SystemCapability.Ut... | public exec(str: String, index: int): RegExpExecArray | null {
const res = this.execImpl(this.pattern_, this.flags_, str, this.pattern_.length, str.length, index,
this.requiresUtf16Execution_)
if (res.isCorrect) {
res.input = str
res.postExecProcessing(res, str, r... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left exec AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifie... | public exec(str: String, index: int): RegExpExecArray | null {
const res = this.execImpl(this.pattern_, this.flags_, str, this.pattern_.length, str.length, index,
this.requiresUtf16Execution_)
if (res.isCorrect) {
res.input = str
res.postExecProcessing(res, str, r... | https://gitcode.com/iop123123/arkts-static-skills | 7e8d7479d27b3f6cbb0978507b581d19190e0150 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | setMusicEnabled | 设置音乐开关 | setMusicEnabled(enabled: boolean): void {
this.settings.musicEnabled = enabled;
if (!enabled) {
// 停止所有背景音乐
this.stopSound(SoundType.BGM_MAIN);
this.stopSound(SoundType.BGM_GAME);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMusicEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Le... | setMusicEnabled(enabled: boolean): void {
this.settings.musicEnabled = enabled;
if (!enabled) {
// 停止所有背景音乐
this.stopSound(SoundType.BGM_MAIN);
this.stopSound(SoundType.BGM_GAME);
}
} | https://github.com/the-wwyang/kids-learning-app | 6bcb5a8f0a0ce73dfddc929f73e54870b1725831 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | push | Inserts an element at the tail of the queue.
Waits asynchronously until space becomes available when the queue is full.
@param { T } element The element to append to the LinkedConcurrentQueue.
@returns { Promise<void> } A promise that resolves after the element is appended,
and after capacity becomes available when the... | public async push(element: T): Promise<void> {
const newNode = new ListNode<T>(element);
let previousSize: int = -1;
ConcurrencyHelpers.mutexLock(this.pushMutex);
try {
await this.waitFullQueue();
previousSize = this.completeEnqueue... | 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 push AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Rig... | public async push(element: T): Promise<void> {
const newNode = new ListNode<T>(element);
let previousSize: int = -1;
ConcurrencyHelpers.mutexLock(this.pushMutex);
try {
await this.waitFullQueue();
previousSize = this.completeEnqueue... | https://gitcode.com/iop123123/arkts-static-skills | a2ecc58cf9d2a59656222c95a431a7589f395663 | gitcode |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | isFavorited | Check if a product is favorited by user | static async isFavorited(productId: string, username: string): Promise<boolean> {
try {
// 优先使用内存缓存(如果已加载且是同一用户)
if (FavoritesManager.cacheLoaded && FavoritesManager.currentCacheUser === username) {
return FavoritesManager.favoriteProductIds.has(productId);
}
// 缓存未加载,先加载
... | 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 isFavorited AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | static async isFavorited(productId: string, username: string): Promise<boolean> {
try {
// 优先使用内存缓存(如果已加载且是同一用户)
if (FavoritesManager.cacheLoaded && FavoritesManager.currentCacheUser === username) {
return FavoritesManager.favoriteProductIds.has(productId);
}
// 缓存未加载,先加载
... | https://github.com/Harrisonls2004/WaterFlow | e38352a70026748dbba0e866b1004428bfafff02 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets | arkts | getWorkerId | Get the worker identifier
@returns { int } The unique identifier of the worker | public getWorkerId(): int | undefined {
let wId = this.worker.getWorkerId();
return wId != INVALID_WORKER_ID ? wId : undefined;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWorkerId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression... | public getWorkerId(): int | undefined {
let wId = this.worker.getWorkerId();
return wId != INVALID_WORKER_ID ? wId : undefined;
} | https://gitcode.com/iop123123/arkts-static-skills | a643e1f85901da455f077d08150f4dff012e645a | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/AudioFocusManager.ets | arkts | getMaxVolume | Get max volume for media stream
Note: AudioVolumeManager.getMaxVolume is not available in current SDK | static async getMaxVolume(): Promise<number> {
// AudioVolumeManager doesn't expose getMaxVolume directly in current SDK
// Return standard HarmonyOS max volume
return 15;
} | 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 getMaxVolume 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 getMaxVolume(): Promise<number> {
// AudioVolumeManager doesn't expose getMaxVolume directly in current SDK
// Return standard HarmonyOS max volume
return 15;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 4a5d38a8d8edc5f2959aa757a197fd7fd4cecabf | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | mapRowToReadModel | 映射数据库行到读模型对象 | private static mapRowToReadModel(resultSet: relationalStore.ResultSet): ReadModel {
return new ReadModel(
DAOHelper.getLong(resultSet, 'model_id'),
DAOHelper.getString(resultSet, 'model_type'),
DAOHelper.getLong(resultSet, 'user_id'),
DAOHelper.getLong(resultSet, 'aggregate_id'),
DAO... | 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 mapRowToReadModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST... | private static mapRowToReadModel(resultSet: relationalStore.ResultSet): ReadModel {
return new ReadModel(
DAOHelper.getLong(resultSet, 'model_id'),
DAOHelper.getString(resultSet, 'model_type'),
DAOHelper.getLong(resultSet, 'user_id'),
DAOHelper.getLong(resultSet, 'aggregate_id'),
DAO... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | bfd17cdb595e2c1f2f0f51d39338cebe119b99c7 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateConstants.ets | arkts | field | 模板字段快捷创建函数(带资源引用) | function field(key: string, value: string, isProtected: boolean,
placeholder: string | undefined, placeholderRes: Resource | undefined,
required: boolean, keyRes: Resource | undefined): ITemplateField {
return { key, value, isProtected, placeholder, placeholderRes, required, keyRes };
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left field AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#p... | function field(key: string, value: string, isProtected: boolean,
placeholder: string | undefined, placeholderRes: Resource | undefined,
required: boolean, keyRes: Resource | undefined): ITemplateField {
return { key, value, isProtected, placeholder, placeholderRes, required, keyRes };
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateConstants.ets#L11-L15 | 25fdca66517c0abc2260778d77c5e44d730e1036 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ExtensionLoader.ets | arkts | handleKeyEvent | ====== 统一输入处理 ====== | handleKeyEvent(scancode: number, pressed: boolean, keyCode: number, modifiers: number): void {
try {
rdpnapi.handleKeyEvent(scancode, pressed, keyCode, modifiers);
} catch (err) {
hilog.error(DOMAIN, TAG, '[ExtensionLoader] handleKeyEvent: ' + JSON.stringify(err));
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleKeyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scancode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | handleKeyEvent(scancode: number, pressed: boolean, keyCode: number, modifiers: number): void {
try {
rdpnapi.handleKeyEvent(scancode, pressed, keyCode, modifiers);
} catch (err) {
hilog.error(DOMAIN, TAG, '[ExtensionLoader] handleKeyEvent: ' + JSON.stringify(err));
}
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 26779039845f97cf7d52922e81eedf22f537580d | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets | arkts | length | Returns number of unique elements in the HashSet
@returns number of unique elements in the HashSet | get length(): int {
return this.buckets.length.toInt();
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right... | get length(): int {
return this.buckets.length.toInt();
} | https://gitcode.com/iop123123/arkts-static-skills | 07b131720812dbb4f424122912d004455b225aae | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets | arkts | setBigInt64 | Sets a signed long.
@param byteOffset The byte offset.
@param value The value.
@param littleEndian If the value is little endian. | setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void {
this.dataView?.setBigInt64(byteOffset, value, littleEndian)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBigInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,... | setBigInt64(byteOffset: number, value: bigint, littleEndian?: boolean): void {
this.dataView?.setBigInt64(byteOffset, value, littleEndian)
} | https://gitee.com/openharmony-sig/flutter_engine.git | 4a97c0f2026c2cf029cc82079922b864207af935 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | batchInsert | 批量插入异常记录 | static async batchInsert(records: AnomalyRecord[]): Promise<number[]> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const ids: number[] = [];
await store.beginTransaction();
try {
for (let i = 0; i < records.length; i++) {
... | 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 batchInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AS... | static async batchInsert(records: AnomalyRecord[]): Promise<number[]> {
try {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const ids: number[] = [];
await store.beginTransaction();
try {
for (let i = 0; i < records.length; i++) {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 16b1fd93a3b40d0609c168951a1af0b16c197a1f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/OCRRecognitionService.ets | arkts | cleanupFailedRecords | 清理失败记录 | static async cleanupFailedRecords(userId: number, olderThanDays: number = 30): Promise<number> {
try {
return await OCRRecognitionRecordDAO.cleanupFailedRecords(userId, olderThanDays);
} catch (error) {
console.error('[OCRRecognitionService] 清理失败记录失败:', 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 cleanupFailedRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#L... | static async cleanupFailedRecords(userId: number, olderThanDays: number = 30): Promise<number> {
try {
return await OCRRecognitionRecordDAO.cleanupFailedRecords(userId, olderThanDays);
} catch (error) {
console.error('[OCRRecognitionService] 清理失败记录失败:', error);
return 0;
}
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 91f92bda1c8dea33bfb3a681a7d588bf113b6cb7 | github |
openharmony-tpc/openharmony_tpc_samples | dialogs/entry/src/main/ets/pages/PopupButtonExample.ets | arkts | build | action(model) {
Prompt.showToast({ message: JSON.stringify(model.firstText) })
} | build() {
Column() {
Row() {
PopupButton({ model: this.model1 })
}
.layoutWeight(1)
.width('100%')
Row() {
PopupButton({ model: this.model2 })
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.width('100%')
Row() {
PopupButt... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
PopupButton({ model: this.model1 })
}
.layoutWeight(1)
.width('100%')
Row() {
PopupButton({ model: this.model2 })
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.width('100%')
Row() {
PopupButt... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 66153bd1b6b2e056128b193ea1ab2eecbed22131 | gitee |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getPreviousMonthLastDays | 用于获取前一个月的最后几天
@param year 年
@param month 月
@param firstDayOfWeek 当前月份的第一天是周几
@returns | static getPreviousMonthLastDays(year: number, month: number, firstDayOfWeek: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_PREVIOUS_MONTH = TimeUtils.getLastDayOfMonth(year, month - 1);
for (let i = LAST_DAY_OF_PREVIOUS_MONTH - firstDayOfWeek + 1; i <= LAST_DAY_OF_PREVIOUS_MONTH; i++) {... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPreviousMonthLastDays 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#identif... | static getPreviousMonthLastDays(year: number, month: number, firstDayOfWeek: number): number[] {
const DAYS: number[] = [];
const LAST_DAY_OF_PREVIOUS_MONTH = TimeUtils.getLastDayOfMonth(year, month - 1);
for (let i = LAST_DAY_OF_PREVIOUS_MONTH - firstDayOfWeek + 1; i <= LAST_DAY_OF_PREVIOUS_MONTH; i++) {... | https://gitcode.com/arkui-x/samples | 1554c3e6b06e83f42c6983131e4d61a75352bd07 | gitcode |
751496032/ZRouter | RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets | arkts | builder | 动画构建器
@param modifier
@param ctx
@returns | public static builder(callback?: AnimateCallback): NavAnimParamBuilder {
return new NavAnimParamBuilder(callback)
} | 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 builder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#?#Left ? AST#... | public static builder(callback?: AnimateCallback): NavAnimParamBuilder {
return new NavAnimParamBuilder(callback)
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets#L28-L30 | 34c6668cd5d661845e40ed11a2811241fa0668e7 | github |
openharmony/third_party_typescript | tests/arkTSTest/testcase/arkts-sendable-class-decorator/arkts-sendable-class-decorator-1-error.ets | arkts | myMethod2 | should report, arkts-sendable-class-decorator | myMethod2(@SomeDecorator2 param: string) {} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left myMethod2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left SomeDecorator2 AST#identifier#Right AST#decorator#Right AST#identifier#Lef... | myMethod2(@SomeDecorator2 param: string) {} | https://gitee.com/openharmony/third_party_typescript.git | 026d2146a16487a9ffb17c5e426c54b321f8f8e3 | gitee |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/TokenStoreRepository.ets | arkts | loadToken | 读取 Token
@returns {Promise<string>} Token,默认空字符串 | loadToken(): Promise<string> {
return this.dataSource.getToken();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left loadToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS... | loadToken(): Promise<string> {
return this.dataSource.getToken();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 903b325f9b7ea25e391a030fffed342372229a8d | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | fill | Fills the Uint8Array with specified value
@param { int } value - new valuy
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { Uint8Array } - modified Uint8Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: int, start?: int, end?: int): Uint8Array {
const k = normalizeIndex(start ?? 0, this.lengthInt)
const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt)
this.fillInternal(value, k, finalPos)
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide... | public fill(value: int, start?: int, end?: int): Uint8Array {
const k = normalizeIndex(start ?? 0, this.lengthInt)
const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt)
this.fillInternal(value, k, finalPos)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 5f8f66b231c5487eb3191389e915f36610b1fbd5 | gitcode |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | scale | Scale method | scale(scaleX: number, scaleY: number): Offset {
return new Offset(this.dx * scaleX, this.dy * scaleY);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left scale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scaleX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#R... | scale(scaleX: number, scaleY: number): Offset {
return new Offset(this.dx * scaleX, this.dy * scaleY);
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L103-L105 | ec3534a22891ba76d0003d5f9a97edffc57a5412 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | initializeDiskCacheIndex | 初始化磁盘缓存索引 | private async initializeDiskCacheIndex(): Promise<void> {
try {
const coversDir = this.sandboxManager.getDirectory('covers');
if (!await this.sandboxManager.exists(coversDir)) {
return;
}
const files = await this.sandboxManager.listDirectory(coversDir);
f... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initializeDiskCacheIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio... | private async initializeDiskCacheIndex(): Promise<void> {
try {
const coversDir = this.sandboxManager.getDirectory('covers');
if (!await this.sandboxManager.exists(coversDir)) {
return;
}
const files = await this.sandboxManager.listDirectory(coversDir);
f... | https://github.com/DaLongZhuaZi/manxia | 13d8b4bce25cbe9c9e342f5738673cb46e1395bb | github |
arkui-x/samples | CodeLab/Cases/feature/digitalscrollanimation/src/main/ets/pages/DigitalScrollDetail.ets | arkts | refreshData | 更新当前显示数据 | refreshData() {
const tempArr: number[] = [];
for (let i = 0; i < DATA_CONFIG.NUMBER_LEN; i++) {
tempArr.push(Math.floor(Math.random() * 10)); // 向数组添加随机数
}
this.currentData = tempArr; // 更新当前数据
// 性能知识点:forEach场景下,每个列表项都会创建animateTo对象,要注意不能进行大数据量的遍历创建过多动画对象导致内存占用问题
this.currentData.forE... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | refreshData() {
const tempArr: number[] = [];
for (let i = 0; i < DATA_CONFIG.NUMBER_LEN; i++) {
tempArr.push(Math.floor(Math.random() * 10)); // 向数组添加随机数
}
this.currentData = tempArr; // 更新当前数据
// 性能知识点:forEach场景下,每个列表项都会创建animateTo对象,要注意不能进行大数据量的遍历创建过多动画对象导致内存占用问题
this.currentData.forE... | https://gitcode.com/arkui-x/samples | f8c0cc0b0f1dce37798355d8e14531273ae6facb | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | init | 初始化崩溃监听服务
@param context UIAbility上下文 | public async init(context: common.UIAbilityContext): Promise<void> {
try {
// 创建 EL1 级别的上下文,用于存储可分享的崩溃日志文件
this.el1Context = context.createAreaModeContext(contextConstant.AreaMode.EL1);
this.logDirPath = `${this.el1Context.filesDir}/${LOG_DIR}`;
hilog.info(DOMAIN, TAG, 'EL1 context created... | 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 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... | public async init(context: common.UIAbilityContext): Promise<void> {
try {
// 创建 EL1 级别的上下文,用于存储可分享的崩溃日志文件
this.el1Context = context.createAreaModeContext(contextConstant.AreaMode.EL1);
this.logDirPath = `${this.el1Context.filesDir}/${LOG_DIR}`;
hilog.info(DOMAIN, TAG, 'EL1 context created... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L40-L57 | bdb80f5a77eff913d3ea6859a93ed0679d0c0469 | github |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordInput.ets | arkts | getPageTitle | Get page title
@return : page title | getPageTitle(): Resource {
let title: Resource = $r('app.string.password_enter_password');
switch (this.passwordType) {
case PinSubType.PIN_SIX:
case PinSubType.PIN_NUMBER:
title = $r('app.string.password_title_number');
break;
case PinSubType.PIN_MIXED:
title = $r(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPageTitle 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 Resource AST#identifier#Right AST#ERROR#Right AST... | getPageTitle(): Resource {
let title: Resource = $r('app.string.password_enter_password');
switch (this.passwordType) {
case PinSubType.PIN_SIX:
case PinSubType.PIN_NUMBER:
title = $r('app.string.password_title_number');
break;
case PinSubType.PIN_MIXED:
title = $r(... | https://gitee.com/openharmony/applications_settings.git | c8267c19fbce5052b4a45223850441eaa5a2eb7c | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/pages/IntroductionPage.ets | arkts | resetParameters | Reset all parameters if the list arrive begin by animation. | resetParameters() {
this.listPosition = Const.LIST_POSITION_BEGIN;
if (this.listPosition === Const.LIST_POSITION_BEGIN && this.isReachStart) {
this.imageHeight = Const.FULL_PERCENT_NUMBER;
this.arrowIconOpacity = Const.OPACITY_MAX;
}
this.isReachStart = false;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resetParameters 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#Le... | resetParameters() {
this.listPosition = Const.LIST_POSITION_BEGIN;
if (this.listPosition === Const.LIST_POSITION_BEGIN && this.isReachStart) {
this.imageHeight = Const.FULL_PERCENT_NUMBER;
this.arrowIconOpacity = Const.OPACITY_MAX;
}
this.isReachStart = false;
} | https://gitee.com/harmonyos/codelabs.git | 4e9d6e5dfa2e420dac54c5887b8239179faf8a91 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WindowManager.ets | arkts | setSystemBarStyle | 设置系统栏颜色和样式
@param config 系统栏配置
@param uiContext 可选的UIContext,推荐在组件中传入 | static setSystemBarStyle(config: SystemBarConfig, uiContext?: UIContext): void {
try {
const mainWindow = uiContext ?
WindowManager.getMainWindowFromUIContext(uiContext) :
WindowManager.getMainWindow();
if (!mainWindow) {
logger.error(WindowManager.TAG, '❌ 无法获取主窗口,设置系统... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setSystemBarStyle 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#L... | static setSystemBarStyle(config: SystemBarConfig, uiContext?: UIContext): void {
try {
const mainWindow = uiContext ?
WindowManager.getMainWindowFromUIContext(uiContext) :
WindowManager.getMainWindow();
if (!mainWindow) {
logger.error(WindowManager.TAG, '❌ 无法获取主窗口,设置系统... | https://github.com/DaLongZhuaZi/manxia | 7d95dceab821b609eac29c417cb673ea754151de | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/ListPageViewModel.ets | arkts | redirectDeletePage | Button for redirecting to the delete page. | redirectDeletePage(): void {
router.pushUrl({
url: CommonConstants.DELETE_PAGE_URL
}).catch((err: BusinessError) => {
Logger.error(`pushUrl failed, code message is ${JSON.stringify(err)}`);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redirectDeletePage 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... | redirectDeletePage(): void {
router.pushUrl({
url: CommonConstants.DELETE_PAGE_URL
}).catch((err: BusinessError) => {
Logger.error(`pushUrl failed, code message is ${JSON.stringify(err)}`);
});
} | https://gitee.com/harmonyos/codelabs.git | a60cec83ba766ba718aa4db9fa7124d9e4e77938 | gitee |
PollenWang6/HiXD | entry/src/main/ets/services/SportService.ets | arkts | getScore | ===== 数据获取 =====
获取体测成绩
返回总分、排名、各学年明细 | async getScore(): Promise<SportScore> {
if (this.userId.length === 0 || this.token.length === 0) {
await this.login();
}
const result: SportScore = {
total: '0.0',
rank: '',
detail: '',
list: [],
};
const body: Record<string, string> = { 'userId': this.userId };
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getScore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#... | async getScore(): Promise<SportScore> {
if (this.userId.length === 0 || this.token.length === 0) {
await this.login();
}
const result: SportScore = {
total: '0.0',
rank: '',
detail: '',
list: [],
};
const body: Record<string, string> = { 'userId': this.userId };
... | https://github.com/PollenWang6/HiXD | 4d52c1d25c93cac14fc3ab7282bd21992cf79c4a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | initializePreferences | 初始化首选项存储 | private async initializePreferences(): Promise<void> {
try {
const context = getContext();
this.preferencesStore = await preferences.getPreferences(context, 'theme_preferences');
logger.info(TAG, '主题首选项存储初始化成功');
} catch (error) {
logger.error(TAG, '主题首选项存储初始化失败', error);
this.cu... | 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 initializePreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async initializePreferences(): Promise<void> {
try {
const context = getContext();
this.preferencesStore = await preferences.getPreferences(context, 'theme_preferences');
logger.info(TAG, '主题首选项存储初始化成功');
} catch (error) {
logger.error(TAG, '主题首选项存储初始化失败', error);
this.cu... | https://github.com/DaLongZhuaZi/manxia | 003a4b3010ef215a55db8df6e0457a4765bec4e4 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/28.assignment/neg.ets | arkts | main | ---
desc: The result of the first operand of an assignment operator must be a variable, or a compile-time error occurs.
tags: [compile-only, negative]
--- | function main(): int {
{{c.expr|indent}}
return 0
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left i... | function main(): int {
{{c.expr|indent}}
return 0
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 064fc1670d7882e27a1d981f90077c5317edec48 | gitee |
arkui-x/samples | CodeLab/Cases/feature/dealstridesolution/src/main/ets/model/CameraService.ets | arkts | getSupportedCamerasFn | 获取支持指定的摄像机设备对象 | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.leng... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSupportedCamerasFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#E... | getSupportedCamerasFn(cameraManager: camera.CameraManager): Array<camera.CameraDevice> {
let supportedCameras: Array<camera.CameraDevice> = [];
try {
supportedCameras = cameraManager.getSupportedCameras();
logger.info(TAG, `getSupportedCameras success: ${this.cameras}, length: ${this.cameras?.leng... | https://gitcode.com/arkui-x/samples | f3f09932398a393d9a4d58c97af9e37ff30110f5 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getSourceUserSettings | [性能优化] 批量获取图源用户设置
只调用一次 getSourcePkgById,使用 WHERE IN 单条 SQL 查询所有设置
@param sourceId 图源ID
@param keyNames 设置键名数组
@returns Map<keyName, UserSettingsDatabaseRecord> | async getSourceUserSettings(sourceId: number, keyNames: string[]): Promise<Map<string, UserSettingsDatabaseRecord>> {
const result = new Map<string, UserSettingsDatabaseRecord>();
if (keyNames.length === 0) return result;
try {
const pkg = await this.getSourcePkgById(sourceId);
const keyIdenti... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSourceUserSettings AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS... | async getSourceUserSettings(sourceId: number, keyNames: string[]): Promise<Map<string, UserSettingsDatabaseRecord>> {
const result = new Map<string, UserSettingsDatabaseRecord>();
if (keyNames.length === 0) return result;
try {
const pkg = await this.getSourcePkgById(sourceId);
const keyIdenti... | https://github.com/DaLongZhuaZi/manxia | 93fa10c6d55236b9effc911f88d1eb5f9ae8ea16 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | markDiskCacheHit | 标记磁盘缓存命中 | markDiskCacheHit(pageIndex: number): void {
// 【修复】从loading中移除
this.loading.delete(pageIndex);
this.completed.add(pageIndex);
this.pageStatusMap.set(pageIndex, PreloadItemStatus.DISK_CACHE_HIT);
this.stats.diskCacheHits++;
this.updateDebugInfo();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markDiskCacheHit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A... | markDiskCacheHit(pageIndex: number): void {
// 【修复】从loading中移除
this.loading.delete(pageIndex);
this.completed.add(pageIndex);
this.pageStatusMap.set(pageIndex, PreloadItemStatus.DISK_CACHE_HIT);
this.stats.diskCacheHits++;
this.updateDebugInfo();
} | https://github.com/DaLongZhuaZi/manxia | 6c541b241c3386e4b9a664bf2e52e234d0808d85 | github |
Vsolon0401/MallShopping | common/src/main/ets/utils/Preferences.ets | arkts | put | 插入数据
@param key: 存入key值
@param value: 存储数据
@returns | async put(key: string, value: ValueType): Promise<void> {
let promise = await this.getPreferences().then(async preferences => {
// 插入数据
await preferences.put(key, value)
console.log('插入', key, value)
// 写入文件
await preferences.flush()
}).catch(error => {
Logger.error(LOG, `c... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left put AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async put(key: string, value: ValueType): Promise<void> {
let promise = await this.getPreferences().then(async preferences => {
// 插入数据
await preferences.put(key, value)
console.log('插入', key, value)
// 写入文件
await preferences.flush()
}).catch(error => {
Logger.error(LOG, `c... | https://github.com/Vsolon0401/MallShopping | b2964634db779b6110dc7d323cc5aa5a8ed79fbc | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/HomeViewModel.ets | arkts | requestListData | 重写请求列表数据方法来实现全部商品分页
@returns {Promise<NetworkResponse<NetworkPageData<Goods>>>} 商品分页数据 | protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const request: GoodsSearchRequest = new GoodsSearchRequest();
request.page = this.currentPage;
request.size = this.pageSize;
return this.goodsRepository.getGoodsPage(request);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestListData 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 A... | protected requestListData(): Promise<NetworkResponse<NetworkPageData<Goods>>> {
const request: GoodsSearchRequest = new GoodsSearchRequest();
request.page = this.currentPage;
request.size = this.pageSize;
return this.goodsRepository.getGoodsPage(request);
} | https://github.com/Joker-x-dev/CoolMallArkTS | f0f597e2d7c1f36887bf5d98a45656fff49464e7 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/DualSenseController.ets | arkts | rumble | 震动反馈 (去重: 跳过相同非零值, 零值始终发送) | rumble(lowFreqMotor: number, highFreqMotor: number): void {
// 零值(停止振动)始终发送, 非零重复值跳过
if (lowFreqMotor !== 0 || highFreqMotor !== 0) {
if (lowFreqMotor === this.lastRumbleLow && highFreqMotor === this.lastRumbleHigh) {
return;
}
}
this.lastRumbleLow = lowFreqMotor;
this.lastRumb... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rumble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lowFreqMotor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Ri... | rumble(lowFreqMotor: number, highFreqMotor: number): void {
// 零值(停止振动)始终发送, 非零重复值跳过
if (lowFreqMotor !== 0 || highFreqMotor !== 0) {
if (lowFreqMotor === this.lastRumbleLow && highFreqMotor === this.lastRumbleHigh) {
return;
}
}
this.lastRumbleLow = lowFreqMotor;
this.lastRumb... | https://github.com/AlkaidLab/moonlight-harmony | e00ca217329ade56030465530799c46fd023b17e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_byte.ets | arkts | main | ---
desc: check prefix decrement for byte operand
--- | function main(): void {
let value: byte = {{v.value}}
let result: byte = --value
assert value == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let value: byte = {{v.value}}
let result: byte = --value
assert value == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 34017997e68b2b3fea6b47a96de222f8c4ea4e19 | gitee |
arkui-x/samples | CodeLab/Cases/feature/applicationexception/src/main/ets/model/PreferencesManager.ets | arkts | getFaultMessage | 获取数据异常信息
@param faultMessage 异常信息集合 | public static async getFaultMessage(faultDataSource: FaultDataSource): Promise<void> {
logger.info(TAG, `getFaultMessage start`);
await dataPreferencesManager.getValue<string>('faultMessage').then((data: string | null) => {
if (data != null && typeof data === 'string') {
const faultData: Array<s... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getFaultMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fa... | public static async getFaultMessage(faultDataSource: FaultDataSource): Promise<void> {
logger.info(TAG, `getFaultMessage start`);
await dataPreferencesManager.getValue<string>('faultMessage').then((data: string | null) => {
if (data != null && typeof data === 'string') {
const faultData: Array<s... | https://gitcode.com/arkui-x/samples | 9039eaf00044e6a6f3f54a49f10677722e1da060 | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/viewmodel/MapModel.ets | arkts | calCoordinateByLonAndLat | Obtains landmark objects on the map based on the longitude and latitude.
@param geoCoordinates Longitude and latitude.
@param type Landmark Type.
@param mapContext Objects in a map component.
@returns Landmark objects in the map. | calCoordinateByLonAndLat(geoCoordinates: Array<GeoCoordinates>, type: number, mapWidth: number, mapHeight: number): AddressItem {
this.data = undefined;
if (!this.addressArray[type - 1]) {
let addressItem = new AddressItem();
addressItem.name = mapLandmarksName[type-1];
addressItem.icon = ma... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calCoordinateByLonAndLat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left geoCoordinates AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Arr... | calCoordinateByLonAndLat(geoCoordinates: Array<GeoCoordinates>, type: number, mapWidth: number, mapHeight: number): AddressItem {
this.data = undefined;
if (!this.addressArray[type - 1]) {
let addressItem = new AddressItem();
addressItem.name = mapLandmarksName[type-1];
addressItem.icon = ma... | https://gitee.com/harmonyos/codelabs.git | 1f6677e2efeb2ec9523e454672399678a625d483 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AlertManager.ets | arkts | subscribe | 订阅告警变化 | public subscribe(callback: (alerts: WardAlert[]) => void): void {
this.subscribers.push(callback);
console.log('AlertManager: New subscriber added');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left subscribe AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#... | public subscribe(callback: (alerts: WardAlert[]) => void): void {
this.subscribers.push(callback);
console.log('AlertManager: New subscriber added');
} | https://github.com/LJ666-ui/harmony-health-care | 19ad46b6b90f71d30db5d5501e1011922aba9af2 | github |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/empty/EmptyError.ets | arkts | build | 构建错误缺省页视图
@returns {void} 无返回值 | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_page"),
actionText: this.actionText,
onAction: this.onAction
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Empty({
description: this.description,
imageRes: $r("app.media.ic_empty_page"),
actionText: this.actionText,
onAction: this.onAction
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | d3ba5d5e0b7bafed115efe4247d14d00b33d3da6 | github |
kumaleap/ArkSwipeDeck | library/src/main/ets/utils/GestureUtils.ets | arkts | clampDragDistance | 限制拖拽范围
@param delta - 位移
@param maxDistance - 最大距离
@returns 限制后的位移 | static clampDragDistance(delta: number, maxDistance: number): number {
return Math.max(-maxDistance, Math.min(maxDistance, delta));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clampDragDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left delta AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static clampDragDistance(delta: number, maxDistance: number): number {
return Math.max(-maxDistance, Math.min(maxDistance, delta));
} | https://github.com/kumaleap/ArkSwipeDeck | 4961be5c574c0cf2590267d750695dd30720d8b9 | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/LifecycleObserver.ets | arkts | deregister | Unsubscribe everything. Safe to call multiple times, no-op after the
first successful deregister of each subscription. | public deregister(): void {
if (this.appContext === null) return;
if (this.appStateObserver !== null) {
try { this.appContext.off('applicationStateChange', this.appStateObserver); }
catch (err) { this.logger.w(`[LifecycleObserver] deregister applicationStateChange failed: ${err}`); }
this.ap... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deregister 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#Rig... | public deregister(): void {
if (this.appContext === null) return;
if (this.appStateObserver !== null) {
try { this.appContext.off('applicationStateChange', this.appStateObserver); }
catch (err) { this.logger.w(`[LifecycleObserver] deregister applicationStateChange failed: ${err}`); }
this.ap... | https://github.com/Countly/countly-sdk-hos | b45744815d76400c4a32ddcbde0e979c2f5437ea | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | isLessThan | Checks if this instance value is less than value of provided instance
@param other Right hand side of the comparison
@returns true if this value is less than provided, false otherwise | public isLessThan(other: Float): boolean {
return this.value < other.toFloat();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLessThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Floa... | public isLessThan(other: Float): boolean {
return this.value < other.toFloat();
} | https://gitcode.com/iop123123/arkts-static-skills | 930fcd157601469a37a154cc01fe52963d052b8c | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Map.ets | arkts | has | Checks if a key is in the Map
@param k the key to find in the Map
@returns true if the value is in the Map | has(k: K): boolean {
let r = lookupTree(this.tree, k);
return r != null;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#)#Left ) AST#)#Right AST#arg... | has(k: K): boolean {
let r = lookupTree(this.tree, k);
return r != null;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8862bd2302f9f358016df968748a083333d5e598 | gitee |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/pages/VideoDetail.ets | arkts | onCancel | 返回、ESC键和点击遮障层弹窗退出时回调 | onCancel(): void {
this.customShareDlg.close();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCancel 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#Lef... | onCancel(): void {
this.customShareDlg.close();
} | https://github.com/openharmony/applications_app_samples | 05c6f07f82af1571e0cedc8e25b9b96a7e2bf37c | github |
Yebingiscn/SweetVideo | entry/src/main/ets/utils/AnimationUtil.ets | arkts | getAnimationCurve | 获取动画曲线参数配置
@param duration 动画持续时间(毫秒),默认为300
@param s1 弹簧动画的第一个参数,默认为0.4
@param s2 弹簧动画的第二个参数,默认为0.7
@returns 动画参数对象 | public static getAnimationCurve(duration: number = 300, s1: number = 0.4, s2: number = 0.7): AnimateParam {
return { duration: duration, curve: curves.springMotion(s1, s2) }
} | 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 getAnimationCurve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#L... | public static getAnimationCurve(duration: number = 300, s1: number = 0.4, s2: number = 0.7): AnimateParam {
return { duration: duration, curve: curves.springMotion(s1, s2) }
} | https://github.com/Yebingiscn/SweetVideo | f44367417fe492645eb52bd308b5bba82637ffb1 | github |
HarmonyOS_Samples/MusicHome | products/default/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | Loads main page, captures UIContext, initializes window helper and MediaService singleton. | onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability
Logger.info('EntryAbility: Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
try {
getAppRuntime().uiContext = windowStage.getMainWindowSync().getU... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left win... | onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability
Logger.info('EntryAbility: Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
try {
getAppRuntime().uiContext = windowStage.getMainWindowSync().getU... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 1cf99c0bd47edcbf265bfc9988f8dfd796bf0cfc | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | atan | Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value of this Decimal.
@returns { Decimal } the Decimal type
@throws { BusinessError } 10200060 - Precision limit exceeded. | public atan(): Decimal {
let x: Decimal = this;
let pr = Decimal.precision;
let rm = Decimal.rounding;
let r: Decimal;
if (!x.isFinite()) {
if (!x.s) {
return new Decimal(NaN);
}
if (pr + 4 <= PI_PRECISION) {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left atan 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 atan(): Decimal {
let x: Decimal = this;
let pr = Decimal.precision;
let rm = Decimal.rounding;
let r: Decimal;
if (!x.isFinite()) {
if (!x.s) {
return new Decimal(NaN);
}
if (pr + 4 <= PI_PRECISION) {
... | https://gitcode.com/iop123123/arkts-static-skills | 42e93e96425c6d0628e997e5b662e8312aea4689 | gitcode |
harmonyos/codelabs | CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets | arkts | drawFlower | Painted outer disc petal. | drawFlower() {
let beginAngle = this.startAngle + this.avgAngle;
const pointY = this.screenWidth * CommonConstants.FLOWER_POINT_Y_RATIOS;
const radius = this.screenWidth * CommonConstants.FLOWER_RADIUS_RATIOS;
const innerRadius = this.screenWidth * CommonConstants.FLOWER_INNER_RATIOS;
for (let i =... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawFlower AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | drawFlower() {
let beginAngle = this.startAngle + this.avgAngle;
const pointY = this.screenWidth * CommonConstants.FLOWER_POINT_Y_RATIOS;
const radius = this.screenWidth * CommonConstants.FLOWER_RADIUS_RATIOS;
const innerRadius = this.screenWidth * CommonConstants.FLOWER_INNER_RATIOS;
for (let i =... | https://gitee.com/harmonyos/codelabs.git | f896a4be4e32a6444c0026ebdaf4dd5e49d181ae | gitee |
Cool_foolisher1/ArkTSRepository | GraphicalCode/commons/src/main/ets/util/BreakpointSystemUtil.ets | arkts | updateCurrentBreakpoint | 更新当前断点
@param breakpoint BreakpointTypeEnum | public updateCurrentBreakpoint(breakpoint: BreakpointTypeEnum): void {
if (this.currentBreakpoint !== breakpoint) {
this.currentBreakpoint = breakpoint
const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO) || new GlobalInfoModel()
globalInfoModel.currentBreakpoint =... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateCurrentBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left breakpoint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | public updateCurrentBreakpoint(breakpoint: BreakpointTypeEnum): void {
if (this.currentBreakpoint !== breakpoint) {
this.currentBreakpoint = breakpoint
const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO) || new GlobalInfoModel()
globalInfoModel.currentBreakpoint =... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 355dd35d9fcad352f02b2db0fb8e8f8a4d50ffe1 | gitcode |
erosTeam/NextE | shared/src/main/ets/network/EhApiService.ets | arkts | submitGalleryArchiverHath | Submit a protected H@H archive request. EH returns a status message, not a local download URL. | async submitGalleryArchiverHath(
gid: string,
token: string,
archiverLink: string,
resolution: string,
isEx: boolean,
): Promise<EhGalleryArchiverSubmitResult> {
const url: string = this.archiverUrl(gid, token, archiverLink, isEx)
const body: string = this.formPair('hathdl_xres', resolut... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitGalleryArchiverHath AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gid AST#identifier#Right AST#type_annotation#Left AST... | async submitGalleryArchiverHath(
gid: string,
token: string,
archiverLink: string,
resolution: string,
isEx: boolean,
): Promise<EhGalleryArchiverSubmitResult> {
const url: string = this.archiverUrl(gid, token, archiverLink, isEx)
const body: string = this.formPair('hathdl_xres', resolut... | https://github.com/erosTeam/NextE | bdf17172274759a7967b10b3fa49a3ddd9a8263d | github |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | autoFixVideoSize | 重新计算播放器宽高
内置播放器使用 | autoFixVideoSize() {
const playerSize = this.calculatePlayerSize(new CalculatePlayerSizeParam(
this.windowWidth, this.windowHeight, this.videoWidth, this.videoHeight
))
if (playerSize.playerWidth > 0 && playerSize.playerHeight > 0) {
this.xComController.setXComponentSurfaceRect({
surfa... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left autoFixVideoSize 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... | autoFixVideoSize() {
const playerSize = this.calculatePlayerSize(new CalculatePlayerSizeParam(
this.windowWidth, this.windowHeight, this.videoWidth, this.videoHeight
))
if (playerSize.playerWidth > 0 && playerSize.playerHeight > 0) {
this.xComController.setXComponentSurfaceRect({
surfa... | https://github.com/fbinba3955/Flymby | b27cbcf5e9364ca0ddf78e3d76fad055c32b916c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | getYMax | returns the current y-max value across all DataSets
@return | public getYMax(): number {
// 缺失方法
if (this.mData) {
return this.mData.getYMax();
}
return 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYMax 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#... | public getYMax(): number {
// 缺失方法
if (this.mData) {
return this.mData.getYMax();
}
return 0;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | cc15dfd47f84dcfff97297390bd9ab86431a1cd9 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | allocateSlotForDevice | ==================== 槽位管理 ====================
为 USB 设备分配槽位 | private allocateSlotForDevice(deviceKey: string): number {
return this.allocateSlot(deviceKey, this.deviceKeyToSlot, 'GAMEPAD');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left allocateSlotForDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string... | private allocateSlotForDevice(deviceKey: string): number {
return this.allocateSlot(deviceKey, this.deviceKeyToSlot, 'GAMEPAD');
} | https://github.com/AlkaidLab/moonlight-harmony | 85d64b5c9397fb94660ab0880ffe659324029767 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/manager/AVPlayerManager.ets | arkts | setLoop | 设置循环播放 | async setLoop(isLoop: boolean) {
this.loop = isLoop
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setLoop AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isLoop AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | async setLoop(isLoop: boolean) {
this.loop = isLoop
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 285924eb28254575fd21a10fb819af7f902288f8 | gitcode |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateX | Animates values along the X axis.
@param durationMillis animation duration
@param easing EasingFunction | public animateX(durationMillis: number, easing: EasingFunction) {
let animatorX = this.xAnimator(durationMillis, easing);
animatorX.addUpdateListener(mListener);
animatorX.start();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMillis AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public animateX(durationMillis: number, easing: EasingFunction) {
let animatorX = this.xAnimator(durationMillis, easing);
animatorX.addUpdateListener(mListener);
animatorX.start();
} | https://gitee.com/openharmony/developtools_profiler.git | b7a4efedf4438a58525f9d7c2792cf80b50c71db | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/ImageProcessing/ImageInterceptor.ets | arkts | constructor | 最多缓存50张处理后的图片 | private constructor() {
this.registry = ImageDescramblerRegistry.getInstance();
logger.info(TAG, '图片拦截器已初始化');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
this.registry = ImageDescramblerRegistry.getInstance();
logger.info(TAG, '图片拦截器已初始化');
} | https://github.com/DaLongZhuaZi/manxia | f7cc92aaaa748790a628663c6e280f390ae35c38 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/CloudSyncService.ets | arkts | calculateHash | 计算数据哈希 | private static async calculateHash(data: string): Promise<string> {
try {
const md: cryptoFramework.Md = cryptoFramework.createMd('SHA256');
const encoder: util.TextEncoder = new util.TextEncoder();
const dataBytes: Uint8Array = encoder.encodeInto(data);
const updateBlob: cryptoFramework.D... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left calculateHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d... | private static async calculateHash(data: string): Promise<string> {
try {
const md: cryptoFramework.Md = cryptoFramework.createMd('SHA256');
const encoder: util.TextEncoder = new util.TextEncoder();
const dataBytes: Uint8Array = encoder.encodeInto(data);
const updateBlob: cryptoFramework.D... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 64a3e26feb43474b9fcfefeafd440bef0cfd1188 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets | arkts | get | Returns a value associated with key if present
@param { K } key the key to find in the ConcurrentHashMap
@returns { V | undefined } value if associated with key is present. | public override get(key: K): V | undefined {
const buck = this.getBucket(key);
if (buck !== undefined) {
const buckSize = buck.length;
ConcurrencyHelpers.mutexLock(this.bucketsMutex);
const buckIndex = this.getBucketIndex(key);
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#get#Left get AST#get#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Le... | public override get(key: K): V | undefined {
const buck = this.getBucket(key);
if (buck !== undefined) {
const buckSize = buck.length;
ConcurrencyHelpers.mutexLock(this.bucketsMutex);
const buckIndex = this.getBucketIndex(key);
... | https://gitcode.com/iop123123/arkts-static-skills | 5e4d61987a1de894f70293d98d5fc6da7dc0d4ae | gitcode |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | topicPosts | 获取更多帖子 | static topicPosts(id: number): string {
return `/t/${id}/posts.json`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left topicPosts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | static topicPosts(id: number): string {
return `/t/${id}/posts.json`;
} | https://github.com/Amaz1ny/HarmonyDO-public | 22aecbbb46df9a8872c7426453254e1b45abd33a | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Queue.ets | arkts | add | Adds an element to the end of the Queue.
@param element - The element to add.
@returns Returns true if the element is added successfully; returns false otherwise. | public add(element: T): boolean {
try {
this.buffer.insertEnd(element);
} catch (e) {
return false;
}
return true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id... | public add(element: T): boolean {
try {
this.buffer.insertEnd(element);
} catch (e) {
return false;
}
return true;
} | https://gitcode.com/iop123123/arkts-static-skills | cec7508217bdd1a9aaf889e2d12881255dd17584 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/common/UserService.ets | arkts | phoneExists | 检查手机号是否已注册 | public async phoneExists(phone: string): Promise<boolean> {
const phoneUsers = await this.getPhoneUsers();
return phoneUsers.has(phone);
} | 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 phoneExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AST#... | public async phoneExists(phone: string): Promise<boolean> {
const phoneUsers = await this.getPhoneUsers();
return phoneUsers.has(phone);
} | https://github.com/the-wwyang/kids-learning-app | fe875b5cd2487ed4d13e29cd5cbb3283882914cb | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.