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
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
search
搜索识别记录(按商家名称或原始文本)
static async search( userId: number, keyword: string, limit: number = 30 ): Promise<OCRRecognitionRecord[]> { try { const store = DatabaseManager.getDatabase(); const searchPattern = `%${keyword}%`; const sql = ` SELECT * FROM ${OCRRecognitionRecord.tableName} ...
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 search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Ri...
static async search( userId: number, keyword: string, limit: number = 30 ): Promise<OCRRecognitionRecord[]> { try { const store = DatabaseManager.getDatabase(); const searchPattern = `%${keyword}%`; const sql = ` SELECT * FROM ${OCRRecognitionRecord.tableName} ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
89dc86a76bf881737fdb944947e982e4ff55a094
github
erosTeam/NextE
shared/src/main/ets/parser/HtmlSelectorUtils.ets
arkts
htmlUnescape
Decode HTML character references in display text. EH page source escapes titles/tag labels (`Koumi-jima 2&amp;3` → `2&3`), which would otherwise render the raw entity. Single regex pass so `&amp;lt;` stays `&lt;` (no double-decode); unknown entities are left verbatim. Mirror this in any parser contract test that assert...
static htmlUnescape(s: string): string { if (s.length === 0 || s.indexOf('&') < 0) { return s } return s.replace( // `#[xX]` — hex marker is case-insensitive per the HTML spec (`&#X41;` is valid); the callback // already handles an uppercase 'X', so the regex must admit it too. /&(...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left htmlUnescape AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static htmlUnescape(s: string): string { if (s.length === 0 || s.indexOf('&') < 0) { return s } return s.replace( // `#[xX]` — hex marker is case-insensitive per the HTML spec (`&#X41;` is valid); the callback // already handles an uppercase 'X', so the regex must admit it too. /&(...
https://github.com/erosTeam/NextE
14fbc52fcc8bd811384e0bf00fb7dcaa974b2ac3
github
ibestservices/ibest-ui
library/src/main/ets/components/dateTimePicker/index.ets
arkts
getMinutesList
获取分钟列表
getMinutesList(): IBestPickerOption[] { let minutesList: IBestPickerOption[] = [] let year = this.getValue("year") let month = this.getValue("month") let day = this.getValue("day") let hour = this.getValue("hour") let min = this.isMinYear(year) && this.isMinMonth(month) && this.isMinDay(day) && this.isMinH...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMinutesList 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 IBestPickerOption AST#identifier#Right AST#[#Le...
getMinutesList(): IBestPickerOption[] { let minutesList: IBestPickerOption[] = [] let year = this.getValue("year") let month = this.getValue("month") let day = this.getValue("day") let hour = this.getValue("hour") let min = this.isMinYear(year) && this.isMinMonth(month) && this.isMinDay(day) && this.isMinH...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dateTimePicker/index.ets#L262-L277
c45783be31f496e88d5194d82f896bfe3a42ed72
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/NetworkClient.ets
arkts
getInstance
获取 NetworkClient 单例
public static getInstance(): NetworkClient { if (!NetworkClient.instance) { NetworkClient.instance = new NetworkClient(); } return NetworkClient.instance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): NetworkClient { if (!NetworkClient.instance) { NetworkClient.instance = new NetworkClient(); } return NetworkClient.instance; }
https://github.com/Joker-x-dev/CoolMallArkTS
729b1ac6657d62f4d42d9368a553dac4bed6a975
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CartRepository.ets
arkts
updateCart
更新购物车中的商品 @param {Cart} cart 购物车商品 @returns {Promise<void>} Promise<void>
updateCart(cart: Cart): Promise<void> { return this.dataSource.updateCart(cart); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left updateCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cart AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
updateCart(cart: Cart): Promise<void> { return this.dataSource.updateCart(cart); }
https://github.com/Joker-x-dev/CoolMallArkTS
bcf9d77454b8ed77fd489cd052d383de3be9a8d1
github
HarmonyOS_Samples/MultiPictureBeautification
features/multipicturebrowsing/src/main/ets/datasource/PictureListDataSource.ets
arkts
totalCount
Get total data count
totalCount(): number { return this.pictureList.length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left totalCount 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...
totalCount(): number { return this.pictureList.length; }
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
9a36be409e2449888b5e205c9d7eb43010641ff8
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/NavigationErrorHandler.ets
arkts
createInvalidParamsError
创建参数无效错误 @param url 路由路径 @param reason 原因 @returns NavigationError
public static createInvalidParamsError(url: string, reason?: string): NavigationError { return new NavigationError( `Invalid navigation params: ${reason || 'unknown'}`, NavigationErrorType.INVALID_PARAMS, url ); }
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 createInvalidParamsError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:...
public static createInvalidParamsError(url: string, reason?: string): NavigationError { return new NavigationError( `Invalid navigation params: ${reason || 'unknown'}`, NavigationErrorType.INVALID_PARAMS, url ); }
https://github.com/LJ666-ui/harmony-health-care
8041dda8e6adb2b0a2768f3dbf1959fbf2670926
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/HighLightInfoOfRectF.ets
arkts
getRadius
获取圆形的半径,仅当shape = HighLightShape.CIRCLE时调用此方法获取半径 @param parentId 父布局id @returns 返回圆的半径
getRadius(parentId?: string): number { if (!this.rectF) { return 0; } return Math.min(this.rectF.getWidth() / 2, this.rectF.getHeight() / 2); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentId AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig...
getRadius(parentId?: string): number { if (!this.rectF) { return 0; } return Math.min(this.rectF.getWidth() / 2, this.rectF.getHeight() / 2); }
https://github.com/wuba/omni-ui
63b6982bcee2cdb308589e65d03897644132fc30
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
sendKeys
发送按键序列(同时按下,延迟后释放)
sendKeys(keyCodes: number[]): void { if (!this.isRunning || keyCodes.length === 0) return; let modifier = 0; for (const key of keyCodes) { this.nativeModule.sendKeyboardInput(key, KEY_ACTION_DOWN, modifier, 0); modifier |= StreamingSession.getModifierForKey(key); } setTimeout(() => {...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCodes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#[#Left [ AST#[#Right AST#]#Left ] A...
sendKeys(keyCodes: number[]): void { if (!this.isRunning || keyCodes.length === 0) return; let modifier = 0; for (const key of keyCodes) { this.nativeModule.sendKeyboardInput(key, KEY_ACTION_DOWN, modifier, 0); modifier |= StreamingSession.getModifierForKey(key); } setTimeout(() => {...
https://github.com/AlkaidLab/moonlight-harmony
b9bac281d5af5f7ead70327f95109d62a97ee51f
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVPlayerModel.ets
arkts
initAVPlayer
初始化AVPlayer @param timeUpdateCb AVPlayer timeUpdate 事件回调 @param stateUpdateCb AVPlayer stateChange 事件回调 @param completeCb AVPlayer 单曲complete状态 事件回调 @returns {Promise<void>}
async initAVPlayer(timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): Promise<void> { if (this.avPlayer) { return; } // 创建AVPlayer实例对象 let avPlayer: media.AVPlayer = await media.createAVPlayer(); if (!avPlayer) { logger.error('avPlayer init failed.'); return...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initAVPlayer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left timeUpdateCb AST#identifier#Righ...
async initAVPlayer(timeUpdateCb: Function, stateUpdateCb: Function, completeCb: Function): Promise<void> { if (this.avPlayer) { return; } // 创建AVPlayer实例对象 let avPlayer: media.AVPlayer = await media.createAVPlayer(); if (!avPlayer) { logger.error('avPlayer init failed.'); return...
https://gitcode.com/arkui-x/samples
210ab9cd2592e7a9abe995a09fef3ee1e34d4635
gitcode
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/AIService.ets
arkts
resolveHttpError
根据 HTTP 状态码返回错误提示。
private resolveHttpError(code: number): string { if (code === 401) { return '请求失败:API Key 无效或已过期,请检查配置'; } if (code === 429) { return '请求失败:请求过于频繁,请稍后再试'; } if (code === 500 || code === 502 || code === 503) { return '请求失败:服务器暂时不可用,请稍后再试'; } return `请求失败,状态码:${code}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveHttpError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private resolveHttpError(code: number): string { if (code === 401) { return '请求失败:API Key 无效或已过期,请检查配置'; } if (code === 429) { return '请求失败:请求过于频繁,请稍后再试'; } if (code === 500 || code === 502 || code === 503) { return '请求失败:服务器暂时不可用,请稍后再试'; } return `请求失败,状态码:${code}`; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/AIService.ets#L332-L343
23c88365045b1b61d88a890202910190d5cc5cc2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Adapters/UnifiedContentAdapter.ets
arkts
toUnifiedChapter
将小说章节转换为统一章节模型
static toUnifiedChapter( chapter: LegadoChapter, index: number, lastReadChapterIndex: number, cachedChapterIndexes: Set<number> ): UnifiedChapter { return { id: chapter.url || String(index), title: chapter.title, index: index, isRead: index <= lastReadChapterIndex, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toUnifiedChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static toUnifiedChapter( chapter: LegadoChapter, index: number, lastReadChapterIndex: number, cachedChapterIndexes: Set<number> ): UnifiedChapter { return { id: chapter.url || String(index), title: chapter.title, index: index, isRead: index <= lastReadChapterIndex, ...
https://github.com/DaLongZhuaZi/manxia
f03bcb1db7058a32d469eb91a92e6ee5a12513ef
github
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/pages/GraphPassPage.ets
arkts
handleTouchEnd
处理触摸结束
handleTouchEnd() { if (!this.isDrawing) return; this.isDrawing = false; if (this.selectedPoints.length >= 4) { this.verifyPattern(); } else { this.promptAction.showToast({ message: '请连接至少4个点', duration: 1500 }); this.resetPattern(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleTouchEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
handleTouchEnd() { if (!this.isDrawing) return; this.isDrawing = false; if (this.selectedPoints.length >= 4) { this.verifyPattern(); } else { this.promptAction.showToast({ message: '请连接至少4个点', duration: 1500 }); this.resetPattern(); } }
https://gitcode.com/openharmony/codelabs
304390ea74e51cb296e87a019179074ce83987cf
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/components/RDPDisplay.ets
arkts
createConnectionRequest
创建RDP连接请求
static createConnectionRequest(config: RDPConnectionConfig): ArrayBuffer { const buffer = new ArrayBuffer(256) const view = new DataView(buffer) // RDP连接请求头 view.setUint32(0, RDPProtocol.RDP_VERSION, true) view.setUint16(4, config.width || 1024, true) view.setUint16(6, config.height || 76...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createConnectionRequest 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#identi...
static createConnectionRequest(config: RDPConnectionConfig): ArrayBuffer { const buffer = new ArrayBuffer(256) const view = new DataView(buffer) // RDP连接请求头 view.setUint32(0, RDPProtocol.RDP_VERSION, true) view.setUint16(4, config.width || 1024, true) view.setUint16(6, config.height || 76...
https://github.com/AetheriumSimulator/qemu-hmos
6664c89dc017169b52974c595e05bcb4c39082c1
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test7_original_index.ets
arkts
testMapIteration
--- Map iteration ---
function testMapIteration(): string { let m: Map<string, number> = new Map(); m.set('a', 1); m.set('b', 2); m.set('c', 3); let keys: string[] = []; m.forEach((v: number, k: string) => { keys.push(k); }); return keys.join(','); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapIteration AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
function testMapIteration(): string { let m: Map<string, number> = new Map(); m.set('a', 1); m.set('b', 2); m.set('c', 3); let keys: string[] = []; m.forEach((v: number, k: string) => { keys.push(k); }); return keys.join(','); }
https://github.com/miaochiahao/ark-ghidra
bc0b914c0ae80b697fd0b402841d9ac91ce63af9
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets
arkts
forEach
Executes a provided function once per each value in the HashSet, in insertion order @param callbackFn to apply; key is always same as value
forEach(callbackFn: HashSetCbFn<T>): void { this.buckets.forEach((value: T, key: T) => { callbackFn(value, key, this); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackFn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left HashSetC...
forEach(callbackFn: HashSetCbFn<T>): void { this.buckets.forEach((value: T, key: T) => { callbackFn(value, key, this); }); }
https://gitcode.com/iop123123/arkts-static-skills
99963f2771ae25c7f6693aa551fd2da821b84e9c
gitcode
lidaixian999/Smart_Car
entry/src/main/ets/model/SsapManager.ets
arkts
unregisterDeviceFoundCallback
注销设备发现回调
private unregisterDeviceFoundCallback(): void { try { scan.off('deviceFound'); hilog.info(this.domainId, this.logTag, 'Device found callback unregistered'); } catch (err) { const error = err as BusinessError; hilog.error(this.domainId, this.logTag, `Unregister callback error - ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left unregisterDeviceFoundCallback 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...
private unregisterDeviceFoundCallback(): void { try { scan.off('deviceFound'); hilog.info(this.domainId, this.logTag, 'Device found callback unregistered'); } catch (err) { const error = err as BusinessError; hilog.error(this.domainId, this.logTag, `Unregister callback error - ...
https://github.com/lidaixian999/Smart_Car
86d3bebd33703d2c4c480ae75ff3ed3edad70c59
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/view/LrcView.ets
arkts
onTimeUpdated
Watch handler: playback time changed; updates active line and scroll or refresh draw.
onTimeUpdated() { if (!this.hasLrc()) { this.drawContent(0); return; } let line = this.findShowLine(this.lyricMilliSecondsTime); if (line !== this.mCurrentLine) { this.mCurrentLine = line; this.smoothScrollTo(line); } else { this.drawContent(this.curCanvasOffsetY); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTimeUpdated 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...
onTimeUpdated() { if (!this.hasLrc()) { this.drawContent(0); return; } let line = this.findShowLine(this.lyricMilliSecondsTime); if (line !== this.mCurrentLine) { this.mCurrentLine = line; this.smoothScrollTo(line); } else { this.drawContent(this.curCanvasOffsetY); ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
b6ca32775b202386b1be46de37c81915f1b4b599
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/ShadowViewModel.ets
arkts
getShadowItems
获取阴影级别列表 @returns 阴影项数组
getShadowItems(): ShadowItem[] { const baseStyle = TnUIGetUIBaseStyle(); return [ new ShadowItem("shadow-sm", "微小阴影,适用于开关滑块、小按钮", "sm", baseStyle.shadowSm), new ShadowItem("shadow-default", "默认阴影,适用于卡片、浮层", "default", baseStyle.shadowDefault), new ShadowItem("shadow-md", "中等阴影,适用于弹窗、下拉菜单", ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getShadowItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left ShadowItem AST#id...
getShadowItems(): ShadowItem[] { const baseStyle = TnUIGetUIBaseStyle(); return [ new ShadowItem("shadow-sm", "微小阴影,适用于开关滑块、小按钮", "sm", baseStyle.shadowSm), new ShadowItem("shadow-default", "默认阴影,适用于卡片、浮层", "default", baseStyle.shadowDefault), new ShadowItem("shadow-md", "中等阴影,适用于弹窗、下拉菜单", ...
https://github.com/codelably/tuniao-ui
5be4f7a9026f3142fae6e746c1e59c08042fe143
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
getCachedLocale
Get cached locale data for a given tag @param tag The BCP47 language tag to lookup @returns Cached ParsedLocaleData or undefined if not found
private static getCachedLocale(tag: string): ParsedLocaleData | undefined { let result: ParsedLocaleData | undefined = undefined; ConcurrencyHelpers.lockGuard(Locale.localeCacheMutex, () => { if (Locale.lastParsedTag == tag && Locale.lastParsedResult != undefined) { ...
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 getCachedLocale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left ...
private static getCachedLocale(tag: string): ParsedLocaleData | undefined { let result: ParsedLocaleData | undefined = undefined; ConcurrencyHelpers.lockGuard(Locale.localeCacheMutex, () => { if (Locale.lastParsedTag == tag && Locale.lastParsedResult != undefined) { ...
https://gitcode.com/iop123123/arkts-static-skills
0b912810940e32041bae2e93eb55910cfee94a08
gitcode
openharmony/arkui_ace_engine
examples/EventProject/entry/src/main/ets/pages/drop/DropAnimationExample.ets
arkts
build
[End drop_customDropAnimation_start]
build() { //[StartExclude dropAnimationExample_start] NavDestination() { //[EndExclude dropAnimationExample_start] Row() { Column() { //[Start drop_image_start] // 请将$r('app.media.app_icon')替换为实际资源文件 Image($r('app.media.app_icon')) .width(100) ...
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() { //[StartExclude dropAnimationExample_start] NavDestination() { //[EndExclude dropAnimationExample_start] Row() { Column() { //[Start drop_image_start] // 请将$r('app.media.app_icon')替换为实际资源文件 Image($r('app.media.app_icon')) .width(100) ...
https://gitcode.com/openharmony/arkui_ace_engine
ad56132136a95071ab712744328d13a29c7ff886
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setDismissOnBackPressed
设置是否支持按返回键关闭弹窗 @param dismiss @returns
setDismissOnBackPressed(dismiss: boolean): Builder { this.popupConfig.dismissOnBackPressed = dismiss return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDismissOnBackPressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dismiss AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right ...
setDismissOnBackPressed(dismiss: boolean): Builder { this.popupConfig.dismissOnBackPressed = dismiss return this }
https://github.com/wuba/omni-ui
6c07f2232b9755e184d3eb2025cbcee4c15f3b4d
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/version_update.ets
arkts
v60_70
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 函数块 // //////// 0.6升级0.7
function v60_70(): string {return '70'}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left v60_70 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...
function v60_70(): string {return '70'}
https://github.com/Nekofox-POT/LinMusic
6965f557f98f3726cfc2078c350f1c68aa4d9ef5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/export/services/ImportService.ets
arkts
importToDatabase
导入数据到数据库 @param exportData 导出数据 @param statistics 统计信息 @param errors 错误列表 @param options 导入选项
private static async importToDatabase( exportData: ExportData, statistics: ImportStatistics, errors: Array<string>, options?: ImportOptions ): Promise<void> { const store = DatabaseManager.getDatabase(); const skipErrors = options?.skipErrors ?? false; try { // 开启事务 await st...
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 importToDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef...
private static async importToDatabase( exportData: ExportData, statistics: ImportStatistics, errors: Array<string>, options?: ImportOptions ): Promise<void> { const store = DatabaseManager.getDatabase(); const skipErrors = options?.skipErrors ?? false; try { // 开启事务 await st...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c1bd4114536cf5fb8f527a8d70cbaefd650c67a6
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
addSyncColumnsIfNeeded
添加同步相关字段(为 WebDAV 同步预留)
private async addSyncColumnsIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.SESSIONS} ADD COLUMN sync_version INTEGER DEFAULT 0`) } catch (error) { console.info('DatabaseService', 'sync_version column m...
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 addSyncColumnsIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
private async addSyncColumnsIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.SESSIONS} ADD COLUMN sync_version INTEGER DEFAULT 0`) } catch (error) { console.info('DatabaseService', 'sync_version column m...
https://github.com/LongLiveY96/chatcube
de8c3667c5494ae708cba1dfce2ff292f19eb9f4
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/OptionGroup.ets
arkts
setSelected
Set the selected option of this group to {@code name}. @param option the option that is selected @throws AlreadySelectedException if an option from this group has already been selected.
public setSelected(option: CliOption | null): void { if (option == null) { // reset the option previously selected this.selected = null; return; } // if no option has already been selected or the // same option is being reselected then set the // selected member variable if ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#...
public setSelected(option: CliOption | null): void { if (option == null) { // reset the option previously selected this.selected = null; return; } // if no option has already been selected or the // same option is being reselected then set the // selected member variable if ...
https://gitee.com/openharmony-sig/commons-cli.git
d0a9d9950ca71eb816613154b8a3ec0154d1508f
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
markProcessing
标记为处理中
markProcessing(): void { this.status = COMMAND_STATUS_PROCESSING; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markProcessing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
markProcessing(): void { this.status = COMMAND_STATUS_PROCESSING; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6e2858134bff21a0b13c4df1887a001b2b490769
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/Rect.ets
arkts
isEmpty
Returns true if the rectangle is empty (left >= right or top >= bottom)
public isEmpty(): boolean { return this.left >= this.right || this.top >= this.bottom; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEmpty 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#boole...
public isEmpty(): boolean { return this.left >= this.right || this.top >= this.bottom; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
fcea011c6702e45dbe40773515b3fe41453ec596
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
getString
Gets a string. @param byteOffset The byte offset. @param byteLength The byte length. @param byteEncoding The byte encoding. @returns The value.
getString(byteOffset: number, byteLength?: number, byteEncoding?: string): string { const decoder = new util.TextDecoder(byteEncoding || "utf-8") const encoded = this.getUint8Array(byteOffset, byteLength) return decoder.decode(encoded) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getString 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#,#R...
getString(byteOffset: number, byteLength?: number, byteEncoding?: string): string { const decoder = new util.TextDecoder(byteEncoding || "utf-8") const encoded = this.getUint8Array(byteOffset, byteLength) return decoder.decode(encoded) }
https://gitee.com/openharmony-sig/flutter_engine.git
b02ee8b2c824e79c01edef4dd04449299fdb791a
gitee
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
scheduleVideoDecode
调度视频帧异步解码 将视频解码从 RTP 处理循环中移出到独立的事件循环迭代, 避免解码阻塞主线程造成 THREAD_BLOCK_6S (ANR)。
private scheduleVideoDecode(frameData: ArrayBuffer, timestamp: number, isKeyFrame: boolean = false): void { // 关键帧到达:清空队列,从关键帧开始新的解码序列 if (isKeyFrame) { this.pendingVideoFrames = [frameData]; this.pendingVideoTimestamps = [timestamp]; this.pendingVideoKeyFrames = [true]; LogUtil...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleVideoDecode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left frameData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private scheduleVideoDecode(frameData: ArrayBuffer, timestamp: number, isKeyFrame: boolean = false): void { // 关键帧到达:清空队列,从关键帧开始新的解码序列 if (isKeyFrame) { this.pendingVideoFrames = [frameData]; this.pendingVideoTimestamps = [timestamp]; this.pendingVideoKeyFrames = [true]; LogUtil...
https://github.com/tdcare/tdwebrtc
9a5c1fd968f6a1b1f12fbf01edf5ab660bbc86af
github
openharmony/vendor_unionman
unionpi_tiger/sample_api10/app/adc_module_app/entry/src/main/ets/pages/welcome.ets
arkts
build
新建一个tempinfotable对象
build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) .id("welcomePage") .onClick(()=>{ let globalContext = GlobalContext.getContext() globalContext.setObject("obj",this.TempInfoobj) rout...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) .id("welcomePage") .onClick(()=>{ let globalContext = GlobalContext.getContext() globalContext.setObject("obj",this.TempInfoobj) rout...
https://gitee.com/openharmony/vendor_unionman.git
96b6b3d93450755ca56e9980e67fc114bd72f000
gitee
somnio-software/my-bot-pal
entry/src/main/ets/utils/PermissionUtils.ets
arkts
setDefaultResponse
Sets the default response for permission requests @param granted Whether permissions should be granted by default
public setDefaultResponse(granted: boolean): void { this.defaultResponse = granted; console.log(`[MOCK] Default permission response set to: ${granted ? 'GRANT' : 'DENY'}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDefaultResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left granted AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public setDefaultResponse(granted: boolean): void { this.defaultResponse = granted; console.log(`[MOCK] Default permission response set to: ${granted ? 'GRANT' : 'DENY'}`); }
https://github.com/somnio-software/my-bot-pal
3e782ecdbcf135783cc6e8abb356b93b60e6122a
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setScaleMinima
Sets the minimum scale factor value to which can be zoomed out. 1f = fitScreen @param scaleX @param scaleY
public setScaleMinima(scaleX: number, scaleY: number): void { this.mViewPortHandler.setMinimumScaleX(scaleX); this.mViewPortHandler.setMinimumScaleY(scaleY); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setScaleMinima 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...
public setScaleMinima(scaleX: number, scaleY: number): void { this.mViewPortHandler.setMinimumScaleX(scaleX); this.mViewPortHandler.setMinimumScaleY(scaleY); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8c29fffa98db6f0262bdadfd9956183d9185a34a
gitee
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseView.ets
arkts
onInvoke
Handles an ArkTS view event. @param key Event key @param params Event parameters
onInvoke(key: string, params: HybridInvokeCallback): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onInvoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R...
onInvoke(key: string, params: HybridInvokeCallback): void { }
https://github.com/AGenUI/AGenUI
8e5d8ca2d37851f62812d6ca54df5ddcca95a041
github
CLMC2025/Vignette
entry/src/main/ets/context/ContextValidator.ets
arkts
constructor
0-100分
constructor() { this.isValid = true; this.issues = []; this.score = 100; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.isValid = true; this.issues = []; this.score = 100; }
https://github.com/CLMC2025/Vignette
8d4d6e927c20f18040277f6dac4b5a1a0a6d389e
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/viewmodel/ChatViewModel.ets
arkts
getUserLocation
Gets the user's current location using location service Falls back to last known location or default coordinates if needed @returns Promise with location data
private async getUserLocation(): Promise<LocationData> { if (!this.locationService.isLocationEnabled()) { console.warn('Location is not enabled on the device'); return this.defaultLocation; } try { return await this.locationService.getCurrentLocation(false, 15000); } catch (error) {...
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 getUserLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async getUserLocation(): Promise<LocationData> { if (!this.locationService.isLocationEnabled()) { console.warn('Location is not enabled on the device'); return this.defaultLocation; } try { return await this.locationService.getCurrentLocation(false, 15000); } catch (error) {...
https://github.com/somnio-software/my-bot-pal
c03518cf3d19d0eeed710ec728f225fcafcc5825
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
getTopicById
Get a single topic by ID
async getTopicById(topicId: number, cacheBuster: number = 0): Promise<V2exTopic[]> { if (topicId <= 0) { return [] } const endpoint = cacheBuster > 0 ? `${ApiConstants.API_TOPIC_SHOW}?id=${topicId}&_=${cacheBuster}` : `${ApiConstants.API_TOPIC_SHOW}?id=${topicId}` try { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getTopicById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left topicId AST#identifier#Right AST...
async getTopicById(topicId: number, cacheBuster: number = 0): Promise<V2exTopic[]> { if (topicId <= 0) { return [] } const endpoint = cacheBuster > 0 ? `${ApiConstants.API_TOPIC_SHOW}?id=${topicId}&_=${cacheBuster}` : `${ApiConstants.API_TOPIC_SHOW}?id=${topicId}` try { ...
https://github.com/honjow/Next2V
01a7edf2d3383159fe67328f0d7b87eca1cb426b
github
tdcare/tdwebrtc
example/MediaStreamAdvancedExample.ets
arkts
initVideoSender
初始化视频发送端
public async initVideoSender(surfaceId: string): Promise<boolean> { if (!this.mediaStream) { return false; } return await this.mediaStream.initializeVideoSender(surfaceId); }
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 initVideoSender AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async initVideoSender(surfaceId: string): Promise<boolean> { if (!this.mediaStream) { return false; } return await this.mediaStream.initializeVideoSender(surfaceId); }
https://github.com/tdcare/tdwebrtc
67a93388387dc0656ed11728a473caf9c2cee7aa
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from a set of type std.core.Set<BigInt>. @param { Set<BigInt> } set - A set object to convert to an array. @returns { BigInt64Array } - A new BigInt64Array @throws { RangeError } - Input parameter error. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(set: Set<BigInt>): BigInt64Array { const length = set.size; const result = new BigInt64Array(length) let iter = set.$_iterator() for (let i:int = 0; i < length; ++i) { const x = iter.next() if (x.done) { throw new RangeError(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ...
public static from(set: Set<BigInt>): BigInt64Array { const length = set.size; const result = new BigInt64Array(length) let iter = set.$_iterator() for (let i:int = 0; i < length; ++i) { const x = iter.next() if (x.done) { throw new RangeError(...
https://gitcode.com/iop123123/arkts-static-skills
c5b95238c3794ad1eb79e52631ce86a77e933a5d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
buildDownloadHeaders
构建下载请求头
private buildDownloadHeaders(customHeaders?: Record<string, string>): Record<string, string> { const headers: Record<string, string> = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36' }; if (customHeaders) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildDownloadHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left customHeaders AST#identifier#Right AST#ERROR#Left AST#?#Left...
private buildDownloadHeaders(customHeaders?: Record<string, string>): Record<string, string> { const headers: Record<string, string> = { 'User-Agent': 'Mozilla/5.0 (Linux; Android 13; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36' }; if (customHeaders) { ...
https://github.com/DaLongZhuaZi/manxia
5a939a4903b7195f01fb98d906a6b522fce066be
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
executeRecovery
执行恢复策略
public async executeRecovery(strategy: RecoveryStrategy, failureType: StartupFailureType): Promise<RecoveryResult> { if (this.isRecovering) { const busyResult: RecoveryResult = { success: false, strategy, message: '恢复操作正在进行中,请稍候' }; return busyResult; } this.isRe...
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 executeRecovery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strategy AST#identifier#Right AST#:#Left...
public async executeRecovery(strategy: RecoveryStrategy, failureType: StartupFailureType): Promise<RecoveryResult> { if (this.isRecovering) { const busyResult: RecoveryResult = { success: false, strategy, message: '恢复操作正在进行中,请稍候' }; return busyResult; } this.isRe...
https://github.com/DaLongZhuaZi/manxia
3156047d9f8750fb902ac38376d41b282cf8445b
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/BillDatabase.ets
arkts
queryBillsByYearAndCategory
按年和分类查询账单
async queryBillsByYearAndCategory(year: string, category: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.like('date', `${year}%`); predicates.eq...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryBillsByYearAndCategory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifi...
async queryBillsByYearAndCategory(year: string, category: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.like('date', `${year}%`); predicates.eq...
https://github.com/qiuhaotc/HarmonyOSPlayground
74873499dc6d2cb128ad79422a2795a2245cf243
github
seagazer/cclyric
lib/src/main/ets/CcLyricController.ets
arkts
setLyric
Set the lyric. @param data The lyric.
public setLyric(data: Lrc | undefined): CcLyricController { this.lyric = data this.onDataChanged?.(data) return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLyric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left ...
public setLyric(data: Lrc | undefined): CcLyricController { this.lyric = data this.onDataChanged?.(data) return this }
https://github.com/seagazer/cclyric
3d661650be9162560307b3f53b4329d21ae27bb5
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/ThemeManager.ets
arkts
getCurrentColors
获取当前主题颜色 注:已移除深色/浅色模式区分,统一使用 lightColors @returns 当前 NDSThemeColors 对象
public getCurrentColors(): NDSThemeColors { const theme = this.getCurrentTheme(); return theme.lightColors; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentColors 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 NDSTh...
public getCurrentColors(): NDSThemeColors { const theme = this.getCurrentTheme(); return theme.lightColors; }
https://github.com/richshaw2015/nds
a7b65c0576b9ecf369dc508852394906ecc43bfc
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test51_original_index.ets
arkts
weightedSelect
--- Weighted random selection ---
function weightedSelect(items: string[], weights: number[], seed: number): string { let total: number = 0; for (let i: number = 0; i < weights.length; i++) { total = total + weights[i]; } let r: number = seed % total; let cumulative: number = 0; for (let i: number = 0; i < items.length; i++) { cumul...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left weightedSelect AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left items AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function weightedSelect(items: string[], weights: number[], seed: number): string { let total: number = 0; for (let i: number = 0; i < weights.length; i++) { total = total + weights[i]; } let r: number = seed % total; let cumulative: number = 0; for (let i: number = 0; i < items.length; i++) { cumul...
https://github.com/miaochiahao/ark-ghidra
4894d185d7168f22302cb2786a537828388502c8
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/view/AlgorithmListView.ets
arkts
handleColorModeChange
监听颜色模式变化
handleColorModeChange() { this.cardComponentDataViewModel.sendEvent<OffsetParam>({ type: BaseHomeEventTypeEnum.HANDLE_COLOR_CHANGE, param: { yOffset: (this.scroller?.currentOffset()?.yOffset || 0), tabIndex: TabBarTypeEnum.DESIGNPATTERN }, }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleColorModeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl...
handleColorModeChange() { this.cardComponentDataViewModel.sendEvent<OffsetParam>({ type: BaseHomeEventTypeEnum.HANDLE_COLOR_CHANGE, param: { yOffset: (this.scroller?.currentOffset()?.yOffset || 0), tabIndex: TabBarTypeEnum.DESIGNPATTERN }, }) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
44155bde8267f870a74eee61300d24e8f62800f8
gitcode
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
updateProfile
更新用户资料
static async updateProfile(updates: Record<string, string>): Promise<UserResponse> { console.info('AuthApi.updateProfile: Sending updates: ' + JSON.stringify(updates)); const response = await httpClient.put('/user/profile', JSON.stringify(updates)); console.info('AuthApi.updateProfile: HTTP code=' + respo...
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 updateProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left updates AST#identifier#Right AST#:#Left : ...
static async updateProfile(updates: Record<string, string>): Promise<UserResponse> { console.info('AuthApi.updateProfile: Sending updates: ' + JSON.stringify(updates)); const response = await httpClient.put('/user/profile', JSON.stringify(updates)); console.info('AuthApi.updateProfile: HTTP code=' + respo...
https://github.com/Harrisonls2004/WaterFlow
8fcc667c2c78245b0495054bec4855fb9b57e4ee
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setUTCMonth
Sets the month for a specified date according to universal time. @param { int } month new month @param { int } date @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setUTCMonth(month: int, date: int): long { this.setUTCMonth(month); this.setUTCDate(date); return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left month AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public setUTCMonth(month: int, date: int): long { this.setUTCMonth(month); this.setUTCDate(date); return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
e06b710bcd40d9b7e539796fca740dfc30b66b6b
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/XAxis.ets
arkts
setCustomLabels
设置自定义Labels @param numbers labels数组
public setCustomLabels(numbers: number[]): void { this.customLabels = numbers; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCustomLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_exp...
public setCustomLabels(numbers: number[]): void { this.customLabels = numbers; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
333737ab4feaabaaf9d9295eef85117410ef9605
gitee
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/utils/WeatherIconHelper.ets
arkts
getCustomIcon
Get custom icon for condition using switch statement
private getCustomIcon(condition: WeatherCondition): Resource | undefined { if (!this.customIcons) { return undefined }; switch (condition) { case WeatherCondition.SUNNY: return this.customIcons.sunny; case WeatherCondition.PARTLY_CLOUDY: return this.customIcons.partl...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCustomIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left condition AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private getCustomIcon(condition: WeatherCondition): Resource | undefined { if (!this.customIcons) { return undefined }; switch (condition) { case WeatherCondition.SUNNY: return this.customIcons.sunny; case WeatherCondition.PARTLY_CLOUDY: return this.customIcons.partl...
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
12d8c5df9d81861f0088e7158f0da9a96bb3f74e
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
collectGeneratedMediaUsageRows
==================== 生图统计聚合查询 ==================== 拉取 generated_media 的轻量统计行(按 created_at 范围过滤),内存聚合
private async collectGeneratedMediaUsageRows(rangeStartMs: number): Promise<MediaUsageRow[]> { const rows: MediaUsageRow[] = [] if (this.rdbStore === null) { return rows } const predicates = new relationalStore.RdbPredicates(TableNames.GENERATED_MEDIA) this.applyUsageRange(predicates, 'creat...
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 collectGeneratedMediaUsageRows AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rangeStartMs AST#identifier#Right AST...
private async collectGeneratedMediaUsageRows(rangeStartMs: number): Promise<MediaUsageRow[]> { const rows: MediaUsageRow[] = [] if (this.rdbStore === null) { return rows } const predicates = new relationalStore.RdbPredicates(TableNames.GENERATED_MEDIA) this.applyUsageRange(predicates, 'creat...
https://github.com/LongLiveY96/chatcube
911dcc7f25b4838c179ab42ec04de6da7d222dbb
github
openharmony/codelabs
ETSUI/TargetManagement/entry/src/main/ets/pages/MainPage.ets
arkts
saveTask
Save the progress value and update time after you click OK in the dialog box. @param taskName Latest Progress Value.
saveTask(taskName: string) { if (taskName === '') { promptAction.showToast({ message: $r('app.string.cannot_input_empty'), duration: CommonConstants.TOAST_TIME, bottom: CommonConstants.TOAST_MARGIN_BOTTOM }); return; } DataModel.addData(new TaskItemViewModel(taskN...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left saveTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left taskName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Le...
saveTask(taskName: string) { if (taskName === '') { promptAction.showToast({ message: $r('app.string.cannot_input_empty'), duration: CommonConstants.TOAST_TIME, bottom: CommonConstants.TOAST_MARGIN_BOTTOM }); return; } DataModel.addData(new TaskItemViewModel(taskN...
https://gitee.com/openharmony/codelabs.git
07b8b3f1508da2b5a2e2828e9b5d9dcd8ac6b55a
gitee
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
playRandom
Picks a random queue index different from the current one (when length > 1).
private playRandom() { const len = this.getQueueLength(); if (len <= 1) { if (len === 1) { this.loadAsset(0); } return; } // Uniform on {0..len-1} \ {musicIndex}; avoids recursion and stack overflow on repeated collisions. const k: number = Math.floor(Math.random() * (len...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left playRandom 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 playRandom() { const len = this.getQueueLength(); if (len <= 1) { if (len === 1) { this.loadAsset(0); } return; } // Uniform on {0..len-1} \ {musicIndex}; avoids recursion and stack overflow on repeated collisions. const k: number = Math.floor(Math.random() * (len...
https://gitcode.com/HarmonyOS_Samples/MusicHome
be752c0037f569e37110ee55bd641b980d2eecd1
gitcode
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/UserState.ets
arkts
shouldRefreshToken
是否需要刷新 token(过期前15分钟) @returns {boolean} 是否需要刷新 @example const needRefresh = getUserState().shouldRefreshToken();
shouldRefreshToken(): boolean { if (!this.auth) { return false; } return this.auth.shouldRefresh(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldRefreshToken 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#...
shouldRefreshToken(): boolean { if (!this.auth) { return false; } return this.auth.shouldRefresh(); }
https://github.com/Joker-x-dev/CoolMallArkTS
61feb97b8f934b35d6431aeda521fd583cd38bb8
github
CLMC2025/Vignette
entry/src/main/ets/manager/SessionPlanner.ets
arkts
getTypeIcon
获取任务类型图标
getTypeIcon(): string { return '📖'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTypeIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_...
getTypeIcon(): string { return '📖'; }
https://github.com/CLMC2025/Vignette
1efb2890ec3b1759878e1b1cef51a5a353745a0c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets
arkts
stripHtmlTags
移除HTML标签
private stripHtmlTags(html: string): string { return html .replace(/<[^>]*>/g, '') .replace(/&nbsp;/g, ' ') .replace(/&amp;/g, '&') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>') .replace(/&quot;/g, '"') .replace(/&#39;/g, "'") .trim(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stripHtmlTags 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#identifier#Left...
private stripHtmlTags(html: string): string { return html .replace(/<[^>]*>/g, '') .replace(/&nbsp;/g, ' ') .replace(/&amp;/g, '&') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>') .replace(/&quot;/g, '"') .replace(/&#39;/g, "'") .trim(); }
https://github.com/DaLongZhuaZi/manxia
041e56bab8971ed3018a83b8812851db00894046
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/Evaluator.ets
arkts
sendMsg
send msg @param exp string
sendMsg(exp: string, angles: String): void { if (exp !== null && exp !== undefined && exp.length > 1) { if (this.isOperatorChar(exp?.substr(exp.length - 1, exp.length))) { exp = exp?.substr(0, exp.length - 1); } } this.worker.postMessage({ exp: exp, angles: angles }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left exp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Ri...
sendMsg(exp: string, angles: String): void { if (exp !== null && exp !== undefined && exp.length > 1) { if (this.isOperatorChar(exp?.substr(exp.length - 1, exp.length))) { exp = exp?.substr(0, exp.length - 1); } } this.worker.postMessage({ exp: exp, angles: angles }); }
https://gitee.com/openharmony-sig/applications_calculator.git
11f1fdac04fe37a4c84d767a89e8af432f144780
gitee
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/common/database/ContactsDataBase.ets
arkts
save
Adds a key-value pair of a specified type to the database. If the key value exists, modify the data. Otherwise, add data. @param The Key Key of the data to be added. @param The value of the data to be added.
save(key: string, value: string): void { try { this.kvStore?.put(key, value); } catch (err) { Logger.error(TAG, `Put an unexpected error occured, error message is ${JSON.stringify(err)}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left save AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right...
save(key: string, value: string): void { try { this.kvStore?.put(key, value); } catch (err) { Logger.error(TAG, `Put an unexpected error occured, error message is ${JSON.stringify(err)}`); } }
https://gitee.com/harmonyos/codelabs.git
1aa232f9c35117433d72c98f30026a7fbed37785
gitee
YANGZX22/Voot
entry/src/main/ets/storage/AsrModelStorage.ets
arkts
setSenseVoiceDownloaded
设置 SenseVoice 模型下载状态
static async setSenseVoiceDownloaded(ctx: common.UIAbilityContext, downloaded: boolean): Promise<void> { const config = await AsrModelStorage.loadConfig(ctx); config.senseVoiceDownloaded = downloaded; if (downloaded && config.currentModel === AsrModelType.MOONSHINE_EN) { // 下载完成后自动切换到多语言模型 con...
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 setSenseVoiceDownloaded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#L...
static async setSenseVoiceDownloaded(ctx: common.UIAbilityContext, downloaded: boolean): Promise<void> { const config = await AsrModelStorage.loadConfig(ctx); config.senseVoiceDownloaded = downloaded; if (downloaded && config.currentModel === AsrModelType.MOONSHINE_EN) { // 下载完成后自动切换到多语言模型 con...
https://github.com/YANGZX22/Voot
8dd6d2cce830690e5af66ad838531fee939b5d2a
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/SunAngleHelper.ets
arkts
normalizeAngle
将角度规范化到0-360度范围内
private normalizeAngle(angle: number): number { let normalized = angle % 360; if (normalized < 0) { normalized += 360; } return normalized; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private normalizeAngle(angle: number): number { let normalized = angle % 360; if (normalized < 0) { normalized += 360; } return normalized; }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
714bebb0f470ac9cbd7b7c959f6eda62641b9077
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets
arkts
getLocalSettings
── Settings ──
async getLocalSettings(): Promise<ResultEnvelope<LocalSettings>> { try { const jsonStr: string = this.getNativeModule().nativeLoadLocalSettings() return this.parseEnvelope<LocalSettings>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_erro...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLocalSettings AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gen...
async getLocalSettings(): Promise<ResultEnvelope<LocalSettings>> { try { const jsonStr: string = this.getNativeModule().nativeLoadLocalSettings() return this.parseEnvelope<LocalSettings>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_erro...
https://github.com/Xiwei753/xiezuoruanjian
a38d43161f013ef69120f65a936e06463eb284c4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets
arkts
analyzePermanentCache
分析永久图片缓存
private async analyzePermanentCache(): Promise<StorageItem> { try { const context = uiContextManager.getAbilityContext(); if (!context) { logger.warn(TAG, 'Context未初始化,无法分析永久缓存'); return this.createEmptyItem(StorageType.PERMANENT_CACHE, '永久图片缓存'); } const permanentCa...
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 analyzePermanentCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private async analyzePermanentCache(): Promise<StorageItem> { try { const context = uiContextManager.getAbilityContext(); if (!context) { logger.warn(TAG, 'Context未初始化,无法分析永久缓存'); return this.createEmptyItem(StorageType.PERMANENT_CACHE, '永久图片缓存'); } const permanentCa...
https://github.com/DaLongZhuaZi/manxia
025db4b8a94d02931887fbc9a7b4a7b5fd53a57d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_byte.ets
arkts
main
--- desc: check bitwise XOR of two bytes ---
function main(): void { const a: byte = {{v.left}} const b: byte = {{v.right}} assert (a ^ b) == {{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 { const a: byte = {{v.left}} const b: byte = {{v.right}} assert (a ^ b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
be18d18f587f383e25692f71b447be91bf95d157
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Float.ets
arkts
createFromJSONValue
Creates a Float instance based on JSONValue @param json: JSONValue - a JSON representation @throws JSONTypeError if json does not encode a valid float @returns Float - float value decoded from JSON
static createFromJSONValue(json: JSONValue): Float { if (json instanceof JSONNumber) { let val = (json as JSONNumber).value if (-Float.MAX_VALUE <= val && val <= Float.MAX_VALUE) { return Float.valueOf((json as JSONNumber).value as float) } } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFromJSONValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static createFromJSONValue(json: JSONValue): Float { if (json instanceof JSONNumber) { let val = (json as JSONNumber).value if (-Float.MAX_VALUE <= val && val <= Float.MAX_VALUE) { return Float.valueOf((json as JSONNumber).value as float) } } ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5bb1f215db2b07a0a15dee7505060d189ff2015d
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Error.ets
arkts
constructor
Constructs a new error instance with provided message @param msg message of the error
constructor(msg: String) { this.message = msg; this.cause = this; this.name = "Error"; this.provisionStackTrace() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#identifier#Right AS...
constructor(msg: String) { this.message = msg; this.cause = this; this.name = "Error"; this.provisionStackTrace() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
fd1cbc9f34bd52f4e2392b18976663b2b27e1ac3
gitee
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets
arkts
updateSettings
更新提醒设置
updateSettings(newSettings: ReminderSettings): void { this.settings = newSettings; console.log('提醒设置已更新'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newSettings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReminderSettings AST#identifier#Ri...
updateSettings(newSettings: ReminderSettings): void { this.settings = newSettings; console.log('提醒设置已更新'); }
https://gitcode.com/openharmony/codelabs
cebc9cc53080d70b074dc614ea6597aa2995e29e
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/LearningRecorder.ets
arkts
newlyLearnedCount
Count of words that crossed 0→1 correctness in the current session.
get newlyLearnedCount(): number { return this.sessionNewlyLearnedIds.size; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left newlyLearnedCount 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...
get newlyLearnedCount(): number { return this.sessionNewlyLearnedIds.size; }
https://github.com/terryma2024/happyword
f15f2c09928bf7dcb88c4ba0bd5535a3fd865cc5
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
constructor
The Writable constructor.
constructor() { this.doWriteFunc = this.noWriteOpes; this.doWritevFunc = null; this.listener = new EventEmitter(); this.buffer = []; this.closedInner = false; this.defaultEncoding = DEFAULT_ENCODING; this.encoding = DEFAULT_ENCO...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.doWriteFunc = this.noWriteOpes; this.doWritevFunc = null; this.listener = new EventEmitter(); this.buffer = []; this.closedInner = false; this.defaultEncoding = DEFAULT_ENCODING; this.encoding = DEFAULT_ENCO...
https://gitcode.com/iop123123/arkts-static-skills
788bd591e9f8bdbc2b11addc8161ac28c1761fd9
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WordPackBootstrapper.ets
arkts
bootstrapPackLibrary
V0.6.5.1 — read-only / offline cold-start composer for the three-layer Pack model. Loads: - built-in packs from `rawfile/data/builtin/*.json` (5 files); - global packs from `wordmagic_global_packs` prefs cache (no network); - family packs from `wordmagic_family_packs` prefs cache (no network), adapted from FamilyPacksB...
static async bootstrapPackLibrary(ctx: common.UIAbilityContext): Promise<PackLibrary> { const lib: PackLibrary = new PackLibrary(); // 1. Built-in packs — deterministic order, scene metadata baked in. const builtinPromise: Promise<Pack[]> = BuiltinPackLoader.loadAll(ctx); // 2. Global packs — warm f...
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 bootstrapPackLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left...
static async bootstrapPackLibrary(ctx: common.UIAbilityContext): Promise<PackLibrary> { const lib: PackLibrary = new PackLibrary(); // 1. Built-in packs — deterministic order, scene metadata baked in. const builtinPromise: Promise<Pack[]> = BuiltinPackLoader.loadAll(ctx); // 2. Global packs — warm f...
https://github.com/terryma2024/happyword
bf1c3373f64009ecd7cf9d5f56d64ea7ddbda583
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
reduce
Executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value. Order is from left-to-right. @param fn reduce function @para...
public reduce<U>(fn: (a: U, b: T) => U, initVal: U): U { let acc: U = initVal for(let i = 0; i < this.data.length; i++) { acc = fn(acc, this.data[i]) } return acc }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#...
public reduce<U>(fn: (a: U, b: T) => U, initVal: U): U { let acc: U = initVal for(let i = 0; i < this.data.length; i++) { acc = fn(acc, this.data[i]) } return acc }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ccf15cb4093a00889c0cae74eaec2be0dba17f74
gitee
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/component/GoodsCategoryFilterBar.ets
arkts
build
构建筛选与排序栏 @returns {void} 无返回值
build(): void { RowStartCenter({ widthValue: P100 }) { Row() { IBestDropdownMenu({ groupId: this.dropdownGroupId, controller: this.dropdownMenuController, menuHeight: 32, bgColor: $r("app.color.bg_grey") }) { IBestDropdownItem({ g...
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 { RowStartCenter({ widthValue: P100 }) { Row() { IBestDropdownMenu({ groupId: this.dropdownGroupId, controller: this.dropdownMenuController, menuHeight: 32, bgColor: $r("app.color.bg_grey") }) { IBestDropdownItem({ g...
https://github.com/Joker-x-dev/CoolMallArkTS
52b6b9200331a5534cd16e4bd346abecfba2b23f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
allSettled
Create a promise that will be resolved after all promises are completed @param promises iterable object of promise-like objects @returns { Promise } promise that will be resolved after all promises are completed with an array of results
static allSettled<U>(promises: Iterable<PromiseLike<U>|U>): Promise<PromiseSettledResult<Awaited<U>>[]> { try { return Promise.allSettled<U>(Promise.toArray(promises)); } catch (e) { // NOTE(csaba.osztrogonac): remove as cast once e has Error type return Promise.r...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left allSettled AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri...
static allSettled<U>(promises: Iterable<PromiseLike<U>|U>): Promise<PromiseSettledResult<Awaited<U>>[]> { try { return Promise.allSettled<U>(Promise.toArray(promises)); } catch (e) { // NOTE(csaba.osztrogonac): remove as cast once e has Error type return Promise.r...
https://gitcode.com/iop123123/arkts-static-skills
94c1df42b455832528f438c0b22e16a3d3064910
gitcode
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/image/NetWorkImage.ets
arkts
build
构建网络图片组件 @returns {void} 无返回值
build(): void { Stack() { if (this.showBackground) { Column() .width(P100) .height(P100) .backgroundColor(this.backgroundColorValue) .borderRadius(this.cornerRadius ?? 0); } if (this.model) { if ( (this.widthValue ?? this.sizeVal...
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 { Stack() { if (this.showBackground) { Column() .width(P100) .height(P100) .backgroundColor(this.backgroundColorValue) .borderRadius(this.cornerRadius ?? 0); } if (this.model) { if ( (this.widthValue ?? this.sizeVal...
https://github.com/Joker-x-dev/CoolMallArkTS
3694a09c0cbf275558b35dc8e400948898b9767e
github
HarmonyOS_Samples/BestPracticeSnippets
VideoProcessBaseWeb/entry/src/main/ets/utils/WebDownloadManager.ets
arkts
constructor
[StartExclude manage]
private constructor() { super() }
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() { super() }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
c269c58d6109af31c63a83f6c99290294e436b05
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets
arkts
isEmpty
Checks if the HashSet is empty @returns true if the HashSet is empty, false otherwise
isEmpty(): boolean { return this.buckets.length === 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty 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#statement_b...
isEmpty(): boolean { return this.buckets.length === 0; }
https://gitcode.com/iop123123/arkts-static-skills
2155882d61e51ce0bbc0705404bc93121878dbd9
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
sub
Return a new Decimal whose value is the value of this Decimal minus `n`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value } n {double | string | Decimal} @returns { Decimal } the Decimal type
public sub(n: Value): Decimal { let y: Decimal = new Decimal(n); let x = this; if (!x.d || !y.d) { if (!x.s || !y.s) { y = new Decimal(NaN); } else if (x.d) { y.sign = -y.s; } else { y = new Decimal(y.d || x....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sub AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
public sub(n: Value): Decimal { let y: Decimal = new Decimal(n); let x = this; if (!x.d || !y.d) { if (!x.s || !y.s) { y = new Decimal(NaN); } else if (x.d) { y.sign = -y.s; } else { y = new Decimal(y.d || x....
https://gitcode.com/iop123123/arkts-static-skills
161e328dee61bc645272b40755d6a02742cc679b
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setVisibleXRangeMinimum
Sets the size of the area (range on the x-axis) that should be minimum visible at once (no further zooming in allowed). If this is e.g. set to 10, no less than a range of 10 on the x-axis can be viewed at once without scrolling. @param minXRange The minimum visible range of x-values.
public setVisibleXRangeMinimum(minXRange: number): void { let xScale: number = 1; if (this.mXAxis) { xScale = this.mXAxis.mAxisRange / (minXRange); } this.mViewPortHandler.setMaximumScaleX(xScale); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVisibleXRangeMinimum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minXRange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ...
public setVisibleXRangeMinimum(minXRange: number): void { let xScale: number = 1; if (this.mXAxis) { xScale = this.mXAxis.mAxisRange / (minXRange); } this.mViewPortHandler.setMaximumScaleX(xScale); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d95bbe1fd156013ba004495caa32196d3a6c3c70
gitee
gongshijier/harmonyLab
entry/src/main/ets/feed/load/db/DBHelper.ets
arkts
query
query item
query() { let promisequery = this.dbInstance.query(new db.RdbPredicates("test")) promisequery.then((resultSet) => { console.log("resultSet column names:" + resultSet.columnNames) console.log("resultSet column count:" + resultSet.columnCount) resultSet.goToFirstRow() const id = resultS...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Left AST#le...
query() { let promisequery = this.dbInstance.query(new db.RdbPredicates("test")) promisequery.then((resultSet) => { console.log("resultSet column names:" + resultSet.columnNames) console.log("resultSet column count:" + resultSet.columnCount) resultSet.goToFirstRow() const id = resultS...
https://github.com/gongshijier/harmonyLab
aa96986ef6e6e50615a5d4139d00a9ab3d2376d4
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/BillStatisticsUtil.ets
arkts
getCumulativeStatistics
获取累积统计数据
static getCumulativeStatistics(bills: BillModel[]): CumulativeStats[] { // 按日期排序 const sortedBills = [...bills].sort((a: BillModel, b: BillModel) => a.date.localeCompare(b.date)); const result: CumulativeStats[] = []; let cumulativeIncome = 0; let cumulativeExpense ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCumulativeStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri...
static getCumulativeStatistics(bills: BillModel[]): CumulativeStats[] { // 按日期排序 const sortedBills = [...bills].sort((a: BillModel, b: BillModel) => a.date.localeCompare(b.date)); const result: CumulativeStats[] = []; let cumulativeIncome = 0; let cumulativeExpense ...
https://github.com/qiuhaotc/HarmonyOSPlayground
03f15f73106242c49d29b49d727ba21dd60c7e40
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
getSecondaryStyle
获取次要文字样式参数 @param mode 应用模式
public static getSecondaryStyle(mode: FontApplyMode = FontApplyMode.FONT_AND_SCALE): TextStyleParams { const baseFontSize = 12; return FontAwareHelper.buildTextStyle(baseFontSize, FontScene.APP_UI, mode); }
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 getSecondaryStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left ...
public static getSecondaryStyle(mode: FontApplyMode = FontApplyMode.FONT_AND_SCALE): TextStyleParams { const baseFontSize = 12; return FontAwareHelper.buildTextStyle(baseFontSize, FontScene.APP_UI, mode); }
https://github.com/DaLongZhuaZi/manxia
559d01bd82199ee9e0de3d8092b684d6a85e4488
github
fbinba3955/Flymby
main/src/main/ets/pages/home/media/EmbyEpisodeDetail/components/PlayButtonComponent.ets
arkts
isCurrentEpisodeHasPlayPercent
当前剧集是否存在播放进度
isCurrentEpisodeHasPlayPercent(): boolean { return !!(this.mEpisodeDetail?.UserData?.PlayedPercentage && this.mEpisodeDetail?.UserData?.PlayedPercentage > 0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCurrentEpisodeHasPlayPercent 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#ERRO...
isCurrentEpisodeHasPlayPercent(): boolean { return !!(this.mEpisodeDetail?.UserData?.PlayedPercentage && this.mEpisodeDetail?.UserData?.PlayedPercentage > 0) }
https://github.com/fbinba3955/Flymby
0f9e0b7cb483b5c8ae7976725273a7069cd8f161
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncCondVarBasedMutex.ets
arkts
notifyAll
Unblocks ALL suspended coroutine associated with this CondVar. @returns { void } No return value. @syscap SystemCapability.Utils.Lang @FaAndStageModel pre-condition: mutex is locked. post-condition: mutex is locked.
public notifyAll(): void { while (this.waiters_ != 0) { this.waitersList_.resume(); this.waiters_--; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyAll 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_s...
public notifyAll(): void { while (this.waiters_ != 0) { this.waitersList_.resume(); this.waiters_--; } }
https://gitcode.com/iop123123/arkts-static-skills
67083083039f2542964a7f060e1e206719e158bc
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
buildExtractScript
构建提取脚本
private buildExtractScript(selector: string, extractor: string, multiple: boolean): string { let extractCode = ''; if (extractor === 'text') { extractCode = 'el.textContent || \'\''; } else if (extractor.startsWith('attr:')) { const attrName = extractor.substring(5); extractCode = `...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildExtractScript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
private buildExtractScript(selector: string, extractor: string, multiple: boolean): string { let extractCode = ''; if (extractor === 'text') { extractCode = 'el.textContent || \'\''; } else if (extractor.startsWith('attr:')) { const attrName = extractor.substring(5); extractCode = `...
https://github.com/DaLongZhuaZi/manxia
b8bbd09532cb5317b2c1b9df737f83f1887bd5c3
github
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/view/home/WeekCalendarComponent.ets
arkts
ArrowIcon
日历的左右箭头
ArrowIcon(isRight: boolean) { Row() { Image($r('app.media.ic_right_grey')) .width($r('app.float.default_6')) .height($r('app.float.default_12')) } .width($r('app.float.default_20')) .height($r('app.float.default_20')) .rotate({ z: 1, angle: isRight ? 0 : Const.DEFAULT_180 }) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left ArrowIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isRight AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right...
ArrowIcon(isRight: boolean) { Row() { Image($r('app.media.ic_right_grey')) .width($r('app.float.default_6')) .height($r('app.float.default_12')) } .width($r('app.float.default_20')) .height($r('app.float.default_20')) .rotate({ z: 1, angle: isRight ? 0 : Const.DEFAULT_180 }) ...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
cbbbb946ade1f1a43519f3df6130e69c0f121476
github
HarmonyOS_Samples/MultiPictureBeautification
features/multipictureediting/src/main/ets/viewmodel/EditingViewModel.ets
arkts
updateLayoutDirection
Update layout direction based on screen width and aspect ratio Business logic moved from View to ViewModel
updateLayoutDirection(curWidthVp: number, ratio: number): void { // Wide screen with low aspect ratio: horizontal layout (picture left, controls right) if (curWidthVp >= CommonConstants.SCREEN_WIDTH_LARGE && ratio <= CommonConstants.SCREEN_RATIO_THRESHOLD) { this.verticalFlex = false; } else { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateLayoutDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left curWidthVp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Le...
updateLayoutDirection(curWidthVp: number, ratio: number): void { // Wide screen with low aspect ratio: horizontal layout (picture left, controls right) if (curWidthVp >= CommonConstants.SCREEN_WIDTH_LARGE && ratio <= CommonConstants.SCREEN_RATIO_THRESHOLD) { this.verticalFlex = false; } else { ...
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
17c6613d54f5794cf8abb0c78621637e66cc3ac0
gitcode
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/CategoryDao.ets
arkts
getCategoriesByType
根据类型查询分类列表 @param type 分类类型 (0=支出,1=收入) @returns 分类列表
public async getCategoriesByType(type: number): Promise<Category[]> { const sql: string = `SELECT id, name, icon_name, type FROM ${DBManager.TABLE_CATEGORIES} WHERE type = ? ORDER BY id ASC`; try { const resultSet: relationalStore.ResultSet = await this.rdbStore.querySql(sql, [type]); const catego...
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 getCategoriesByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left...
public async getCategoriesByType(type: number): Promise<Category[]> { const sql: string = `SELECT id, name, icon_name, type FROM ${DBManager.TABLE_CATEGORIES} WHERE type = ? ORDER BY id ASC`; try { const resultSet: relationalStore.ResultSet = await this.rdbStore.querySql(sql, [type]); const catego...
https://github.com/fuhhhhhhhh/openharmony
a723ad0bb74566395bbd9dd62a5eb82317f1453f
github
openharmony/update_update_app
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
showUpgradeFailed
弹安装失败通知 @param context 实上下文
async showUpgradeFailed(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_fail_message').id...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left showUpgradeFailed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left versionName AST#identifier#Right AST#type_annotation...
async showUpgradeFailed(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_fail_message').id...
https://gitee.com/openharmony/update_update_app.git
b2457d56d25207877833d5320239403ee2c62fe4
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
checkConnectionStatus
Check detailed connection status Returns: -1=invalid, 0=disconnecting, 1=network_timeout, 2=event_failed, 10=background, 100=foreground
static checkConnectionStatus(inst: number): number { if (!LibFreeRDP.ensureNativeReady()) { return -1; } if (inst === 0) { return -1; } try { return freerdpNative!.freerdpCheckConnectionStatus(inst); } catch (e) { console.error(`${LibFreeRDP.TAG}: checkConnectionStatus ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkConnectionStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
static checkConnectionStatus(inst: number): number { if (!LibFreeRDP.ensureNativeReady()) { return -1; } if (inst === 0) { return -1; } try { return freerdpNative!.freerdpCheckConnectionStatus(inst); } catch (e) { console.error(`${LibFreeRDP.TAG}: checkConnectionStatus ...
https://github.com/tangwengang-del/freerdp-harmonyos
633a2cfe3903729549da027a44a2289d08969796
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Int8Array
public sort(): Int8Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as byte const b1 = b as double as int as byte return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public sort(): Int8Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as byte const b1 = b as double as int as byte return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
10a2c0c634a04a352b3372e015c8c77ee9d354f5
gitee
HarmonyOS_Samples/sample_in_harmonyos
features/componentlibrary/src/main/ets/util/StringUtil.ets
arkts
stringToArray
Translate the input numeric string into an array of individual character numbers.
public static stringToArray(inputStr: string): number[] { if (inputStr.trim() === '') { return []; } return inputStr.split(',').map(Number).filter(Number.isFinite); }
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 stringToArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputStr AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public static stringToArray(inputStr: string): number[] { if (inputStr.trim() === '') { return []; } return inputStr.split(',').map(Number).filter(Number.isFinite); }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
7f30f9d5c500c930d76532f01767d29a94bc28ab
gitcode
CLMC2025/Vignette
entry/src/main/ets/context/ContextValidator.ets
arkts
getBestContext
获取最佳语境
getBestContext( contexts: string[], targetWord: string, userLevel: DifficultyLevel = DifficultyLevel.CET6 ): BestContextResult | null { if (contexts.length === 0) { return null; } const results = this.validateBatch(contexts, targetWord, userLevel); // 按分数排序 results.sort((...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getBestContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contexts AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
getBestContext( contexts: string[], targetWord: string, userLevel: DifficultyLevel = DifficultyLevel.CET6 ): BestContextResult | null { if (contexts.length === 0) { return null; } const results = this.validateBatch(contexts, targetWord, userLevel); // 按分数排序 results.sort((...
https://github.com/CLMC2025/Vignette
b67053a58bc1769ce9638f6212da34ae5248b991
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readUIntBE
Reads an unsigned integer from the buffer at the specified offset using big-endian format @param {int} offset - Number of bytes to skip before reading @param {int} byteLength - Number of bytes to read (maximum 6) @returns {long} The read value @throws {Error} If byteLength is greater than 6
public readUIntBE(offset: int, byteLength: int): long { let lengthOffset: int = this.length - byteLength; Buffer.checkOffsetConstraint(offset, lengthOffset); Buffer.checkByteLengthConstraint(byteLength); return this.readBytes(this.getDataView(), offset, byteLength...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readUIntBE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public readUIntBE(offset: int, byteLength: int): long { let lengthOffset: int = this.length - byteLength; Buffer.checkOffsetConstraint(offset, lengthOffset); Buffer.checkByteLengthConstraint(byteLength); return this.readBytes(this.getDataView(), offset, byteLength...
https://gitcode.com/iop123123/arkts-static-skills
2c1219486a765964eee3316b4420fda2ed6a446d
gitcode
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ResourceUtil.ets
arkts
getDrawableDescriptor
Obtains the DrawableDescriptor of the media file corresponding to a specified resource ID. @param resource DrawableDescriptor.
public static getDrawableDescriptor(context: Context, resourceId?: number): DrawableDescriptor | undefined { try { if (!context) { Logger.error(TAG, 'getDrawableDescriptor context is null'); return undefined; } if (!resourceId) { return undefined; } const draw...
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 getDrawableDescriptor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#...
public static getDrawableDescriptor(context: Context, resourceId?: number): DrawableDescriptor | undefined { try { if (!context) { Logger.error(TAG, 'getDrawableDescriptor context is null'); return undefined; } if (!resourceId) { return undefined; } const draw...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
100117e098fe890789da455c0240e7f86a570bef
gitcode
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/RuntimeAudioSettingsController.ets
arkts
setMinimumAudioLatency
设置音频最小延迟(ms):决定 RingBuffer 缓冲目标水位深度。 越大越抗 callback 抖动(模拟器/低端机),代价是按键到出声延迟。见 D019。
setMinimumAudioLatency(ms: number): boolean { try { if (!testNapi) { LogHelper.warn('RuntimeAudioSettings', 'Audio', '设置最小音频延迟跳过: engine not ready') return false } return nativeApi.refactoredSetMinimumAudioLatency(ms) } catch (err) { const message = (err as Error).messa...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMinimumAudioLatency AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L...
setMinimumAudioLatency(ms: number): boolean { try { if (!testNapi) { LogHelper.warn('RuntimeAudioSettings', 'Audio', '设置最小音频延迟跳过: engine not ready') return false } return nativeApi.refactoredSetMinimumAudioLatency(ms) } catch (err) { const message = (err as Error).messa...
https://github.com/daugf2527/harmonyos-libretro-emulator
07c9c7d533d405aea746ee3214540f2ec2763331
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
createGlassModifier
创建通用玻璃模糊修饰符(不含边距与内边距),适用于任意主题
public createGlassModifier(): CommonModifier { return this.createGlassModifierForLevel(GlassLevel.CARD); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createGlassModifier 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 Co...
public createGlassModifier(): CommonModifier { return this.createGlassModifierForLevel(GlassLevel.CARD); }
https://github.com/DaLongZhuaZi/manxia
b1d80a32494d5ac42b64db9859d2723cf0568b0a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GameControllerService.ets
arkts
pauseInputMonitor
暂停输入监听(仅按键+轴),保留设备上下线监听 用于无手柄场景减少系统轮询干扰,同时保持设备热插拔检测
pauseInputMonitor(): void { if (!native || !this.monitoring) return; native.pauseInputMonitor(); console.info('[GameController] 暂停输入监听(设备监听保持活跃)'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pauseInputMonitor 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_...
pauseInputMonitor(): void { if (!native || !this.monitoring) return; native.pauseInputMonitor(); console.info('[GameController] 暂停输入监听(设备监听保持活跃)'); }
https://github.com/AlkaidLab/moonlight-harmony
14314615bcecadc9a1cd7f946837b873d99bc772
github
openharmony/codelabs
Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets
arkts
deviceFoundOn
Registering and Discovering a Device Callback.
deviceFoundOn() { try { if (this.dmInstance !== undefined) { this.dmInstance.on('deviceFound', (data) => { if (this.dealDeviceInfo !== undefined) { this.dealDeviceInfo(data); } }); } } catch (err) { Logger.error(TAG, 'deviceFoundOn err:' + JSON...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deviceFoundOn 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...
deviceFoundOn() { try { if (this.dmInstance !== undefined) { this.dmInstance.on('deviceFound', (data) => { if (this.dealDeviceInfo !== undefined) { this.dealDeviceInfo(data); } }); } } catch (err) { Logger.error(TAG, 'deviceFoundOn err:' + JSON...
https://gitee.com/openharmony/codelabs.git
705917c932450c59b419ed91b9116f5c1aab6bbb
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/NetworkManager.ets
arkts
removePortForwarding
移除端口转发
public removePortForwarding(name: string): boolean { const index = this.config.portForwardings.findIndex(pf => pf.name === name); if (index === -1) { return false; } this.config.portForwardings.splice(index, 1); return true; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removePortForwarding 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#...
public removePortForwarding(name: string): boolean { const index = this.config.portForwardings.findIndex(pf => pf.name === name); if (index === -1) { return false; } this.config.portForwardings.splice(index, 1); return true; }
https://github.com/AetheriumSimulator/qemu-hmos
60bdeb6a0ef4fcb1f78648c7a3fc077c7aafad3a
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
updateWindowTitle
WINDOW Update the window title.
async updateWindowTitle() { const alias = this.isZone ? `󰙟 ${this.windowAlias}` : this.windowAlias; meow(`Update window title to: ${alias}`, `meowUiHost][${this.windowId}][updateWindowTitle`, meowLevel.WARN); this.windowObj?.setWindowTitle(alias) .catch((e: BusinessError) => { meow(`Failed ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateWindowTitle 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 { AS...
async updateWindowTitle() { const alias = this.isZone ? `󰙟 ${this.windowAlias}` : this.windowAlias; meow(`Update window title to: ${alias}`, `meowUiHost][${this.windowId}][updateWindowTitle`, meowLevel.WARN); this.windowObj?.setWindowTitle(alias) .catch((e: BusinessError) => { meow(`Failed ...
https://github.com/awaLiny2333/LinysBrowser_NEXT
3704a69e1eb2b3ecf32cc575bb645ec3939b23fc
github
pangpang20/antennaPodHM
entry/src/main/ets/service/SettingsService.ets
arkts
setKeepLastNEpisodes
设置保留最近单集数
async setKeepLastNEpisodes(count: number): Promise<void> { this.settings.keepLastNEpisodes = count; await this.saveSettings(); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setKeepLastNEpisodes AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required...
async setKeepLastNEpisodes(count: number): Promise<void> { this.settings.keepLastNEpisodes = count; await this.saveSettings(); }
https://github.com/pangpang20/antennaPodHM
38a69c0db5231f5aea556f7dd774832f3a00c738
github