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
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getPageNumber
获取当前页码 @returns 页码(从 1 开始),未设置分页时返回 0
getPageNumber(): number { return this.pageNumber }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPageNumber 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#statemen...
getPageNumber(): number { return this.pageNumber }
https://github.com/offlinecat-dev/OCNetORM
413208593e7bae2996fd2b6b1c6f65346a0dd985
github
openharmony/applications_mms
entry/src/main/ets/pages/conversationlist/conversationListController.ets
arkts
queryAllMessages
Querying All Lists
queryAllMessages() { HiLog.i(TAG, 'queryAllMessages, start'); let actionData: LooseObject = {}; this.limit = StringUtil.getLimitForSession(this.page); if (this.hasAggregate) { actionData.smsType = common.sms_type.COMMON; } actionData.page = this.page; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryAllMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
queryAllMessages() { HiLog.i(TAG, 'queryAllMessages, start'); let actionData: LooseObject = {}; this.limit = StringUtil.getLimitForSession(this.page); if (this.hasAggregate) { actionData.smsType = common.sms_type.COMMON; } actionData.page = this.page; ...
https://gitee.com/openharmony/applications_mms.git
262f6c6992216ac2884016e84245ec9cf454c7a5
gitee
openharmony-sig/ohos_checksum
library/src/main/ets/sha1.ets
arkts
hex_sha1
bits per input character. 8 - ASCII; 16 - Unicode
hex_sha1(s: string) : string { return this.binb2hex(this.core_sha1(this.AlignSHA1(s))); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hex_sha1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig...
hex_sha1(s: string) : string { return this.binb2hex(this.core_sha1(this.AlignSHA1(s))); }
https://gitee.com/openharmony-sig/ohos_checksum.git
8eed05001ea9ad590c2f17df1cd4f723b4379adc
gitee
erikwang2013/erp-php-lite
service/apps/harmonyos/entry/src/main/ets/service/ApiService.ets
arkts
tryRefreshToken
尝试用 refresh_token 刷新 access_token @returns 刷新成功返回 true
private async tryRefreshToken(): Promise<boolean> { const refreshToken = TokenManager.getRefreshToken(); if (!refreshToken) { return false; } try { const refreshResponse = await this.httpRequest.request( `${BASE_URL}/api/auth/refresh`, { method: http.RequestMetho...
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 tryRefreshToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async tryRefreshToken(): Promise<boolean> { const refreshToken = TokenManager.getRefreshToken(); if (!refreshToken) { return false; } try { const refreshResponse = await this.httpRequest.request( `${BASE_URL}/api/auth/refresh`, { method: http.RequestMetho...
https://github.com/erikwang2013/erp-php-lite
e0ffbcdc528acbfb19545328f9cd4d07b682623c
github
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/RequireAwait/ets/requireAwaitReport.ets
arkts
foo
non-async function with await inside async function without await
async function foo() { function nested() { await doSomething(); }; };
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AS...
async function foo() { function nested() { await doSomething(); }; };
https://github.com/SMAT-Lab/Homecheck-Sec2026
6e0945247216047313aef8dee9ec2d858d61883b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/pages/StreamPage.ets
arkts
sendShortcut
执行快捷键(支持单次组合或多步序列)
sendShortcut(shortcut: Shortcut): void { const session = this.viewModel.getSession(); if (!session) return; sendShortcutKeys((keys: number[]) => session.sendKeys(keys), shortcut.keys, shortcut.keySequence); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendShortcut AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shortcut AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Shortcut AST#identifier#Right AST#)#Lef...
sendShortcut(shortcut: Shortcut): void { const session = this.viewModel.getSession(); if (!session) return; sendShortcutKeys((keys: number[]) => session.sendKeys(keys), shortcut.keys, shortcut.keySequence); }
https://github.com/AlkaidLab/moonlight-harmony
d95c68e1d04f7b56549a8c0cae64d7bc9f56923c
github
openharmony/applications_settings
common/component/src/main/ets/default/sliderComponent.ets
arkts
onChangeHandler
Change handler @param value - Change value @param mode - State
onChangeHandler(value: number, mode: SliderChangeMode) { if (this.onChange) { this.onChange(value, mode); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onChangeHandler AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Ri...
onChangeHandler(value: number, mode: SliderChangeMode) { if (this.onChange) { this.onChange(value, mode); } }
https://gitee.com/openharmony/applications_settings.git
3813fa17d3154c038c50dc19dd62bc6d95542a91
gitee
arkui-x/samples
CodeLab/Cases/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets
arkts
set
设置tab项内容 @param name - tab项标题 @param content - tab项内容
public set(name: string, tabInfo: TabInfo) { this.tabsInfo.set(name, tabInfo); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#...
public set(name: string, tabInfo: TabInfo) { this.tabsInfo.set(name, tabInfo); }
https://gitcode.com/arkui-x/samples
66c840e1284d8019f839220846b97caa993adfcd
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/checked/memory_coalescing.ets
arkts
__noinline__fnSumMem
memory coalescing can't be performed over CallStatic that is barrier
private static __noinline__fnSumMem(u: double[], v: double[]): void { let t: double = 0; for (let j: int = 0; j < u.length; j = j + 2) { t += u[j]; Test.__noinline__fnMem(u, v, j); t += u[j + 1]; } for (let i: int = 0; i < v.length; i = i + 2) { ...
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 __noinline__fnSumMem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left u AST#identifier#Right AST#:#Le...
private static __noinline__fnSumMem(u: double[], v: double[]): void { let t: double = 0; for (let j: int = 0; j < u.length; j = j + 2) { t += u[j]; Test.__noinline__fnMem(u, v, j); t += u[j + 1]; } for (let i: int = 0; i < v.length; i = i + 2) { ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
63c91f284125059d585175933a812ec5727f668c
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets
arkts
loadToken
加载OAuth2令牌 @param config 存储配置
public async loadToken(config: OAuth2TokenStorageConfig): Promise<OAuth2Token | null> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { // 生成令牌键名 const tokenKey = config.tokenKey || this.getDefaultTokenKey(config.provider);...
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 loadToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:...
public async loadToken(config: OAuth2TokenStorageConfig): Promise<OAuth2Token | null> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { // 生成令牌键名 const tokenKey = config.tokenKey || this.getDefaultTokenKey(config.provider);...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets#L116-L160
be8597ae3ccb2787f8fd11cddee87402c736cc74
github
offlinecat-dev/OCNetORM
src/main/ets/query/SubQuery.ets
arkts
hasConditions
检查是否有过滤条件 @returns 是否有条件
hasConditions(): boolean { return this.conditions.length > 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasConditions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state...
hasConditions(): boolean { return this.conditions.length > 0 }
https://github.com/offlinecat-dev/OCNetORM
c16b9d14e69f77e69b7ba3add9fc1396a08362b9
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/common/FocusDemo.ets
arkts
build
focusable() - 是否允许获取焦点 focusOnTouch() - 是否可以通过点击获取焦点 defaultFocus() - 是否默认获得焦点(仅页面创建后第一次进入时有效) focusBox() - 获取焦点后的,焦点框样式(一个 FocusBoxStyle 对象) margin, strokeColor, strokeWidth 注:仅走焦(比如 tab 键)时有效,如果通过用户点击获取焦点则无效 id() - 组件的 id focusControl.requestFocus() - 通过指定的组件的 id 让指定的组件获取焦点,返回值为指定的组件是否成功地获取到了焦点 TextInput enableKeyboa...
build() { Column({space:10}) { Text(this.message) TextInput().width('90%').height(40) TextInput({controller:this.controller}).width('90%').height(40) .defaultFocus(true) .enableKeyboardOnFocus(false) .id("myTextInput") .onFocus(() => { this.message = ...
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#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { Column({space:10}) { Text(this.message) TextInput().width('90%').height(40) TextInput({controller:this.controller}).width('90%').height(40) .defaultFocus(true) .enableKeyboardOnFocus(false) .id("myTextInput") .onFocus(() => { this.message = ...
https://github.com/webabcd/HarmonyDemo
a79a08d96a0ecd5629730b3394baaeeb5757fcca
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaDiffer.ets
arkts
diff
生成 Schema 差异
async diff(store: relationalStore.RdbStore, options?: SchemaDiffOptions): Promise<SchemaDiffResult> { const includeJoinTables = options?.includeJoinTables !== false const desiredTables = this.buildDesiredTables(includeJoinTables) const existingTables = await this.inspector.getExistingTables(store) con...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left diff AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left store AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
async diff(store: relationalStore.RdbStore, options?: SchemaDiffOptions): Promise<SchemaDiffResult> { const includeJoinTables = options?.includeJoinTables !== false const desiredTables = this.buildDesiredTables(includeJoinTables) const existingTables = await this.inspector.getExistingTables(store) con...
https://github.com/offlinecat-dev/OCNetORM
0362ceb4cc4ea783a259ec5b9d67ce33f261086f
github
somnio-software/my-bot-pal
entry/src/main/ets/utils/LocationService.ets
arkts
getInstance
Singleton pattern to ensure we have only one instance of LocationService
public static getInstance(): LocationService { if (!LocationService.instance) { LocationService.instance = new LocationService(); } return LocationService.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(): LocationService { if (!LocationService.instance) { LocationService.instance = new LocationService(); } return LocationService.instance; }
https://github.com/somnio-software/my-bot-pal
d46f8a44fd3c27c6d60fc01054b20bd22e1e1fed
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
getUnusedRecognitions
获取未使用的识别记录
static async getUnusedRecognitions(userId: number): Promise<OCRRecognitionRecord[]> { try { return await OCRRecognitionRecordDAO.getUnused(userId, 20); } catch (error) { console.error('[OCRRecognitionService] 获取未使用记录失败:', error); return []; } }
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 getUnusedRecognitions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#...
static async getUnusedRecognitions(userId: number): Promise<OCRRecognitionRecord[]> { try { return await OCRRecognitionRecordDAO.getUnused(userId, 20); } catch (error) { console.error('[OCRRecognitionService] 获取未使用记录失败:', error); return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1b1aee475c58895323fa8a0ec1474b53640ac6f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
markCompleted
标记初始化完成
markCompleted(): void { const duration = Date.now() - this.state.startTime; this.state.currentPhase = InitPhase.COMPLETED; this.state.progress = 100; this.state.displayText = '启动完成'; this.state.isCompleted = true; logger.info(TAG, `🎉 初始化全部完成,总耗时: ${duration}ms`); logger.info(TAG...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
markCompleted(): void { const duration = Date.now() - this.state.startTime; this.state.currentPhase = InitPhase.COMPLETED; this.state.progress = 100; this.state.displayText = '启动完成'; this.state.isCompleted = true; logger.info(TAG, `🎉 初始化全部完成,总耗时: ${duration}ms`); logger.info(TAG...
https://github.com/DaLongZhuaZi/manxia
ff140851b730e8d732dc68e35295e073809323a2
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets
arkts
getRepeatRuleByIndex
根据索引获取重复规则(代理给RepeatService)
getRepeatRuleByIndex(index: number): string { return this.repeatService.getRepeatRuleByIndex(index); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRepeatRuleByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#...
getRepeatRuleByIndex(index: number): string { return this.repeatService.getRepeatRuleByIndex(index); }
https://gitcode.com/openharmony/codelabs
4296577d90ea52ab5814a980d71a4fcbe663754b
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/LifecycleObserver.ets
arkts
dispatchFg
Internal foreground dispatch. Buffered until `markReady()` so a platform fg transition that fires while init's async pipeline is still running doesn't reach modules whose state isn't loaded yet. Once ready, future fg events dispatch immediately.
private dispatchFg(): void { if (!this.ready) { this.pendingFg = true; return; } this.dispatchedFg = true; this.onForeground(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dispatchFg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressi...
private dispatchFg(): void { if (!this.ready) { this.pendingFg = true; return; } this.dispatchedFg = true; this.onForeground(); }
https://github.com/Countly/countly-sdk-hos
dc85813f544455b9a63dbb55cbb8a277d2c0df35
github
harmonyos/codelabs
HarmonyOS_NEXT/MultiShopping/common/src/main/ets/utils/LocalDataManager.ets
arkts
updateShopCart
Update shopCart data. @param props: update prop.
updateShopCart(props: UpdateShopProps) { const result: Product = this.shopCartData.filter((item: Product) => item.id === props.id)[0]; const newShop: Product = { id: props.id, name: result.name, img: result.img, commodityId: result.commodityId, description: result.description, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateShopCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left props AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UpdateShopProps AST#ident...
updateShopCart(props: UpdateShopProps) { const result: Product = this.shopCartData.filter((item: Product) => item.id === props.id)[0]; const newShop: Product = { id: props.id, name: result.name, img: result.img, commodityId: result.commodityId, description: result.description, ...
https://gitee.com/harmonyos/codelabs.git
d63b333b5e2db689f0a628fb5c3fa64e21fe1bc8
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
cancelConnection
Cancel an ongoing connection
static cancelConnection(inst: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } if (instanceState.get(inst)) { return freerdpNative!.freerdpDisconnect(inst); } return true; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cancelConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static cancelConnection(inst: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } if (instanceState.get(inst)) { return freerdpNative!.freerdpDisconnect(inst); } return true; }
https://github.com/tangwengang-del/freerdp-harmonyos
ee3fa90bc09a955c4c5f32ba4c8e8eef439ae8b3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/AuthenticationHandler.ets
arkts
buildAuthHeaders
构建认证头
async buildAuthHeaders(token?: string): Promise<Record<string, string>> { const headers: Record<string, string> = {}; try { const authToken = token || await this.getValidToken(); if (!authToken) { if (this.config.requiresLogin) { throw new Error('需要登录'); } return...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left buildAuthHeaders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left token AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_a...
async buildAuthHeaders(token?: string): Promise<Record<string, string>> { const headers: Record<string, string> = {}; try { const authToken = token || await this.getValidToken(); if (!authToken) { if (this.config.requiresLogin) { throw new Error('需要登录'); } return...
https://github.com/DaLongZhuaZi/manxia
e7606b5205792a8336b02f7d7f2d4b7e3662dddc
github
ZestBox-18/kitebook-frontend
features/profile/src/main/ets/entities/UserProfile.ets
arkts
updateFromData
从另一个用户档案对象同步数据。
updateFromData(data: UserProfile): void { this.nickname = data.nickname this.avatar = data.avatar this.userId = data.userId this.openId = data.openId this.unionId = data.unionId this.isLoggedIn = data.isLoggedIn }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateFromData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UserProfile AST#identifier#Right AST#)#Le...
updateFromData(data: UserProfile): void { this.nickname = data.nickname this.avatar = data.avatar this.userId = data.userId this.openId = data.openId this.unionId = data.unionId this.isLoggedIn = data.isLoggedIn }
https://github.com/ZestBox-18/kitebook-frontend
d36b78257f8aa0ddd89b9a68dbe9c6163d97111c
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
getInstance
@returns The shared {@link WindowUtil} instance.
public static getInstance(): WindowUtil { if (WindowUtil.instance === undefined) { WindowUtil.instance = new WindowUtil(); } return WindowUtil.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(): WindowUtil { if (WindowUtil.instance === undefined) { WindowUtil.instance = new WindowUtil(); } return WindowUtil.instance; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
85db7e229ca54fdbbe85f6db2de4e2b07c71b53b
gitcode
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/PreferenceService.ets
arkts
getValue
--- 🔥 通用读写方法 (解决 Model 层调用报错的核心) --- 通用获取值方法 使用泛型 <T> 避免 'any' 类型报错
async getValue<T>(key: string, defValue: T): Promise<T> { if (!this.preferences) { return defValue; } try { // 显式断言为 ValueType,满足编译器检查 const val = await this.preferences.get(key, defValue as dataPreferences.ValueType); return val as T; } catch (err) { this.logger.error(`F...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getValue AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_...
async getValue<T>(key: string, defValue: T): Promise<T> { if (!this.preferences) { return defValue; } try { // 显式断言为 ValueType,满足编译器检查 const val = await this.preferences.get(key, defValue as dataPreferences.ValueType); return val as T; } catch (err) { this.logger.error(`F...
https://gitcode.com/openharmony/codelabs
19a9eb22f41e74c6de84e22f52e4ba75f7752a6f
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/UserLibraryApi.ets
arkts
markFavoriteItem
Marks an item as a favorite. @summary Marks an item as a favorite. @param {UserLibraryApiMarkFavoriteItemRequest} requestParameters Request parameters. @throws {RequiredError} @memberof UserLibraryApi
public async markFavoriteItem(requestParameters: UserLibraryApiMarkFavoriteItemRequest): Promise<UserItemDataDto> { this.assertParam(requestParameters.itemId) return this.apiClient.post({path: `/UserFavoriteItems/${requestParameters.itemId}`, parameters: requestParameters, excludeParams: ['itemId']}) }
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 markFavoriteItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ...
public async markFavoriteItem(requestParameters: UserLibraryApiMarkFavoriteItemRequest): Promise<UserItemDataDto> { this.assertParam(requestParameters.itemId) return this.apiClient.post({path: `/UserFavoriteItems/${requestParameters.itemId}`, parameters: requestParameters, excludeParams: ['itemId']}) }
https://github.com/OHPG/FinSdk
434f9beeb06216cd35d57fbcc64d354816f895ed
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_plus/unary_plus_short.ets
arkts
main
--- desc: check unary plus operation for short integer operand ---
function main(): void { const v: short = {{v.value}} assert +(v) == {{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 v: short = {{v.value}} assert +(v) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5025bde168754d3172d41f767580d6cf86baf54d
gitee
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
ensureInitialized
启动初始化:历史 URL 修复 + 预设补齐 + 加载到内存。 多次调用合并为同一个 promise,不会重复执行
async ensureInitialized(): Promise<void> { if (getAppSettingsState().providersInitialized) { return } if (this.initPromise !== null) { await this.initPromise return } this.initPromise = this.doInitialize() try { await this.initPromise } finally { this.initProm...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left ensureInitialized AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Le...
async ensureInitialized(): Promise<void> { if (getAppSettingsState().providersInitialized) { return } if (this.initPromise !== null) { await this.initPromise return } this.initPromise = this.doInitialize() try { await this.initPromise } finally { this.initProm...
https://github.com/LongLiveY96/chatcube
781d8021b3767c0fcaf86a37d99d0d099e73116c
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
isCompleted
检查页面是否已完成加载
isCompleted(pageIndex: number): boolean { return this.completed.has(pageIndex); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#...
isCompleted(pageIndex: number): boolean { return this.completed.has(pageIndex); }
https://github.com/DaLongZhuaZi/manxia
4240607f63602f7ae80e9d2b14c18448d9574490
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RdpConnectionManager.ets
arkts
startMonitoring
开始监控连接状态
startMonitoring(callback: (info: RdpConnectionInfo) => void) { this.onStatusChange = callback // 每2秒检查一次 this.checkInterval = setInterval(() => { const info = this.getStatus() if (this.onStatusChange) { this.onStatusChange(info) } }, 2000) }
AST#program#Left AST#ERROR#Left AST#identifier#Left startMonitoring AST#identifier#Right AST#(#Left ( AST#(#Right AST#member_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#...
startMonitoring(callback: (info: RdpConnectionInfo) => void) { this.onStatusChange = callback // 每2秒检查一次 this.checkInterval = setInterval(() => { const info = this.getStatus() if (this.onStatusChange) { this.onStatusChange(info) } }, 2000) }
https://github.com/AetheriumSimulator/qemu-hmos
c82fe621825926b0080dde7ce469f07e0cd6ffe5
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/ImageRestorationEngine.ets
arkts
executeColorRestoration
执行颜色恢复
private async executeColorRestoration( imageData: AncientImageData, params?: ProcessingParams ): Promise<ProcessResult> { const startTime = Date.now(); const inputQuality = (await this.preprocessor.assessQuality(imageData)).overall; const colorRestoredData = await this.colorRestorer.process(ima...
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 executeColorRestoration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imageData AST#identifier#Righ...
private async executeColorRestoration( imageData: AncientImageData, params?: ProcessingParams ): Promise<ProcessResult> { const startTime = Date.now(); const inputQuality = (await this.preprocessor.assessQuality(imageData)).overall; const colorRestoredData = await this.colorRestorer.process(ima...
https://github.com/LJ666-ui/harmony-health-care
a28606138ca5ab7b7a198ac4378f5a3cccc57389
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/EntryBackupAbility.ets
arkts
onRestore
恢复回调。 TODO: 后续按版本恢复数据并处理兼容迁移。
async onRestore(bundleVersion: BundleVersion) { void bundleVersion; await Promise.resolve(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onRestore AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bundleVersion AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async onRestore(bundleVersion: BundleVersion) { void bundleVersion; await Promise.resolve(); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/EntryBackupAbility.ets#L30-L33
16404e1867673ce5d52d3b6df19f23e7a881e985
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CompressionUtils.ets
arkts
convertUriToLocalPath
将URI路径转换为本地文件系统路径或处理URI访问 @param uriPath URI格式的路径 @returns 本地文件系统路径或URI
private convertUriToLocalPath(uriPath: string): string { try { // 如果是file://协议的URI,需要转换为本地路径 if (uriPath.startsWith('file://')) { // 移除file://前缀 let localPath = uriPath.substring(7); // 解码URL编码的字符 localPath = decodeURIComponent(localPath); // 在...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertUriToLocalPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uriPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private convertUriToLocalPath(uriPath: string): string { try { // 如果是file://协议的URI,需要转换为本地路径 if (uriPath.startsWith('file://')) { // 移除file://前缀 let localPath = uriPath.substring(7); // 解码URL编码的字符 localPath = decodeURIComponent(localPath); // 在...
https://github.com/DaLongZhuaZi/manxia
5b38c217cbb8b4928a3328c632e2266f2143d6a5
github
openharmony/applications_app_samples
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
getData
获取指定索引数据。 @param {number} index - 索引值。 @returns {CustomDataType} 返回指定索引数据。
public getData(index: double): CustomDataType { return this.originDataArray[index]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double ...
public getData(index: double): CustomDataType { return this.originDataArray[index]; }
https://github.com/openharmony/applications_app_samples
2472d62effb585a0fa61da3790b7f00089088afc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
waitForLoad
等待正在进行的加载完成
private waitForLoad(pageId: string): Promise<image.PixelMap | null> { return new Promise((resolve) => { const callbacks = this.loadCompleteCallbacks.get(pageId) || []; callbacks.push(resolve); this.loadCompleteCallbacks.set(pageId, callbacks); }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left waitForLoad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private waitForLoad(pageId: string): Promise<image.PixelMap | null> { return new Promise((resolve) => { const callbacks = this.loadCompleteCallbacks.get(pageId) || []; callbacks.push(resolve); this.loadCompleteCallbacks.set(pageId, callbacks); }); }
https://github.com/DaLongZhuaZi/manxia
a3e637ad00455a719963ba357f68e2132d0e638d
github
ibestservices/ibest-ui
library/src/main/ets/components/signature/index.ets
arkts
generatePredictedPoints
生成预测点位
generatePredictedPoints(p1: Position, p2: Position, numPoints: number = 3): Position[] { const dx = p2.x - p1.x const dy = p2.y - p1.y const angle = Math.atan2(dy, dx) const distance = Math.sqrt(dx * dx + dy * dy) const step = distance / (numPoints + 1) const predictedPoints: Position[] = [] for (let i =...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generatePredictedPoints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Position AST#identifier#Right AST#...
generatePredictedPoints(p1: Position, p2: Position, numPoints: number = 3): Position[] { const dx = p2.x - p1.x const dy = p2.y - p1.y const angle = Math.atan2(dy, dx) const distance = Math.sqrt(dx * dx + dy * dy) const step = distance / (numPoints + 1) const predictedPoints: Position[] = [] for (let i =...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/signature/index.ets#L137-L150
37ced3f46665517e0754d747c7b45fa05fcb1416
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
get
Returns a value associated with key if present @param k the key to find in the LightWeightMap/class @returns value if associated with key presents.
get(key: K): V | undefined { const index = this.getIndexOfKey(key); if (index < 0) { return undefined; } return this.buckets.entryValues[index]; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#...
get(key: K): V | undefined { const index = this.getIndexOfKey(key); if (index < 0) { return undefined; } return this.buckets.entryValues[index]; }
https://gitcode.com/iop123123/arkts-static-skills
e584f8bb8988a62ba01a0ea9cf8e2e1e696f72f0
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
endElement
Handles the end of an XML element during parsing. @throws {BusinessError} Throws an error if there is no matching start element for the current end element.
public endElement(): void { if (this.elementNum < 1) { throw createBusinessError(NoElementMatchErrorCodeId, 'There is no match between the startElement and the endElement'); } this.elementNum--; let stringBuilder = new StringBu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left endElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_...
public endElement(): void { if (this.elementNum < 1) { throw createBusinessError(NoElementMatchErrorCodeId, 'There is no match between the startElement and the endElement'); } this.elementNum--; let stringBuilder = new StringBu...
https://gitcode.com/iop123123/arkts-static-skills
f01f95cb6bafca09ae8381766c18005e19362ee4
gitcode
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/constants/WearableLayout.ets
arkts
getCardHeight
Get responsive values based on screen size
static getCardHeight(screenSize: number): number { if (screenSize < 1.2) { return WearableResponsiveLayout.SMALL_CARD_HEIGHT }; if (screenSize > 1.6) { return WearableResponsiveLayout.LARGE_CARD_HEIGHT }; return WearableResponsiveLayout.MEDIUM_CARD_HEIGHT; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCardHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left screenSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
static getCardHeight(screenSize: number): number { if (screenSize < 1.2) { return WearableResponsiveLayout.SMALL_CARD_HEIGHT }; if (screenSize > 1.6) { return WearableResponsiveLayout.LARGE_CARD_HEIGHT }; return WearableResponsiveLayout.MEDIUM_CARD_HEIGHT; }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
e60f901825c66760ac5ff67a79aa5cca03348c75
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreNovelSources
恢复小说书源(完整configJson)
private async restoreNovelSources(items: NovelSourceBackup[]): Promise<void> { logger.info(TAG, `Restoring novel sources: ${items.length} items`); let successCount = 0; let skipCount = 0; const failures: string[] = []; for (const item of items) { try { // 检查是否有完整的configJson ...
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 restoreNovelSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#...
private async restoreNovelSources(items: NovelSourceBackup[]): Promise<void> { logger.info(TAG, `Restoring novel sources: ${items.length} items`); let successCount = 0; let skipCount = 0; const failures: string[] = []; for (const item of items) { try { // 检查是否有完整的configJson ...
https://github.com/DaLongZhuaZi/manxia
21e34f5d3f155273757ee44a0772f133f1aefce0
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/storage/PreferencesUtil.ets
arkts
getString
获取字符串值
static async getString(key: string, defaultValue: string = ''): Promise<string> { if (PreferencesUtil.preferencesInstance === null) { return defaultValue; } try { const value = await PreferencesUtil.preferencesInstance.get(key, defaultValue); return value as string; } catch (err) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri...
static async getString(key: string, defaultValue: string = ''): Promise<string> { if (PreferencesUtil.preferencesInstance === null) { return defaultValue; } try { const value = await PreferencesUtil.preferencesInstance.get(key, defaultValue); return value as string; } catch (err) { ...
https://github.com/Amaz1ny/HarmonyDO-public
08bc7d76d06638e88e751379ea465e59fbb7263c
github
silence17/harmonydemo
entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
addCart
添加购物车 @param productId product id @param quantity 数量 @param skuId sku id
addCart(productId: string, quantity: number, skuId: string) { let httpRequest = http.createHttp(); httpRequest.on('headersReceive', (header) => { Log.debug('header: ' + JSON.stringify(header)) }) httpRequest.request("https://test.beeselect.net/j/api/cart/add", { method: http.RequestMethod...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Le...
addCart(productId: string, quantity: number, skuId: string) { let httpRequest = http.createHttp(); httpRequest.on('headersReceive', (header) => { Log.debug('header: ' + JSON.stringify(header)) }) httpRequest.request("https://test.beeselect.net/j/api/cart/add", { method: http.RequestMethod...
https://github.com/silence17/harmonydemo
00c2b05b4f496209b3b84053afc3f7d21769f45b
github
arkui-x/samples
CodeLab/Cases/feature/encapsulationdialog/src/main/ets/dialog/util/AnimationUtil.ets
arkts
transitionFromUp
顶部弹出动画 @param duration 动画时间 @returns
static transitionFromUp(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ delay: ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left transitionFromUp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_...
static transitionFromUp(duration: number = 200): TransitionEffect { return TransitionEffect.asymmetric( TransitionEffect.OPACITY.animation({ duration: duration }).combine( TransitionEffect.move(TransitionEdge.TOP).animation({ duration: duration })), TransitionEffect.OPACITY.animation({ delay: ...
https://gitcode.com/arkui-x/samples
6fb3a28132cbebccf5d3b2e110a9b7ed8e83935c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
unrarFile
解压rar文件(使用zlib,仅支持zip格式)
async unrarFile(zipPath: string): Promise<string> { logger.warn(TAG, 'rar格式暂不支持,尝试作为zip解压'); return this.unArchiveFile(zipPath); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left unrarFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left zipPath AST#identifier#Right AST#type_annotation#Left AST#:#...
async unrarFile(zipPath: string): Promise<string> { logger.warn(TAG, 'rar格式暂不支持,尝试作为zip解压'); return this.unArchiveFile(zipPath); }
https://github.com/DaLongZhuaZi/manxia
92dc4e1e2f3cc8e1841fabbeb5e2a9a04db62c5f
github
OHPG/FinMusic
entry/src/main/ets/data/Repository.ets
arkts
searchMedia
搜索 @param keyword @returns
public searchMedia(keyword: string): Promise<Array<BaseItemDto>> { return this.requireApi().searchMedia(keyword) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left searchMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
public searchMedia(keyword: string): Promise<Array<BaseItemDto>> { return this.requireApi().searchMedia(keyword) }
https://github.com/OHPG/FinMusic
9386c2ddf82ff89bce81fc50b1a507efec0c441a
github
OHPG/FinMusic
entry/src/main/ets/player/AppPlayerContext.ets
arkts
reportPlaybackStart
─── 服务端上报 ────────────────────────────────────────────────────────────
private reportPlaybackStart(assetId: string): void { if (this.reportingPlayback) return this.reportingPlayback = true this.repository.onPlaybackStart(assetId) .then(() => { this.reportingPlayback = false }) .catch((_e: Error) => { this.reportingPlayback = false }) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reportPlaybackStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left assetId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
private reportPlaybackStart(assetId: string): void { if (this.reportingPlayback) return this.reportingPlayback = true this.repository.onPlaybackStart(assetId) .then(() => { this.reportingPlayback = false }) .catch((_e: Error) => { this.reportingPlayback = false }) }
https://github.com/OHPG/FinMusic
1cadadf9085e6bbdca916b0875a3d97371d9d878
github
CPF-ApplicationTPC/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
getJpegOptimizeDecoding
获取默认解码是否开启了jpeg解码优化 @return 返回true表示开启了优化解码,返回false表示没有开启
getJpegOptimizeDecoding(): boolean { return this.enableJpegOptimizeDecoding; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getJpegOptimizeDecoding 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...
getJpegOptimizeDecoding(): boolean { return this.enableJpegOptimizeDecoding; }
https://gitcode.com/CPF-ApplicationTPC/ImageKnife/blob/b77b0fbdd908f68c6c5b9baf28a9ca75c07b6d0a/library/src/main/ets/ImageKnife.ets#L613-L615
297b82458be92b49c97e4c9f15dbe841f2ca889e
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
downloadClipboardBlob
下载剪贴板 blob。Sunshine 使用 REST 风格 /api/v1/clipboard/blob/{id}。
async downloadClipboardBlob(id: string): Promise<Uint8Array> { const encodedId = encodeURIComponent(id); const data = await this.doBinaryHttpsRequestWithFrpRetry( `api/v1/clipboard/blob/${encodedId}`, undefined, NvHttp.CLIPBOARD_BLOB_TIMEOUT) return new Uint8Array(data) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left downloadClipboardBlob AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async downloadClipboardBlob(id: string): Promise<Uint8Array> { const encodedId = encodeURIComponent(id); const data = await this.doBinaryHttpsRequestWithFrpRetry( `api/v1/clipboard/blob/${encodedId}`, undefined, NvHttp.CLIPBOARD_BLOB_TIMEOUT) return new Uint8Array(data) }
https://github.com/AlkaidLab/moonlight-harmony
a226a29ed103ed6972172d5095ded53f4cab7ced
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/StoragePaths.ets
arkts
ensureVmDirectories
确保指定 VM 的目录存在
static async ensureVmDirectories(vmName: string): Promise<void> { const dirs = [ StoragePaths.getVmDir(vmName), StoragePaths.getVmSharedDir(vmName) ] for (const dir of dirs) { try { await fs.mkdir(dir) } catch (e) { // 目录可能已存在 } } }
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 ensureVmDirectories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Le...
static async ensureVmDirectories(vmName: string): Promise<void> { const dirs = [ StoragePaths.getVmDir(vmName), StoragePaths.getVmSharedDir(vmName) ] for (const dir of dirs) { try { await fs.mkdir(dir) } catch (e) { // 目录可能已存在 } } }
https://github.com/AetheriumSimulator/qemu-hmos
ec85e8dd34489224511db4b83d1d7b00cebab9b5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
stringifyJsonElement
Converts a JsonElementSerializable to a JSON string. @param elem - The JsonElementDeserializable to stringify @returns The JSON string representation
public static stringifyJsonElement(elem: jsonx.JsonElementSerializable): string { return JSON.stringifyJsonElement(elem.toJSON()) }
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 stringifyJsonElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elem AST#identifier#Right AST#:#Le...
public static stringifyJsonElement(elem: jsonx.JsonElementSerializable): string { return JSON.stringifyJsonElement(elem.toJSON()) }
https://gitcode.com/iop123123/arkts-static-skills
015b3c4b38d306119ea2d31bf72f07cd6507acd3
gitcode
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
exportData
导出词汇数据
exportData(): string { const records = this.getAllRecords(); const data = records.map((record: VocabularyRecord) => record.toJSON()); return JSON.stringify(data); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exportData 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_b...
exportData(): string { const records = this.getAllRecords(); const data = records.map((record: VocabularyRecord) => record.toJSON()); return JSON.stringify(data); }
https://github.com/CLMC2025/Vignette
472fa8038015dfd2c51f4d43157d625c5922575e
github
Cool_foolisher1/ArkTSRepository
MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets
arkts
inputOperators
当输入被加、减、乘、除运算符时触发
inputOperators(len: number, value: string) { let last = len > 0 ? this.expressions[len - 1] : undefined let secondLast = len > 1 ? this.expressions[len - CommonConstants.TWO] : undefined if (!last && (value === Symbol.MIN)) { this.expressions.push(this.getSymbol(value)) return } if (!l...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left inputOperators AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left len AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right...
inputOperators(len: number, value: string) { let last = len > 0 ? this.expressions[len - 1] : undefined let secondLast = len > 1 ? this.expressions[len - CommonConstants.TWO] : undefined if (!last && (value === Symbol.MIN)) { this.expressions.push(this.getSymbol(value)) return } if (!l...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
0123204b2e75a015ea15f7e8447fcf825659ee9e
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/InteractionManager.ets
arkts
setSceneEnabled
设置场景震动开关
public async setSceneEnabled(scene: VibrationScene, enabled: boolean): Promise<void> { this.settings.sceneSettings[scene] = enabled; await this.saveSettings(); }
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 setSceneEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : ...
public async setSceneEnabled(scene: VibrationScene, enabled: boolean): Promise<void> { this.settings.sceneSettings[scene] = enabled; await this.saveSettings(); }
https://github.com/DaLongZhuaZi/manxia
19cfe4c73fdc8911b0df31663a8e72ed760d2de3
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
getByLedgerId
获取账本的所有成员
static async getByLedgerId(ledgerId: number): Promise<LedgerMember[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerMember.tableName); predicates.equalTo('ledger_id', led...
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 getByLedgerId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async getByLedgerId(ledgerId: number): Promise<LedgerMember[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(LedgerMember.tableName); predicates.equalTo('ledger_id', led...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
f2b2cc204473c9c2fee22e219d88fe131dcdf35f
github
Joker-x-dev/CoolMallArkTS
feature/common/src/main/ets/view/PrivacyPolicyPage.ets
arkts
build
构建隐私政策页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "隐私政策", viewModel: this.vm }) { this.PrivacyPolicyContent(); } }
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#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "隐私政策", viewModel: this.vm }) { this.PrivacyPolicyContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
aa11a5d0c71445893c11c8e8145dc9405658a923
github
Yebingiscn/SweetVideo
entry/src/main/ets/component/common/LiqD.ets
arkts
updateColors
点击时更新所有气泡颜色
updateColors() { // 强制触发数组更新以刷新UI this.bs = this.bs.map((b) => { b.updateE() return b }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateColors 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 ...
updateColors() { // 强制触发数组更新以刷新UI this.bs = this.bs.map((b) => { b.updateE() return b }) }
https://github.com/Yebingiscn/SweetVideo
8f93bd560576d085f61b58fce4180663f101a7de
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
handleDeepLinkDialogNavigate
深度链接对话框跳转处理
private async handleDeepLinkDialogNavigate(): Promise<void> { if (!this.deepLinkDialogIsValid || !this.deepLinkDialogInput) { this.showToast('请输入有效的链接'); return; } this.deepLinkDialogIsNavigating = true; const success: boolean = await this.deepLinkRouter.navigate(this.deepLinkDialogInput)...
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 handleDeepLinkDialogNavigate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expre...
private async handleDeepLinkDialogNavigate(): Promise<void> { if (!this.deepLinkDialogIsValid || !this.deepLinkDialogInput) { this.showToast('请输入有效的链接'); return; } this.deepLinkDialogIsNavigating = true; const success: boolean = await this.deepLinkRouter.navigate(this.deepLinkDialogInput)...
https://github.com/DaLongZhuaZi/manxia
eb701bcb0f4f7f8fc5c49412589343f3e61ab7de
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/AccountManager.ets
arkts
getAccounts
查询全部账户列表,按主键稳定输出。
static async getAccounts(): Promise<AccountBean[]> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.orderByAsc('id'); return new Promise<AccountBean[]>((resolve, reject) => { dbManager.dbStore?.query(predicates) .then((result) => { const rows = result...
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 getAccounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
static async getAccounts(): Promise<AccountBean[]> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.orderByAsc('id'); return new Promise<AccountBean[]>((resolve, reject) => { dbManager.dbStore?.query(predicates) .then((result) => { const rows = result...
https://github.com/ZestBox-18/kitebook-frontend
34962595e7391691c01244443727ff1030670c74
github
the-wwyang/kids-learning-app
src/main/ets/services/StatisticsService.ets
arkts
analyzeDifficultyStats
分析难度统计数据 @param records 答题记录(需要包含难度和答案信息) @returns 难度统计列表
static analyzeDifficultyStats(records: Array<{ difficulty: Difficulty; isCorrect: boolean; }>): DifficultyStats[] { const stats = new Map<Difficulty, { total: number; correct: number }>(); // 统计各难度数据 for (const record of records) { if (!stats.has(record.difficulty)) { stats.set(re...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left analyzeDifficultyStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left records AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
static analyzeDifficultyStats(records: Array<{ difficulty: Difficulty; isCorrect: boolean; }>): DifficultyStats[] { const stats = new Map<Difficulty, { total: number; correct: number }>(); // 统计各难度数据 for (const record of records) { if (!stats.has(record.difficulty)) { stats.set(re...
https://github.com/the-wwyang/kids-learning-app
2ed28850c951fb078b28c652648f9f251698288a
github
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
removeProvider
删除 provider:写 DB + 从内存数组过滤掉
async removeProvider(providerId: string): Promise<void> { await this.db.deleteProvider(providerId) const current = this.getProviders() const next: ModelProvider[] = [] for (let i = 0; i < current.length; i++) { if (current[i].id !== providerId) { next.push(current[i]) } } t...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeProvider AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async removeProvider(providerId: string): Promise<void> { await this.db.deleteProvider(providerId) const current = this.getProviders() const next: ModelProvider[] = [] for (let i = 0; i < current.length; i++) { if (current[i].id !== providerId) { next.push(current[i]) } } t...
https://github.com/LongLiveY96/chatcube
7f42d0e9c3853304c9b1a8b178b8b5577a5a0221
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets
arkts
loadSearchHistory
加载搜索历史列表 @returns {void} 无返回值
private async loadSearchHistory(): Promise<void> { this.searchHistoryList = await this.searchHistoryRepository.getRecentSearchHistory(10); }
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 loadSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async loadSearchHistory(): Promise<void> { this.searchHistoryList = await this.searchHistoryRepository.getRecentSearchHistory(10); }
https://github.com/Joker-x-dev/CoolMallArkTS
5ae72dba178a5bc615a95a765ca627e8c5ba0062
github
arkui-x/samples
CodeLab/Cases/feature/healthchart/src/main/ets/view/BarCharts.ets
arkts
aboutToAppear
限制线类型 图表数据初始化
aboutToAppear() { // TODO 知识点:必须初始化图表配置构建类 this.model = new BarChartModel(); this.model.setPinchZoom(false); // TODO 知识点:配置图表指定样式,各部件间没有先后之分 // 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件 const description: Description | null = this.model.getDescription(); if (description) { description.setEna...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { // TODO 知识点:必须初始化图表配置构建类 this.model = new BarChartModel(); this.model.setPinchZoom(false); // TODO 知识点:配置图表指定样式,各部件间没有先后之分 // 获取图表描述部件,设置图表描述部件不可用,即图表不进行绘制描述部件 const description: Description | null = this.model.getDescription(); if (description) { description.setEna...
https://gitcode.com/arkui-x/samples
d39b7b5948f56fb2a64d61a344fefc17491530a4
gitcode
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/FeedbackRepository.ets
arkts
getFeedbackPage
分页查询意见反馈列表 @param params 分页请求参数 @returns 反馈分页数据
async getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>> { return this.networkDataSource.getFeedbackPage(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFeedbackPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>> { return this.networkDataSource.getFeedbackPage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
99878a4e354c302f02d95a8d99b7c53027fc2748
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/http/AIStreamClient.ets
arkts
sendStream
发起 AI 流式对话
static sendStream(options: StreamOptions): http.HttpRequest { let currentContent = '' const parser = new SSEParser() let latestTotalTokens = 0 // 构建请求头 const headers: Record<string, string> = {} if (options.apiKey.length > 0) { headers['Authorization'] = `Bearer ${options.apiKey}` }...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left St...
static sendStream(options: StreamOptions): http.HttpRequest { let currentContent = '' const parser = new SSEParser() let latestTotalTokens = 0 // 构建请求头 const headers: Record<string, string> = {} if (options.apiKey.length > 0) { headers['Authorization'] = `Bearer ${options.apiKey}` }...
https://github.com/encorexin/WordPressCMS
c4848ac69a127371c96595479d0bf7d69808ab11
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets
arkts
poll
The poll operation. Pop one element and return it if the queue is not empty. Returns undefined when the queue is empty. Non-blocking. @returns { T | undefined } the deleted element or undefined when the queue is empty. @syscap SystemCapability.Utils.Lang
public override poll(): T | undefined { ConcurrencyHelpers.mutexLock(this.mutex); try { if (this.isQueueEmpty) { return undefined; } const val = this.array[this.curHeadIdx]; this.array[this.curHeadIdx] = ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#identifier#Left poll AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AS...
public override poll(): T | undefined { ConcurrencyHelpers.mutexLock(this.mutex); try { if (this.isQueueEmpty) { return undefined; } const val = this.array[this.curHeadIdx]; this.array[this.curHeadIdx] = ...
https://gitcode.com/iop123123/arkts-static-skills
4c9a3df413a7bbf7fb83a38096441e28e8047c4d
gitcode
openharmony/applications_app_samples
code/BasicFeature/Connectivity/NetworkObserver/entry/src/main/ets/utils/NetUtils.ets
arkts
stopAllNetObserve
停止所有网络监听
public stopAllNetObserve() { emitter.off(this.getEmitterEvent().eventId); this.connectionMap.forEach((netConnection: connection.NetConnection, netType: connection.NetBearType) => { netConnection.unregister(() => { logger.info('Success unregister:' + netType.toString()); }); }) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopAllNetObserve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Le...
public stopAllNetObserve() { emitter.off(this.getEmitterEvent().eventId); this.connectionMap.forEach((netConnection: connection.NetConnection, netType: connection.NetBearType) => { netConnection.unregister(() => { logger.info('Success unregister:' + netType.toString()); }); }) }
https://github.com/openharmony/applications_app_samples
6a51113dc470881fd09ab614c067b922c0d4918c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
tryLocaleCompareFast
Fast path for default-locale ASCII collation. It compares ICU-derived primary weights first; when primary weights are equal, it records the first tertiary difference as a case/variant tie-breaker. Unsupported characters or possible combining-mark effects return LOCALE_COMPARE_FAST_UNSUPPORTED.
private tryLocaleCompareFast(that: String): int { const lhsLength = this.getLength(); const rhsLength = that.getLength(); const commonLength = Math.min(lhsLength, rhsLength).toInt(); let l3Result = 0; for (let i = 0; i < commonLength; i++) { const lhsCode = this....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tryLocaleCompareFast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left that AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private tryLocaleCompareFast(that: String): int { const lhsLength = this.getLength(); const rhsLength = that.getLength(); const commonLength = Math.min(lhsLength, rhsLength).toInt(); let l3Result = 0; for (let i = 0; i < commonLength; i++) { const lhsCode = this....
https://gitcode.com/iop123123/arkts-static-skills
9ea096f1d405e64b2b4b1af5407a6e1df6ee0939
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleRequestQueue.ets
arkts
disableOfflineMode
Resume outbound traffic. If `deviceId` is non-null, it's applied before the queue drains, matches the dev-guide pattern where integrators defer identity assignment until after a consent dialog while staying offline.
public async disableOfflineMode(deviceId: string | null = null): Promise<void> { if (this.rejectIfHalted('ModuleRequestQueue', 'disableOfflineMode')) return; if (deviceId !== null && deviceId.length > 0) { await this.deviceIdModule.setID(deviceId); } this.core.requestQueue.resume(); this.con...
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 disableOfflineMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#assignment_expression#Left AST#non_null_expression#Left AST#binary_e...
public async disableOfflineMode(deviceId: string | null = null): Promise<void> { if (this.rejectIfHalted('ModuleRequestQueue', 'disableOfflineMode')) return; if (deviceId !== null && deviceId.length > 0) { await this.deviceIdModule.setID(deviceId); } this.core.requestQueue.resume(); this.con...
https://github.com/Countly/countly-sdk-hos
12bf2459f12af8c9a66d809e832390195e831ff1
github
OHPG/FinMusic
entry/src/main/ets/player/AppPlayer.ets
arkts
ensureProxy
确保代理已启动,未启动则启动
private async ensureProxy(): Promise<void> { if (this.proxyReady && Proxy.isRunning()) { return } let prefer = AppStorage.get<AppPrefer>(AppPrefer.PREFER)! await Proxy.start() Proxy.setDnsCacheEnabled(prefer.isDnsCacheEnabled()) this.proxyReady = true console.info("FinMusic: AppPlaye...
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 ensureProxy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
private async ensureProxy(): Promise<void> { if (this.proxyReady && Proxy.isRunning()) { return } let prefer = AppStorage.get<AppPrefer>(AppPrefer.PREFER)! await Proxy.start() Proxy.setDnsCacheEnabled(prefer.isDnsCacheEnabled()) this.proxyReady = true console.info("FinMusic: AppPlaye...
https://github.com/OHPG/FinMusic
8bbd571fe5f93a5a69d8415edf89ea203d0dbb72
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
disableAxisLineDashedLine
Disables the axis line to be drawn in dashed mode.
public disableAxisLineDashedLine(): void { this.mAxisLineDashPathEffect = null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disableAxisLineDashedLine 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 ...
public disableAxisLineDashedLine(): void { this.mAxisLineDashPathEffect = null; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
62e0ba6c9047a18155f4e25be948dc2f58daeffd
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/pages/CartPage.ets
arkts
getProductImage
根据产品 ID 获取图片资源
function getProductImage(productId: string | undefined): Resource { const imageMap: Record<string, Resource> = { // 支持两种格式:product_001 和 1 'product_001': $r('app.media.ic_holder_50e'), 'product_002': $r('app.media.ic_holder_xs2'), 'product_003': $r('app.media.ic_holder_computer'), 'product_004': $...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getProductImage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left productId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function getProductImage(productId: string | undefined): Resource { const imageMap: Record<string, Resource> = { // 支持两种格式:product_001 和 1 'product_001': $r('app.media.ic_holder_50e'), 'product_002': $r('app.media.ic_holder_xs2'), 'product_003': $r('app.media.ic_holder_computer'), 'product_004': $...
https://github.com/Harrisonls2004/WaterFlow
fe620434a6a9bac5bece95b27201dd2aa8237f72
github
LYM15/FireflyCompanion
entry/src/main/ets/view/OrderList.ets
arkts
updateFilter
调用 filter 并更新状态
updateFilter(orderTypeId: number) { this.orderDataFilter = this.filterOrderData(orderTypeId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orderTypeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A...
updateFilter(orderTypeId: number) { this.orderDataFilter = this.filterOrderData(orderTypeId); }
https://github.com/LYM15/FireflyCompanion
ceb0201abd2d384895ec22fe260b54f1d0c40a8c
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleEvents.ets
arkts
recordPastEvent
Record an event that already occurred at a known past timestamp. Useful when an integrator buffers events themselves (e.g. while offline via a 3rd-party queue) and later flushes them into Countly, the original wall-clock time matters for bucketing, so we don't overwrite it with "now". Non-positive timestamps fall back ...
public async recordPastEvent( key: string, segmentation: SegmentationMap | null, count: number, sum: number, dur: number, timestamp: number ): Promise<void> { if (this.rejectIfHalted('ModuleEvents', 'recordPastEvent')) return; let ts: number = timestamp; if (!Number.isFinite(ts) ...
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 recordPastEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AS...
public async recordPastEvent( key: string, segmentation: SegmentationMap | null, count: number, sum: number, dur: number, timestamp: number ): Promise<void> { if (this.rejectIfHalted('ModuleEvents', 'recordPastEvent')) return; let ts: number = timestamp; if (!Number.isFinite(ts) ...
https://github.com/Countly/countly-sdk-hos
170916a0399e3a48a01b48160c63d03a79116b57
github
Delsin-Yu/JustPDF
entry/src/main/ets/entryability/EntryAbility.ets
arkts
tryDirectLaunch
处理 onNewWant / 系统分享等写入的 launchUri。 @returns 是否已发起打开(含 defer 到 PDFView);false 表示 Router 未就绪,launchUri 仍保留
private async tryDirectLaunch(): Promise<boolean> { const launchUri = AppStorage.get<string>('launchUri'); const router = this.resolveActiveRouter(); if (!launchUri || router === undefined) { return false; } AppStorage.setOrCreate('launchUri', ''); try { const args = await this.bui...
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 tryDirectLaunch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async tryDirectLaunch(): Promise<boolean> { const launchUri = AppStorage.get<string>('launchUri'); const router = this.resolveActiveRouter(); if (!launchUri || router === undefined) { return false; } AppStorage.setOrCreate('launchUri', ''); try { const args = await this.bui...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/entryability/EntryAbility.ets#L501-L524
99cb63e3dff0e5803e6ccf01f294fc5486061191
github
SuperBird007/HarmonyApp_beichengyu
entry/src/main/ets/component/OptionButton.ets
arkts
onAnswerStatusChange
作答状态 Prop 变量的更新顺序和声明顺序是一样的,因此 answerStatus 应该在 selectedOption 之后声明
onAnswerStatusChange() { if (this.option === this.answer) { // 自己是正确答案,改为绿色 this.optionStatus = OptionStatus.Right } else { // 自己不是正确答案 if (this.option === this.selectedOption) { // 自己是用户选择的选项,改为红色 this.optionStatus = OptionStatus.Wrong } else { // 自己不是用户选择的选项,不改变样式 this.opti...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAnswerStatusChange 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_blo...
onAnswerStatusChange() { if (this.option === this.answer) { // 自己是正确答案,改为绿色 this.optionStatus = OptionStatus.Right } else { // 自己不是正确答案 if (this.option === this.selectedOption) { // 自己是用户选择的选项,改为红色 this.optionStatus = OptionStatus.Wrong } else { // 自己不是用户选择的选项,不改变样式 this.opti...
https://github.com/SuperBird007/HarmonyApp_beichengyu
ce88113701365d717266dcba273772fe89ed7e0b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/TokenManager.ets
arkts
saveUserToken
保存普通用户Token
static saveUserToken(token: string, userInfo: any) { SettingsUtil.put('token', token); SettingsUtil.put('isLoggedIn', true); SettingsUtil.put('userInfo', JSON.stringify(userInfo)); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveUserToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
static saveUserToken(token: string, userInfo: any) { SettingsUtil.put('token', token); SettingsUtil.put('isLoggedIn', true); SettingsUtil.put('userInfo', JSON.stringify(userInfo)); }
https://github.com/LJ666-ui/harmony-health-care
f94e486ac11f1604008872e3f5bf741696a9c5a8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/PaginationHandler.ets
arkts
getCurrentCursor
获取当前cursor
getCurrentCursor(sourceId: string): string | null { const state = this.paginationStates.get(sourceId); return state ? state.currentCursor : null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentCursor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
getCurrentCursor(sourceId: string): string | null { const state = this.paginationStates.get(sourceId); return state ? state.currentCursor : null; }
https://github.com/DaLongZhuaZi/manxia
7cab7c6c254f790a749a7b3f53910151bcba55d2
github
the-wwyang/kids-learning-app
src/main/ets/services/ScoreService.ets
arkts
getUserLevelInfo
获取用户等级信息
public getUserLevelInfo(): UserLevelInfo | null { const userData = appStorage.getCurrentUser(); if (!userData) return null; const nextLevelExp = this.calculateNextLevelExp(userData.level); const expPercent = Math.round((userData.totalExp / nextLevelExp) * 100); return { level: userData.lev...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUserLevelInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Lef...
public getUserLevelInfo(): UserLevelInfo | null { const userData = appStorage.getCurrentUser(); if (!userData) return null; const nextLevelExp = this.calculateNextLevelExp(userData.level); const expPercent = Math.round((userData.totalExp / nextLevelExp) * 100); return { level: userData.lev...
https://github.com/the-wwyang/kids-learning-app
dddec97528a9d0a10d0d34b0d575f7cfc65fbc53
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/microphone/MicrophoneStream.ets
arkts
stopStatsTimer
停止统计定时器
private stopStatsTimer(): void { if (this.statsTimerId !== -1) { clearInterval(this.statsTimerId); this.statsTimerId = -1; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopStatsTimer 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#expr...
private stopStatsTimer(): void { if (this.statsTimerId !== -1) { clearInterval(this.statsTimerId); this.statsTimerId = -1; } }
https://github.com/AlkaidLab/moonlight-harmony
25429597412ea134fb45a651fc90c65ae23f6da3
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosEngineHost.ets
arkts
clearSceneMessageHandler
Deregisters the current scene message handler. Call from CocosBattlePage.aboutToDisappear to prevent stale handler references from receiving messages after the page is torn down.
clearSceneMessageHandler(): void { this.sceneMessageHandler = null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearSceneMessageHandler 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#sta...
clearSceneMessageHandler(): void { this.sceneMessageHandler = null; }
https://github.com/terryma2024/happyword
c7b4132a19ebb85ec51d2431ee694994d2b6d573
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCountDownViewModel.ets
arkts
resetControl
重置手动控制的倒计时
resetControl(): void { this.controlController.reset(); this.controlStatusText = "未开始"; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetControl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block...
resetControl(): void { this.controlController.reset(); this.controlStatusText = "未开始"; }
https://github.com/codelably/tuniao-ui
7bae8312047c31f58f373ede6d561a246a16eb61
github
XJTUWYD/ArkDiff
entry/src/main/ets/engine/FilterRuleEngine.ets
arkts
normalizeLine
标准化文本行(应用空白/大小写规则后用于比较)
static normalizeLine(line: string, config: FilterConfig): string { let result = line; if (config.ignoreCase) { result = result.toLowerCase(); } if (config.ignoreAllWhitespace) { result = result.replace(/\s+/g, ''); } else if (config.ignoreWhitespace) { result = result.trim(); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left normalizeLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
static normalizeLine(line: string, config: FilterConfig): string { let result = line; if (config.ignoreCase) { result = result.toLowerCase(); } if (config.ignoreAllWhitespace) { result = result.replace(/\s+/g, ''); } else if (config.ignoreWhitespace) { result = result.trim(); ...
https://github.com/XJTUWYD/ArkDiff
8073cc9105b02151fd2713073c8f68a2e7c50390
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/HomeMiniBarPlayer.ets
arkts
build
Composes cover and aside in a row with gesture to open the full player on upward pan.
build() { Row({ space: 8 }) { HomeMiniBarAlbumCover({ playerViewModel: this.playerViewModel, followAppMiniBarExpanded: this.followAppMiniBarExpanded }) HomeMiniBarPlayerAside({ playerViewModel: this.playerViewModel, showPreviousTrack: this.showPreviousTrack ...
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#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { Row({ space: 8 }) { HomeMiniBarAlbumCover({ playerViewModel: this.playerViewModel, followAppMiniBarExpanded: this.followAppMiniBarExpanded }) HomeMiniBarPlayerAside({ playerViewModel: this.playerViewModel, showPreviousTrack: this.showPreviousTrack ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
21629628faf1d115a428fcdb653399542cc8d3d6
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
getLevelName
获取日志级别名称
private getLevelName(level: LogLevel): string { switch (level) { case LogLevel.DEBUG: return 'DEBUG'; case LogLevel.INFO: return 'INFO'; case LogLevel.WARN: return 'WARN'; case LogLevel.ERROR: return 'ERROR'; case LogLevel.FATAL: return 'FATAL'; default: return 'UNKNOWN'; }...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLevelName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private getLevelName(level: LogLevel): string { switch (level) { case LogLevel.DEBUG: return 'DEBUG'; case LogLevel.INFO: return 'INFO'; case LogLevel.WARN: return 'WARN'; case LogLevel.ERROR: return 'ERROR'; case LogLevel.FATAL: return 'FATAL'; default: return 'UNKNOWN'; }...
https://github.com/DaLongZhuaZi/manxia
df58c4c9b9d11012912b8aee9be335d3b25b28ea
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/viewmodel/RecommendViewModel.ets
arkts
requestPlayBySongId
Requests playback for the given song by updating global PlaybackIntentState. @param songId - Song identifier to play.
public requestPlayBySongId(songId: number): void { RecommendDataUtil.applyPlaybackIntentForSongId(songId, this.playbackIntent); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left requestPlayBySongId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left songId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public requestPlayBySongId(songId: number): void { RecommendDataUtil.applyPlaybackIntentForSongId(songId, this.playbackIntent); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
3e9d0e7559fd47f41d089c495ac6b919317c00a6
gitcode
bhengubv/aether-protocol
arkts/src/main/ets/vault/ReedSolomonCodec.ets
arkts
decodeDataShards
Reconstructs the K data shards from any K available shards. `available` maps a shard index (0…N-1) to its bytes; exactly K distinct entries are required, all of equal length. Returns the K data shards (indices 0…K-1, in order). Throws if fewer than K shards are supplied (K-1 or fewer is unrecoverable).
decodeDataShards(available: Map<number, Uint8Array>): Uint8Array[] { // Take the K lowest-indexed available shards (deterministic; any K suffice for // an MDS code). const indices: number[] = []; available.forEach((val: Uint8Array, idx: number): void => { if (idx >= 0 && idx < this.n) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left decodeDataShards AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left available AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left M...
decodeDataShards(available: Map<number, Uint8Array>): Uint8Array[] { // Take the K lowest-indexed available shards (deterministic; any K suffice for // an MDS code). const indices: number[] = []; available.forEach((val: Uint8Array, idx: number): void => { if (idx >= 0 && idx < this.n) { ...
https://github.com/bhengubv/aether-protocol
240601186953d9a534acac60bba764fcbf82fdb8
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
deleteByCategoryId
批量删除分类的规则
static async deleteByCategoryId(userId: number, categoryId: number): Promise<number> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_deleted: 1, updated_at: new Date().toISOString() }; const predicates = new relational...
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 deleteByCategoryId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef...
static async deleteByCategoryId(userId: number, categoryId: number): Promise<number> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_deleted: 1, updated_at: new Date().toISOString() }; const predicates = new relational...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ae405b22f5594a5ac8bc0138b56551f138816275
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/Retrofit.ets
arkts
setBaseUrl
Set the base URL for HTTP requests.
setBaseUrl(baseUrl: string): RetrofitBuilder { this.baseUrl = baseUrl; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig...
setBaseUrl(baseUrl: string): RetrofitBuilder { this.baseUrl = baseUrl; return this; }
https://github.com/killetom/ktretrofit
2c384d469c32df44ae1669957b5a45903bfd5117
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets
arkts
getSandboxScript
获取沙箱脚本(纯JS,用于runJavaScript注入) 完整实现Legado书源所需的所有API
private getSandboxScript(): string { return ` // ========== Rhino沙箱初始化脚本 ========== // 完整实现Legado书源所需的所有API (function() { // 如果已经初始化,直接返回 if (window.rhinoSandbox && window.rhinoSandbox.ready) { return; } // ========== 沙箱状态 ========== window.rhinoSandbox = { ready: false, mode: 'offline', ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSandboxScript 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...
private getSandboxScript(): string { return ` // ========== Rhino沙箱初始化脚本 ========== // 完整实现Legado书源所需的所有API (function() { // 如果已经初始化,直接返回 if (window.rhinoSandbox && window.rhinoSandbox.ready) { return; } // ========== 沙箱状态 ========== window.rhinoSandbox = { ready: false, mode: 'offline', ...
https://github.com/DaLongZhuaZi/manxia
b364ccb1c1a35edf1e78cde395a2909926697120
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/IllustDetailViewModel.ets
arkts
loadRelated
加载相关推荐 (合并首次加载和翻页) @param id 插画ID (首次加载时传入) @param nextUrl 翻页URL (加载更多时传入)
async loadRelated(id?: number, nextUrl?: string) { // 防抖 if (this.isLoadingMoreRelated) return; // 必须至少传一个 if (!id && !nextUrl) return; this.isLoadingMoreRelated = true; try { // 统一调用改造后的 Service 方法 const data = await pixiv.getRelatedIllusts(id || 0, nextUrl); const newIllus...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadRelated AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left id AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_annotatio...
async loadRelated(id?: number, nextUrl?: string) { // 防抖 if (this.isLoadingMoreRelated) return; // 必须至少传一个 if (!id && !nextUrl) return; this.isLoadingMoreRelated = true; try { // 统一调用改造后的 Service 方法 const data = await pixiv.getRelatedIllusts(id || 0, nextUrl); const newIllus...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/IllustDetailViewModel.ets#L104-L133
ac9fc8c1a41c99e175c3aa96aad94b76ef6680f8
github
Gramony/Gramony
features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets
arkts
modifyAt
I don't think this method will be used but just in case we need it
modifyAt(index: number, chat: Chat): void { this.sortedUnpinnedChatsMap.set(chat.chatId.toString(), chat); this.notifyDataChange(index); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left modifyAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,...
modifyAt(index: number, chat: Chat): void { this.sortedUnpinnedChatsMap.set(chat.chatId.toString(), chat); this.notifyDataChange(index); }
https://github.com/Gramony/Gramony
fd288adb87a7e619b0e93578a4c8bfa5de08be45
github
HarmonyOS_Samples/BestPracticeSnippets
LoadPerformanceInWeb/entry/src/main/ets/pages/common.ets
arkts
loadUrl
This function is a user-defined function and can be used as an initialization function.
loadUrl(url: string): void { if (this.rootWebviewController !== null) { try { // Reuse the pre-created components and reload the url. this.rootWebviewController.loadUrl(url); } catch (error) { hilog.info(0x0000, 'testTag', '%{public}s', 'loadUrl fail'); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri...
loadUrl(url: string): void { if (this.rootWebviewController !== null) { try { // Reuse the pre-created components and reload the url. this.rootWebviewController.loadUrl(url); } catch (error) { hilog.info(0x0000, 'testTag', '%{public}s', 'loadUrl fail'); } } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
e63b4867a85afd6e26d98235fa4c207cf1bd36d6
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/UnifiedOperationInterface.ets
arkts
checkSecurityPolicy
检查安全策略
private checkSecurityPolicy(url: string, action: string): boolean { // 实现安全策略检查逻辑 logger.debug(TAG, '检查安全策略', url, action); return true; // 简化实现 }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkSecurityPolicy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private checkSecurityPolicy(url: string, action: string): boolean { // 实现安全策略检查逻辑 logger.debug(TAG, '检查安全策略', url, action); return true; // 简化实现 }
https://github.com/DaLongZhuaZi/manxia
c9b9f1a4d04da47b3d98f8ddf03c8ca152460ac3
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
setDocType
Sets the document type (DOCTYPE) for the XML output. @param {string} text - The DOCTYPE declaration to be added to the XML output.
public setDocType(text: string): void { let stringBuilder = this.prepareBufferForNewItem(text); stringBuilder.append(`<!DOCTYPE ${text}>`); this.type = XmlType.OTHERS; this.writeToBuffer(stringBuilder, 'SetDocType'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDocType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
public setDocType(text: string): void { let stringBuilder = this.prepareBufferForNewItem(text); stringBuilder.append(`<!DOCTYPE ${text}>`); this.type = XmlType.OTHERS; this.writeToBuffer(stringBuilder, 'SetDocType'); }
https://gitcode.com/iop123123/arkts-static-skills
11deb220438a1aceac63edd0c6286a6085a76d6a
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.Dialog.ets
arkts
getString
get string value @param resourceId Resource id @returns resource value
function getString(resourceId: long): string { let res = ''; if (resourceId <= 0) { hilog.error(0x3900, 'Ace', 'CustomContentDialog getString error'); return res; } try { res = resourceManager.getSysResourceManager().getStringSync(resourceId); } catch (error) { let code: number = (error as Cla...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function getString(resourceId: long): string { let res = ''; if (resourceId <= 0) { hilog.error(0x3900, 'Ace', 'CustomContentDialog getString error'); return res; } try { res = resourceManager.getSysResourceManager().getStringSync(resourceId); } catch (error) { let code: number = (error as Cla...
https://gitcode.com/openharmony/arkui_ace_engine
e41aa7913a4390cb7442024344ef939b4e5e5bd1
gitcode
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/NoteUtil.ets
arkts
setNoteChecked
Set Note Checked status @param checkedNoteArray - Checked status Note list @param noteItem - note
setNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) { LogUtil.info(TAG, "setNoteChecked") checkedNoteArray.push(noteItem) AppStorage.Set('CheckedNoteArray',checkedNoteArray) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setNoteChecked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left checkedNoteArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Right ...
setNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) { LogUtil.info(TAG, "setNoteChecked") checkedNoteArray.push(noteItem) AppStorage.Set('CheckedNoteArray',checkedNoteArray) }
https://gitee.com/openharmony/applications_notes.git
857ae51ae6b86679e40d8cdc9ac347ee2496b821
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets
arkts
isNaN
Checks if float is NaN (not a number) @param v the float to test @returns true if the argument is NaN
public static isNaN(v: float): boolean { // IEEE-754 feature return v != v; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left isNaN AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#iden...
public static isNaN(v: float): boolean { // IEEE-754 feature return v != v; }
https://gitcode.com/iop123123/arkts-static-skills
fbdb89de61db1486c8c29171915e175a9039840d
gitcode
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
analyzeIncrementalByIndex
Incrementally re-analyze the text based on patch content (by character index) @param startIndex Start index of the patch change @param endIndex End index of the patch change @param newText Patched text @return Highlight result
public analyzeIncrementalByIndex(startIndex: number, endIndex: number, newText: string): DocumentHighlight { if (this.nativeHandle == 0) { return new DocumentHighlight(); } let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeChanges2(this.nativeHandle, startIndex, endIndex, newText); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeIncrementalByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb...
public analyzeIncrementalByIndex(startIndex: number, endIndex: number, newText: string): DocumentHighlight { if (this.nativeHandle == 0) { return new DocumentHighlight(); } let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeChanges2(this.nativeHandle, startIndex, endIndex, newText); ...
https://github.com/FinalScave/SweetLine
1a186735526e3a8f253ab490cefd09cbd4cb4fc0
github
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
checkFileExists
检查文件是否存在 @param filePath 文件路径
public async checkFileExists(recentFile: RecentFile): Promise<boolean> { try { return new KdbxFileManager(recentFile.storageType, recentFile.storageConfig).exists(recentFile.filePath); } catch (error) { return false; } }
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 checkFileExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recentFile AST#identifier#Right AST#:#Le...
public async checkFileExists(recentFile: RecentFile): Promise<boolean> { try { return new KdbxFileManager(recentFile.storageType, recentFile.storageConfig).exists(recentFile.filePath); } catch (error) { return false; } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L253-L259
e683f10cc234f4fb9d5ed108de30bcbe42dade17
github
the-wwyang/kids-learning-app
src/main/ets/utils/AnimationUtils.ets
arkts
easeInOutQuad
缓动函数 - 慢进慢出 @param t 进度 (0-1) @returns 缓动后的进度
static easeInOutQuad(t: number): number { return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left easeInOutQuad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
static easeInOutQuad(t: number): number { return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t; }
https://github.com/the-wwyang/kids-learning-app
202ce45a0c74435840e2847068106a8b4adecb3d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Task/BackgroundTaskHelper.ets
arkts
requestBackgroundRunning
真正向系统申请后台运行资格
private static async requestBackgroundRunning(context: common.UIAbilityContext): Promise<boolean> { try { const wantAgentObj: WantAgent = await BackgroundTaskHelper.buildWantAgent(context); await backgroundTaskManager.startBackgroundRunning( context, UI_ABILITY_BACKGROUND_MODES, ...
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 requestBackgroundRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identi...
private static async requestBackgroundRunning(context: common.UIAbilityContext): Promise<boolean> { try { const wantAgentObj: WantAgent = await BackgroundTaskHelper.buildWantAgent(context); await backgroundTaskManager.startBackgroundRunning( context, UI_ABILITY_BACKGROUND_MODES, ...
https://github.com/DaLongZhuaZi/manxia
35c5c9d4ba13e917580d5f638704a85e7dcec30c
github