nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/AnomalyDetectionDAO.ets
arkts
getByUserId
获取用户的主基线(全类别、月度)
static async getByUserId(userId: number): Promise<UserSpendingBaseline | null> { return await UserSpendingBaselineDAO.get(userId, 0, 'monthly'); }
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 getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST...
static async getByUserId(userId: number): Promise<UserSpendingBaseline | null> { return await UserSpendingBaselineDAO.get(userId, 0, 'monthly'); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
7036436f17c7420ae0c6039d4d9ac37c3ded1834
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
handleStreamLineWithToolsBytes
处理流式响应行(支持工具调用回调)
private handleStreamLineWithToolsBytes( apiStyle: ApiStyle, useOpenAIResponses: boolean, lineBytes: Uint8Array, onData: (content: string) => void, onError: (error: string) => void, onReasoningData?: (content: string) => void, onImageData?: (base64Data: string, mimeType: string, isPartial: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left handleStreamLineWithToolsBytes AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left apiStyle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ApiStyle AST#identifie...
private handleStreamLineWithToolsBytes( apiStyle: ApiStyle, useOpenAIResponses: boolean, lineBytes: Uint8Array, onData: (content: string) => void, onError: (error: string) => void, onReasoningData?: (content: string) => void, onImageData?: (base64Data: string, mimeType: string, isPartial: ...
https://github.com/LongLiveY96/chatcube
1e34a623841fe867900750e74dcf472e43863f07
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets
arkts
put
存储偏好设置 @param key 键 @param value 值
async put(key: string, value: string | number | boolean): Promise<void> { await this.ensureInitialized(); try { await this.preference!.put(key, value); await this.preference!.flush(); Logger.debug(this.LOG_TAG, `Preference saved: ${key}`); } catch (err) { const error = err instanc...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left put AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
async put(key: string, value: string | number | boolean): Promise<void> { await this.ensureInitialized(); try { await this.preference!.put(key, value); await this.preference!.flush(); Logger.debug(this.LOG_TAG, `Preference saved: ${key}`); } catch (err) { const error = err instanc...
https://github.com/Kira-Yagami-Light/Kira-Projects
b20dd609a07eee855e1a3293ab2cfcc3dbcb98dc
github
SuperBird007/HarmonyApp_beichengyu
entry/src/main/ets/pages/LoginPage.ets
arkts
circleBtnStyle
原型按钮公共样式函数
@Extend(Button) function circleBtnStyle() { .width('60vp') .height('60vp') }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Button AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
@Extend(Button) function circleBtnStyle() { .width('60vp') .height('60vp') }
https://github.com/SuperBird007/HarmonyApp_beichengyu
e66e8729e5fa8dfd5b62b02e3ef8bbd94fa9db6a
github
openharmony/applications_app_samples
code/BasicFeature/Ads/OAIDSample/entry/src/ohosTest/ets/test/Ability.test.ets
arkts
getResourceString
资源本地化
async function getResourceString<T extends Resource>(resource: T): Promise<string> { let manage = delegator.getAppContext().resourceManager let text = await manage.getStringValue(resource) return text }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getResourceString 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#...
async function getResourceString<T extends Resource>(resource: T): Promise<string> { let manage = delegator.getAppContext().resourceManager let text = await manage.getStringValue(resource) return text }
https://github.com/openharmony/applications_app_samples
d76fda65006f13320717239c8cb162f745640735
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
put
设置变量值
put(key: string, value: string): void { this.variables.set(key, value); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ...
put(key: string, value: string): void { this.variables.set(key, value); }
https://github.com/DaLongZhuaZi/manxia
7de03640758e05abb81fb6ac02f8158e58ad937a
github
hiyuey3/Hixy_MyMemories
entry/src/main/ets/pages/DeveloperMode.ets
arkts
aboutToAppear
当此页面即将显示时调用(比依赖返回导航更安全)
aboutToAppear(): void { // 刷新两次:立即刷新,然后短暂延迟后再次刷新,以捕获最近的数据库提交 this.loadEvents(); setTimeout(() => this.loadEvents(), 300); }
AST#program#Left AST#ERROR#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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 刷新两次:立即刷新,然后短暂延迟后再次刷新,以捕获最近的数据库提交 this.loadEvents(); setTimeout(() => this.loadEvents(), 300); }
https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/pages/DeveloperMode.ets#L43-L47
ff66faa1c6edaf0237fdf634fc1d044570afdc62
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
getWithClientCert
执行带客户端证书的 HTTPS 请求 @param url 请求 URL @param certPath 证书文件路径 @param keyPath 私钥文件路径 @param config 配置选项 @returns 响应字符串
static async getWithClientCert( url: string, certPath: string, keyPath: string, config?: HttpClientConfig ): Promise<string> { return HttpClient.get(url, { skipServerValidation: true, clientCertPath: certPath, clientKeyPath: keyPath, connectTimeout: config?.connectTimeout...
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 getWithClientCert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : ...
static async getWithClientCert( url: string, certPath: string, keyPath: string, config?: HttpClientConfig ): Promise<string> { return HttpClient.get(url, { skipServerValidation: true, clientCertPath: certPath, clientKeyPath: keyPath, connectTimeout: config?.connectTimeout...
https://github.com/AlkaidLab/moonlight-harmony
8a131fbbfb13911858c048108771907722a89334
github
xufei5789651/HmWan
commons/utils/src/main/ets/common/GlobalContext.ets
arkts
setContext
存储Context
setContext(key: string, context: common.UIAbilityContext): void { this.contexts.set(key, context); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,...
setContext(key: string, context: common.UIAbilityContext): void { this.contexts.set(key, context); }
https://github.com/xufei5789651/HmWan
59e68a1b107a2dbbdefd5453ca99905e17ceb2ef
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
operatorDivide
Divides this BigInt by another. @param { BigInt } other The divisor. @returns { BigInt } The quotient of the division. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public operatorDivide(other: BigInt): BigInt { return (this.operatorDivideInternal(other))[0] }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorDivide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public operatorDivide(other: BigInt): BigInt { return (this.operatorDivideInternal(other))[0] }
https://gitcode.com/iop123123/arkts-static-skills
c4cae595e6dbda03f09d53bd073664ec12de36d8
gitcode
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
isRadioOn
判断Radio是否打开。 @param slotId 卡槽ID,如果不指定slotId,默认主卡。 @returns
static async isRadioOn(slotId?: number): Promise<boolean> { if (slotId) { return radio.isRadioOn(slotId); } return radio.isRadioOn(); }
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 isRadioOn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST#?...
static async isRadioOn(slotId?: number): Promise<boolean> { if (slotId) { return radio.isRadioOn(slotId); } return radio.isRadioOn(); }
https://github.com/tdcare/tdwebrtc
2584d4ff2610f7fdf5e0510d5623909c674c011e
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/database/PrivacyNoteDB.ets
arkts
insert
新增 @param item 笔记数据 @returns 行数
async insert(item: PrivacyNoteDBInfo) { const store = await this.getStoreInstance() return store.insert(this.tableName, item) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insert AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async insert(item: PrivacyNoteDBInfo) { const store = await this.getStoreInstance() return store.insert(this.tableName, item) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
59b14ad50ef4d061f9594a9ae8a0bd4490316ed2
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Creates a new Int8Array using initializer @param { FixedArray<Object> } data - initializer @returns { Int8Array } - a new Int8Array @throws { Error } - function not implemented @syscap SystemCapability.Utils.Lang @FaAndStageModel
public of(data: FixedArray<Object>): Int8Array { throw new Error("Int8Array.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public of(data: FixedArray<Object>): Int8Array { throw new Error("Int8Array.of: not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
95173c2647be78ea8caa27ca79fa9255e279656f
gitcode
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
applyPlaybackWindowChrome
When entering or leaving full-screen playback: toggles full-screen and sets status bar content color. Does not change decor buttons; for that use {@link applyPcPlaybackDecorButtonStyle} on PC. @param enter True when opening full-screen player UI, false when closing.
applyPlaybackWindowChrome(enter: boolean): void { this.setFullScreen(enter); this.setWindowSystemBarProperties({ statusBarContentColor: enter ? '#FFFFFF' : '#000000' }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyPlaybackWindowChrome AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right ...
applyPlaybackWindowChrome(enter: boolean): void { this.setFullScreen(enter); this.setWindowSystemBarProperties({ statusBarContentColor: enter ? '#FFFFFF' : '#000000' }); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
74e0e7b8740016ce727f9aff5700bc708617c35c
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
getSeasonalFactors
获取季节性因子
getSeasonalFactors(): SeasonalFactor[] { try { const parsed = JSON.parse(this.seasonalFactorsJson) as SeasonalFactor[]; return parsed; } catch (e) { return []; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSeasonalFactors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left SeasonalFacto...
getSeasonalFactors(): SeasonalFactor[] { try { const parsed = JSON.parse(this.seasonalFactorsJson) as SeasonalFactor[]; return parsed; } catch (e) { return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1ec8857f673e11ecdc7950dfdb94737976617aa9
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeStateController.ets
arkts
getTouchConfig
获取当前触摸配置
public getTouchConfig(): TouchConfig { return this._touchConfig; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTouchConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left TouchCo...
public getTouchConfig(): TouchConfig { return this._touchConfig; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
e24e84e2638aa6b9135ccbe6d39b43a80e18ad5a
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
getInfo
获取文件/文件夹信息 @param path 路径(相对路径) @returns Promise<HttpResponse> 结果信息
public async getInfo(path: string = ''): Promise<HttpResponse> { if (!this.axiosInstance) { throw new Error('Axios instance not initialized'); } try { const apiPath = this.normalizePath(path, OneDrivePathType.INFO); hilog.info(DOMAIN, TAG, `getInfo: path=${path}, apiPath=${apiPath}`); ...
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 getInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Rig...
public async getInfo(path: string = ''): Promise<HttpResponse> { if (!this.axiosInstance) { throw new Error('Axios instance not initialized'); } try { const apiPath = this.normalizePath(path, OneDrivePathType.INFO); hilog.info(DOMAIN, TAG, `getInfo: path=${path}, apiPath=${apiPath}`); ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L527-L543
b5732605028b801b96544b72212132e2c1ff6ccd
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
dismissSpecModal
关闭规格选择弹窗 @returns {void} 无返回值
dismissSpecModal(): void { this.showSpecSelectModal = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left dismissSpecModal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
dismissSpecModal(): void { this.showSpecSelectModal = false; }
https://github.com/Joker-x-dev/CoolMallArkTS
a1f1a6317b0f6344a1ab2fb21d56b6b57bcebda4
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
toString
Obtains a string representation of the current range. @returns { string } Returns a string representation of the current range object.
toString(): string { let strLower: string = this._lowerLimit.toString() let strUpper: string = this._upperLimit.toString() return '[' + strLower + ', ' + strUpper + ']' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toString 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_blo...
toString(): string { let strLower: string = this._lowerLimit.toString() let strUpper: string = this._upperLimit.toString() return '[' + strLower + ', ' + strUpper + ']' }
https://gitcode.com/iop123123/arkts-static-skills
56cf67efab78ba18e4c94619e05030c874d24a66
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
saveReaderSettings
保存阅读设置
async saveReaderSettings(settings: NovelReaderSettings, userId: string = 'default'): Promise<void> { const store = this.getStore(); const now = Date.now(); const id = this.generateId(); await store.executeSql('DELETE FROM novel_reader_settings WHERE userId = ?', [userId]); const sql = `INSERT IN...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveReaderSettings AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left settings AST#identifier#Right AST#type_annotation#Left AST#:...
async saveReaderSettings(settings: NovelReaderSettings, userId: string = 'default'): Promise<void> { const store = this.getStore(); const now = Date.now(); const id = this.generateId(); await store.executeSql('DELETE FROM novel_reader_settings WHERE userId = ?', [userId]); const sql = `INSERT IN...
https://github.com/DaLongZhuaZi/manxia
0fb3632451d756ab4c8f583cad2450a264c6407b
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookOpenTransition.ets
arkts
startCloseTransition
开始关闭过渡
public startCloseTransition( coverPosition: CoverPosition, readerContentPixelMap?: image.PixelMap, onComplete?: () => void ): void { if (this.isTransitioning) { logger.warn(TAG, '已有过渡动画在进行中'); return; } this.isTransitioning = true; this.currentMode = TransitionMode.CLOSE...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left startCloseTransition AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left coverPosition AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CoverPosition AST#identifier#R...
public startCloseTransition( coverPosition: CoverPosition, readerContentPixelMap?: image.PixelMap, onComplete?: () => void ): void { if (this.isTransitioning) { logger.warn(TAG, '已有过渡动画在进行中'); return; } this.isTransitioning = true; this.currentMode = TransitionMode.CLOSE...
https://github.com/DaLongZhuaZi/manxia
39e9bbe02404bb746f0939b6179e61d71d617492
github
asasugar/HarmoneyNote
entry/src/main/ets/model/MediaQueryModel.ets
arkts
unRegister
Deregister Listener.
public unRegister(): void { let portraitFunc = this.onPortrait.bind(this); this.listener.off('change', portraitFunc); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unRegister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Rig...
public unRegister(): void { let portraitFunc = this.onPortrait.bind(this); this.listener.off('change', portraitFunc); }
https://github.com/asasugar/HarmoneyNote
a7b89fe361578972c08a4afedff310d940f4b788
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets
arkts
reset
重置提醒状态
reset(): void { this.state.reset(); console.log('提醒状态已重置'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.state.reset(); console.log('提醒状态已重置'); }
https://gitcode.com/openharmony/codelabs
94b39610b14f43c2389fbbcef85f630499bfd1e3
gitcode
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
deleteClassFromSemester
向指定学期删除一门课程 @param id 学期索引 @param removingClass 新课程 @returns 删除成功无返回值,如果未找到课程则返回'NotFound',如果发生错误则返回错误信息的字符串
deleteClassFromSemester(id: number, removingClass: classAttribute): string | undefined { try { const originClass: classAttribute[] = JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[id].createTime), '[]')); let hasEqualClass: boolean = false; for (let i = originClass....
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left deleteClassFromSemester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
deleteClassFromSemester(id: number, removingClass: classAttribute): string | undefined { try { const originClass: classAttribute[] = JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[id].createTime), '[]')); let hasEqualClass: boolean = false; for (let i = originClass....
https://github.com/Your-USTC/DailyNic_HMOS
90a82b3bc9d8d046adb8ca4dcb31afd6a1f9600e
github
harmonyos/codelabs
AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
adaptDimension
Obtains the screen horizontal adaptation value. @return number
static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESI...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left adaptDimension 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 ...
static adaptDimension(value: number): number { let deviceDisplay = GlobalContext.getContext().getObject('globalDisplay') as display.Display; let widthScale = deviceDisplay.width / DESIGN_WIDTH; let virtualHeight = widthScale * DESIGN_HEIGHT; let designDim = Math.sqrt(DESIGN_WIDTH * DESIGN_WIDTH + DESI...
https://gitee.com/harmonyos/codelabs.git
3d86935ec0f06cf573d2115b4eca04610034743b
gitee
Countly/countly-sdk-hos
library/src/main/ets/CountlyConfig.ets
arkts
enableVisibilityTracking
Tag every recorded event/view with a `cly_v` segmentation value (1 in foreground, 0 in background). Useful for correlating telemetry with app lifecycle state.
public enableVisibilityTracking(): ExperimentalConfig { this.visibilityTracking = true; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableVisibilityTracking AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Le...
public enableVisibilityTracking(): ExperimentalConfig { this.visibilityTracking = true; return this; }
https://github.com/Countly/countly-sdk-hos
619dfbc8aeac37f1efd2c9e1b9ac6bf4ef19bf28
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
getRecognitionHistory
==================== 历史管理 ==================== 获取用户的识别历史
static async getRecognitionHistory( userId: number, limit: number = 20, offset: number = 0 ): Promise<OCRRecognitionRecord[]> { try { return await OCRRecognitionRecordDAO.getByUserId(userId, limit, offset); } catch (error) { console.error('[OCRRecognitionService] 获取识别历史失败:', error); ...
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 getRecognitionHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#...
static async getRecognitionHistory( userId: number, limit: number = 20, offset: number = 0 ): Promise<OCRRecognitionRecord[]> { try { return await OCRRecognitionRecordDAO.getByUserId(userId, limit, offset); } catch (error) { console.error('[OCRRecognitionService] 获取识别历史失败:', error); ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
77af7454bee6962936b6657d83ec8f35cafdc9f2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Array.ets
arkts
lastIndexOf
lastIndexOf(arr: Object[], key: Object, fromIndex: int) tries to find entry of key into arr which is not greater than fromIndex @param arr array to find a key @param key a value to find @param fromIndex an index of arr to begin search with (including, search is performed backwards) @returns last index of key if found i...
function lastIndexOf(arr: Object[], key: Object, fromIndex: int): int throws { return lastIndexOf(arr, key, -1, fromIndex) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lastIndexOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function lastIndexOf(arr: Object[], key: Object, fromIndex: int): int throws { return lastIndexOf(arr, key, -1, fromIndex) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a912dac11531e2da69f98bdf9aed4defda28eb90
gitee
arkui-x/samples
CodeLab/Cases/feature/clockin/src/main/ets/components/ClockInComponent.ets
arkts
isUserInCircle
判断用户是否在圆圈内。 @param {LatLng} pos1 - 用户位置。 @param {LatLng} pos2 - 圆心位置。 @param {number} radius - 圆半径,单位为米。
isUserInCircle(pos1: mapCommon.LatLng, pos2: mapCommon.LatLng, radius: number) { // TODO:知识点:通过计算两点之间的距离与圆半径的关系来判断用户是否在打卡圆圈内 const distance = map.calculateDistance(pos1, pos2); this.isInArea = distance <= radius; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isUserInCircle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left...
isUserInCircle(pos1: mapCommon.LatLng, pos2: mapCommon.LatLng, radius: number) { // TODO:知识点:通过计算两点之间的距离与圆半径的关系来判断用户是否在打卡圆圈内 const distance = map.calculateDistance(pos1, pos2); this.isInArea = distance <= radius; }
https://gitcode.com/arkui-x/samples
698dace3f7a269e7e231d71dce474c8be96aef7d
gitcode
fangmingtao/Ohs_ArkTs_Eyepetizer
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
setData
整体替换数据源
setData(newData: Array<T>) { this.dataSource = newData; this.reloadData(); //通知所有监听器数据已完全替换 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left newData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST#id...
setData(newData: Array<T>) { this.dataSource = newData; this.reloadData(); //通知所有监听器数据已完全替换 }
https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer
0d0a74691e6666764ba53b05a5908a7b1d966a3c
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
应用已启动时,从通知再次打开应用
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onNewWant'); // 处理从通知点击传递的参数 if (want.parameters && want.parameters['scheduleId']) { const scheduleId = want.parameters['scheduleId'] as string; hilog.info(DOMAIN, 'tes...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R...
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onNewWant'); // 处理从通知点击传递的参数 if (want.parameters && want.parameters['scheduleId']) { const scheduleId = want.parameters['scheduleId'] as string; hilog.info(DOMAIN, 'tes...
https://gitcode.com/openharmony/codelabs
b9c8e0506e51f0d832bf2e022224809af2a3d876
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
getSlotForGCDevice
获取 Game Controller Kit 设备的槽位
private getSlotForGCDevice(deviceId: string): number { return this.gcDeviceIdToSlot.get(deviceId) ?? 0; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSlotForGCDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
private getSlotForGCDevice(deviceId: string): number { return this.gcDeviceIdToSlot.get(deviceId) ?? 0; }
https://github.com/AlkaidLab/moonlight-harmony
32304ec8e4358bd3cb3c87f96754fd606b6c6b44
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/NetworkManager.ets
arkts
attemptReconnect
Attempt to reconnect
private static attemptReconnect(): void { if (!isReconnecting || !currentSession) { return; } if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) { console.error(`${TAG}: Max reconnect attempts (${MAX_RECONNECT_ATTEMPTS}) reached`); isReconnecting = false; if (onReconnectFailu...
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 attemptReconnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private static attemptReconnect(): void { if (!isReconnecting || !currentSession) { return; } if (reconnectAttempts >= MAX_RECONNECT_ATTEMPTS) { console.error(`${TAG}: Max reconnect attempts (${MAX_RECONNECT_ATTEMPTS}) reached`); isReconnecting = false; if (onReconnectFailu...
https://github.com/tangwengang-del/freerdp-harmonyos
f7a2a45366ee2437b106f5f217dcc0b6a40c4170
github
dingzhilin1990/zhilinclaw
src/plugins/PluginManager.ets
arkts
getAllPlugins
获取所有已加载的插件
public getAllPlugins(): PluginMetadata[] { return Array.from(this.plugins.values()).map(w => w.plugin.metadata); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllPlugins AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left PluginMe...
public getAllPlugins(): PluginMetadata[] { return Array.from(this.plugins.values()).map(w => w.plugin.metadata); }
https://github.com/dingzhilin1990/zhilinclaw
88445db0837e9158177e04025848ef1410434cdd
github
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
makeBytes
-- Static factory functions (mid level) -- Returns a segment representing the given binary data encoded in byte mode. All input byte arrays are acceptable. Any text string can be converted to UTF-8 bytes and encoded as a byte mode segment.
public static makeBytes(data: Readonly<Array<byte>>): QrSegment { let bb: Array<bit> = [] for (const b of data) { appendBits(b, 8, bb); } return new QrSegment(QrSegment.Mode.BYTE, data.length, bb); }
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 makeBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#...
public static makeBytes(data: Readonly<Array<byte>>): QrSegment { let bb: Array<bit> = [] for (const b of data) { appendBits(b, 8, bb); } return new QrSegment(QrSegment.Mode.BYTE, data.length, bb); }
https://gitee.com/openharmony/arkui_ace_engine.git
21e5495fd14b2c4f0d36809f118ff92b1533f933
gitee
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/ClientSessionManager.ets
arkts
register
Register a new client, stopping any existing one first
public register(client: NativeStreamClient): void { if (this.currentClient && this.currentClient !== client) { LoggerClientSession.warn('[ClientSessionManager] Stopping previous client before registering new one'); this.stopAll(); } this.currentClient = client; LoggerClientSession.info('[C...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left client AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Nativ...
public register(client: NativeStreamClient): void { if (this.currentClient && this.currentClient !== client) { LoggerClientSession.warn('[ClientSessionManager] Stopping previous client before registering new one'); this.stopAll(); } this.currentClient = client; LoggerClientSession.info('[C...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
e7bf579c17b205bcbdfdf30e8673ffc1b6a8704c
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/MonsterCodexFlow.ui.test.ets
arkts
returnToHome
Mirrors the helper in HomeToolbarLocked.ui.test — press back up to 5 times until HomeStartButton resolves so each `it` block starts on the HomePage even if a previous suite left the app mid-flow.
async function returnToHome(driver: Driver): Promise<void> { try { for (let i: number = 0; i < 5; i++) { const home: Component | null = await driver.findComponent(ON.id('HomeStartButton')); if (home !== null) { return; } const codexBack: Component | null = await dri...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left returnToHome AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#type...
async function returnToHome(driver: Driver): Promise<void> { try { for (let i: number = 0; i < 5; i++) { const home: Component | null = await driver.findComponent(ON.id('HomeStartButton')); if (home !== null) { return; } const codexBack: Component | null = await dri...
https://github.com/terryma2024/happyword
d165a78faf93e7c403712fd77e8902206940d323
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
topSources
批量置顶书源
async topSources(sourceIds: string[]): Promise<number> { // 获取当前最小的 customOrder let minOrder = 0; this.sources.forEach(source => { if (source.enabled !== false && source.customOrder !== undefined && source.customOrder < minOrder) { minOrder = source.customOrder; } }); let ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left topSources AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceIds AST#identifier#Right AST#type_annotation#Left AST...
async topSources(sourceIds: string[]): Promise<number> { // 获取当前最小的 customOrder let minOrder = 0; this.sources.forEach(source => { if (source.enabled !== false && source.customOrder !== undefined && source.customOrder < minOrder) { minOrder = source.customOrder; } }); let ...
https://github.com/DaLongZhuaZi/manxia
c0992f1b37bffbb01bf6873d2170d9ead41edc71
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/keyshortcuts/classes/meowKeyBind.ets
arkts
toArray
Convert this keybind to an array of strings. @returns An array of strings representing the keybind.
toArray() { return modifiersToStrings(this.keys).concat(valueToString(this.value)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toArray 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#return_statement#Left AST#ret...
toArray() { return modifiersToStrings(this.keys).concat(valueToString(this.value)); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
7a2e73842d77f9549a82b5679ae0384c05f85679
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets
arkts
getLayoutDirection
Get current layout direction based on language @returns LayoutDirection.RTL for RTL languages, LayoutDirection.LTR otherwise
static getLayoutDirection(): LayoutDirection { return LanguageState.getInstance().getLayoutDirection(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLayoutDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Lay...
static getLayoutDirection(): LayoutDirection { return LanguageState.getInstance().getLayoutDirection(); }
https://github.com/Tencent-RTC/TUIKit_Harmony
1756fcc4322aaff7aa254ea437f323dde345dc8c
github
arkui-x/samples
CodeLab/Cases/feature/imagedepthcopy/src/main/ets/view/ImageDepthCopy.ets
arkts
getFileName
toast弹窗时长
getFileName(): string { switch (this.currentCropTask) { case CropTasks.ONE_ONE: return '11'; case CropTasks.THREE_FOUR: return '43'; case CropTasks.NINE_SIXTH: return '169'; case CropTasks.ORIGIN: return '1'; default: return '0'; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFileName 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_...
getFileName(): string { switch (this.currentCropTask) { case CropTasks.ONE_ONE: return '11'; case CropTasks.THREE_FOUR: return '43'; case CropTasks.NINE_SIXTH: return '169'; case CropTasks.ORIGIN: return '1'; default: return '0'; } }
https://gitcode.com/arkui-x/samples
f67af3a75e716b08e32cfc25ad81e3a5c39ddf94
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets
arkts
createPublicDirFileAsset
在媒体公共资源目录下的创建指定类型的资源对象
async createPublicDirFileAsset(fileDisplayName: string, fileByteBuffer: ArrayBuffer): Promise<string> { Logger.info("createPublicDirFileAsset start") // 获取mediaLibrary对象 let mediaLibraryObj = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context')) let fileAss...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createPublicDirFileAsset AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileDisplayName AST#identifier#Right AST#type...
async createPublicDirFileAsset(fileDisplayName: string, fileByteBuffer: ArrayBuffer): Promise<string> { Logger.info("createPublicDirFileAsset start") // 获取mediaLibrary对象 let mediaLibraryObj = photoAccessHelper.getPhotoAccessHelper(AppStorage.get('context')) let fileAss...
https://github.com/openharmony/applications_app_samples
89247225f08eaa0eca6fa04febe6843197770435
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
slice
Creates a new `Array` object and populates it with elements of `this` instance of `Array` class selected from `start` to `end` (`end` not included) where `start` and `end` represent the index of items in that array. @param start zero-based index at which to start extraction @param end zero-based index at which to end e...
public slice(start: number, end: number): Array<T> { return this.slice(start as int, end as int) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right...
public slice(start: number, end: number): Array<T> { return this.slice(start as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
da996081e97548027d96f5922d9624d2a1b05897
gitee
bluedeer000/HarmonyCalendar
entry/src/main/ets/services/CalendarSyncService.ets
arkts
tempSourceForAccount
构造供 listEventsWithStatus 使用的临时 source 对象
private tempSourceForAccount(account: CalendarAccount, collectionUrl: string): CalendarSource { return { id: "", accountId: account.id ?? "", name: account.displayName ?? "", description: "", collectionUrl, subscriptionUrl: "", principalUrl: "", homeSetUrl: "", ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tempSourceForAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private tempSourceForAccount(account: CalendarAccount, collectionUrl: string): CalendarSource { return { id: "", accountId: account.id ?? "", name: account.displayName ?? "", description: "", collectionUrl, subscriptionUrl: "", principalUrl: "", homeSetUrl: "", ...
https://github.com/bluedeer000/HarmonyCalendar
e0b41c0a5c9678bbeb434aa7f30a69439cd54e1d
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/BubbleComponent.ets
arkts
getBubbleBottomPadding
底部内边距 @returns
getBubbleBottomPadding(): number { const p = this.mShadowRadius + this.mBubbleBorderSize const bottomPadding = p + (this.mShadowY > 0 ? this.mShadowY : 0) + (this.mArrowLocation == ArrowLocation.BOTTOM ? this.mArrowHeight : 0) return bottomPadding + (this.mBubbleBottomPadding == -1 ? this.mB...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBubbleBottomPadding 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...
getBubbleBottomPadding(): number { const p = this.mShadowRadius + this.mBubbleBorderSize const bottomPadding = p + (this.mShadowY > 0 ? this.mShadowY : 0) + (this.mArrowLocation == ArrowLocation.BOTTOM ? this.mArrowHeight : 0) return bottomPadding + (this.mBubbleBottomPadding == -1 ? this.mB...
https://github.com/wuba/omni-ui
c86d7d01b40e7c5eb108ca07c332171e0189734e
github
bluedeer000/HarmonyCalendar
entry/src/main/ets/services/CalendarSourceAdapterRegistry.ets
arkts
getAdapterForSource
根据 CalendarSource 获取适配器实例 先尝试用 source.providerAdapterType,再回退到 sourceType
getAdapterForSource(source: CalendarSource, fallbackAccount?: CalendarAccount): CalendarSourceAdapter { const adapterType: string = source.providerAdapterType?.length ?? 0 > 0 ? (source.providerAdapterType ?? "") : source.sourceType === "caldav" ? "caldav" : source.sourceType === "subs...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAdapterForSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CalendarSource AST#identifier#Righ...
getAdapterForSource(source: CalendarSource, fallbackAccount?: CalendarAccount): CalendarSourceAdapter { const adapterType: string = source.providerAdapterType?.length ?? 0 > 0 ? (source.providerAdapterType ?? "") : source.sourceType === "caldav" ? "caldav" : source.sourceType === "subs...
https://github.com/bluedeer000/HarmonyCalendar
88def1c3db7c0f83ca0644992435f9f9e70527eb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupController.ets
arkts
classifyFailureType
分类失败类型
private classifyFailureType(error: Error, phase: StartupPhase): StartupFailureType { const errorMessage = error.message.toLowerCase(); if (phase === StartupPhase.GLOBAL_CONTEXT_INIT || errorMessage.includes('globalcontext')) { return StartupFailureType.GLOBAL_CONTEXT_FAILURE; } if (pha...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left classifyFailureType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private classifyFailureType(error: Error, phase: StartupPhase): StartupFailureType { const errorMessage = error.message.toLowerCase(); if (phase === StartupPhase.GLOBAL_CONTEXT_INIT || errorMessage.includes('globalcontext')) { return StartupFailureType.GLOBAL_CONTEXT_FAILURE; } if (pha...
https://github.com/DaLongZhuaZi/manxia
e879bb788cd3cd10b6203f05498ffa25c153d180
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
registerTask
注册任务定义
registerTask(task: TaskDefinition): void { this.taskDefinitions.set(task.id, task); logger.debug(TAG, `注册任务: ${task.id} - ${task.name}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TaskDefinition AST#identifier#Right AST#)#L...
registerTask(task: TaskDefinition): void { this.taskDefinitions.set(task.id, task); logger.debug(TAG, `注册任务: ${task.id} - ${task.name}`); }
https://github.com/DaLongZhuaZi/manxia
c6579810170f4da8bef50956e6dc23062d7180ec
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
defineFieldMapParameter
Define field map parameter metadata
static defineFieldMapParameter(paramIndex: number, target: Object, propertyKey: string | symbol): void { let fieldMapParams = this.getMetadata('retrofit:fieldMapParams', target, propertyKey) as number[] || []; fieldMapParams.push(paramIndex); this.defineMetadata('retrofit:fieldMapParams', fieldMapParams, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left defineFieldMapParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left paramIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number...
static defineFieldMapParameter(paramIndex: number, target: Object, propertyKey: string | symbol): void { let fieldMapParams = this.getMetadata('retrofit:fieldMapParams', target, propertyKey) as number[] || []; fieldMapParams.push(paramIndex); this.defineMetadata('retrofit:fieldMapParams', fieldMapParams, ...
https://github.com/killetom/ktretrofit
3c4565db3adc0b6dc98d73af7516b4baaae4e08a
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/auth/AuthNavigator.ets
arkts
toResetPassword
跳转到重置密码页面 @returns {void} 无返回值
static toResetPassword(): void { navigateTo(AuthRoutes.ResetPassword); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toResetPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres...
static toResetPassword(): void { navigateTo(AuthRoutes.ResetPassword); }
https://github.com/Joker-x-dev/CoolMallArkTS
33f16d00f8c1b30669740d64d362582c98b6597f
github
openharmony-tpc/ImageKnife
library/src/main/ets/cache/MemoryLruCache.ets
arkts
put
添加缓存键值对
put(key: string, value: ImageKnifeData): void { if (key == null || value == null) { throw new Error('key or value is invalid '); } let size = this.getImageKnifeDataSize(value) if (size <= 0 || size >= this.maxMemory) { return } // 如果size满了的话,需要按照LRU的方式删除第一个 if (this.lruCache....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ...
put(key: string, value: ImageKnifeData): void { if (key == null || value == null) { throw new Error('key or value is invalid '); } let size = this.getImageKnifeDataSize(value) if (size <= 0 || size >= this.maxMemory) { return } // 如果size满了的话,需要按照LRU的方式删除第一个 if (this.lruCache....
https://gitee.com/openharmony-tpc/ImageKnife.git
b4bfdd0275069c2768b35e7a169d210deee988fd
gitee
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
readFilePic
同步读取路径path的文件
readFilePic(path: string): ArrayBuffer { try { let stat = fs.statSync(path) let fd = fs.openSync(path, fs.OpenMode.READ_ONLY).fd; let length = stat.size let buf = new ArrayBuffer(length); fs.readSync(fd, buf) fs.closeSync(fd) return buf } catch (e) { console.log...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readFilePic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
readFilePic(path: string): ArrayBuffer { try { let stat = fs.statSync(path) let fd = fs.openSync(path, fs.OpenMode.READ_ONLY).fd; let length = stat.size let buf = new ArrayBuffer(length); fs.readSync(fd, buf) fs.closeSync(fd) return buf } catch (e) { console.log...
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
ac6b1b4626e7a3702263581d3cdb397caf9c9fa8
gitee
LZZLHY/hlib
entry/src/main/ets/utils/UrlUtils.ets
arkts
rewriteReaderUrl
复刻 olib `book_detail_screen.dart` 的 reader 域名重写逻辑。 - book.readOnlineUrl 形如 https://reader.z-library.sk/book/... - 我们要把 reader.{某域} 替换成 reader.{当前镜像域}(或语言前缀域) - 把 z-library.sk 替换成当前域 - 末尾拼上 ?remix_userkey=&remix_userid=
static rewriteReaderUrl(originalUrl: string, currentDomain: string, userId?: string, userKey?: string): string { if (!originalUrl) { return originalUrl; } let readerDomain: string; const dotIdx = currentDomain.indexOf('.'); if (dotIdx > 0) { const prefix = currentDomain.substring(0, do...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left rewriteReaderUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
static rewriteReaderUrl(originalUrl: string, currentDomain: string, userId?: string, userKey?: string): string { if (!originalUrl) { return originalUrl; } let readerDomain: string; const dotIdx = currentDomain.indexOf('.'); if (dotIdx > 0) { const prefix = currentDomain.substring(0, do...
https://github.com/LZZLHY/hlib
7a2600ab89a833326971ce4b4fdd8518ced38eda
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
confirmReceiveOrder
确认收货订单 @returns {void} 无返回值
confirmReceiveOrder(): void { RequestHelper.repository<boolean>(this.repository.confirmReceive(this.orderId)) .loading(true) .execute() .then((): void => { this.retryRequest(); this.hideConfirmReceiveDialog(); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmReceiveOrder 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#statemen...
confirmReceiveOrder(): void { RequestHelper.repository<boolean>(this.repository.confirmReceive(this.orderId)) .loading(true) .execute() .then((): void => { this.retryRequest(); this.hideConfirmReceiveDialog(); }); }
https://github.com/Joker-x-dev/CoolMallArkTS
4d105c5408e8d8affb6ce00e0e26a2ce2c3d9888
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
webViewGetOverrideUrl
使用WebView获取跳转URL
async webViewGetOverrideUrl( html: string | null, url: string | null, js: string | null, overrideUrlRegex: string ): Promise<string> { const executor = getWebViewExecutor(); return executor.webViewGetOverrideUrl(html, url, js, overrideUrlRegex); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left webViewGetOverrideUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#...
async webViewGetOverrideUrl( html: string | null, url: string | null, js: string | null, overrideUrlRegex: string ): Promise<string> { const executor = getWebViewExecutor(); return executor.webViewGetOverrideUrl(html, url, js, overrideUrlRegex); }
https://github.com/DaLongZhuaZi/manxia
569b328d91fbfa17f0a157ddb03b4700e349a770
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
id
设置 id 属性
set id(value: string) { this._attrs.set('id', value); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Rig...
set id(value: string) { this._attrs.set('id', value); }
https://github.com/DaLongZhuaZi/manxia
2974215b84853aed107d30681e506553097d864a
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/AlertManager.ets
arkts
getUnresolvedAlerts
获取未解决的告警
public getUnresolvedAlerts(): WardAlert[] { return this.alerts.filter(alert => !alert.isResolved); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUnresolvedAlerts 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#ex...
public getUnresolvedAlerts(): WardAlert[] { return this.alerts.filter(alert => !alert.isResolved); }
https://github.com/LJ666-ui/harmony-health-care
592ce10851bbdbf9e048bed2a76e301ba9668a9c
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/MyWrapper.ets
arkts
getOrder
得到排序sql
getOrder(): string { if (this.orderList.length == 0) { return '' } else { return 'order by ' + this.orderList.join(',') } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOrder 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_blo...
getOrder(): string { if (this.orderList.length == 0) { return '' } else { return 'order by ' + this.orderList.join(',') } }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/MyWrapper.ets#L48-L54
f33972a99226eceefe3d3648246109134ac67ff7
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/Retrofit.ets
arkts
constructor
Private constructor - instances should be created using RetrofitBuilder. This constructor is public for technical reasons in ArkTS but should not be called directly.
constructor(builder: RetrofitBuilder) { this.baseUrl = builder.baseUrl; this.client = builder.client; this.converterFactories = builder.converterFactories; this.callFactory = new DefaultCallFactory(this.client, this.converterFactories); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left builder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RetrofitBuilder AST#identi...
constructor(builder: RetrofitBuilder) { this.baseUrl = builder.baseUrl; this.client = builder.client; this.converterFactories = builder.converterFactories; this.callFactory = new DefaultCallFactory(this.client, this.converterFactories); }
https://github.com/killetom/ktretrofit
da941049f980f50294c02e7e32b7eae941c5205c
github
SuperBird007/HarmonyApp_beichengyu
entry/src/main/ets/util/PreferencesUtil.ets
arkts
putPreferenceValue
从Preferences实例中写入数据 @key 健 @value 值
async putPreferenceValue(key: string, value: preferences.ValueType) { // 写入数据之前,先判断preferences是否初始化完成 if (!this.pref) { console.error(`preferences[${this.sp_name}]尚未初始化!`) return } try { await this.pref.put(key, value) // 持久化 await this.pref.flush() console.log(`保...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left putPreferenceValue AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async putPreferenceValue(key: string, value: preferences.ValueType) { // 写入数据之前,先判断preferences是否初始化完成 if (!this.pref) { console.error(`preferences[${this.sp_name}]尚未初始化!`) return } try { await this.pref.put(key, value) // 持久化 await this.pref.flush() console.log(`保...
https://github.com/SuperBird007/HarmonyApp_beichengyu
740456ff29052065e303d3fce6f950f050b2ba3d
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets
arkts
drawMask
Draw mask. @param ctx @param outer @param inner @param isShow
static drawMask(ctx: CanvasRenderingContext2D, outer: RectF, inner: RectF, isShow: boolean) { // ctx.fillStyle = DrawingUtils.DEFAULT_MASK_STYLE; if (isShow) { ctx.fillStyle = CommonConstants.DEFAULT_MASK_STYLE; } else { ctx.fillStyle = `rgba(0, 0, 0, 1)`; } ctx.fillRect(outer.left, ou...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left drawMask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRe...
static drawMask(ctx: CanvasRenderingContext2D, outer: RectF, inner: RectF, isShow: boolean) { // ctx.fillStyle = DrawingUtils.DEFAULT_MASK_STYLE; if (isShow) { ctx.fillStyle = CommonConstants.DEFAULT_MASK_STYLE; } else { ctx.fillStyle = `rgba(0, 0, 0, 1)`; } ctx.fillRect(outer.left, ou...
https://gitee.com/openharmony/codelabs.git
1e4f760674a58e94ac09f41841b6f1f17c7dde09
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/ShareService.ets
arkts
convertToHtml
将消息列表转换为 HTML 文件内容
convertToHtml(messages: ChatMessage[], assistantAvatarValue: string = 'AI', assistantAvatarColor: string = '', currentModelId: string = '', assistantAvatarCacheKey: number = 0, sessionTitle: string = ''): string { return this.exportService.toHtml( this.exportService.buildModel(messages, sessionTitle...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left convertToHtml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left messages AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ChatMess...
convertToHtml(messages: ChatMessage[], assistantAvatarValue: string = 'AI', assistantAvatarColor: string = '', currentModelId: string = '', assistantAvatarCacheKey: number = 0, sessionTitle: string = ''): string { return this.exportService.toHtml( this.exportService.buildModel(messages, sessionTitle...
https://github.com/LongLiveY96/chatcube
22b185a25cdd056667cf4701ee4cbc05ce724ac5
github
OnceWeWere/Weather_HarmonyOS
entry/src/main/ets/pages/Index.ets
arkts
openNetworkSettings
--- 跳转系统 WiFi 设置 ---
openNetworkSettings() { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'wifi_entry' }; context.startAbility(want).catch(() => { t...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openNetworkSettings 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_bloc...
openNetworkSettings() { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let want: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'wifi_entry' }; context.startAbility(want).catch(() => { t...
https://github.com/OnceWeWere/Weather_HarmonyOS
5b74df661a4a5ad949f40ba448f72aceb7c52944
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoWebViewComponent.ets
arkts
setComponentMounted
标记组件已挂载
setComponentMounted(mounted: boolean): void { this.isComponentMounted = mounted; logger.info(TAG, `WebView组件挂载状态: ${mounted}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setComponentMounted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mounted AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#...
setComponentMounted(mounted: boolean): void { this.isComponentMounted = mounted; logger.info(TAG, `WebView组件挂载状态: ${mounted}`); }
https://github.com/DaLongZhuaZi/manxia
fffa30640e0c2cc24b46f96eb4f45c6af38749ae
github
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/SocialListSettings.ets
arkts
load
============== Lifecycle ============== 从持久化对象加载黑名单与收藏(黑名单需要回填 FilterListManager)
load(saved: SettingsState): void { if (saved.favorites) this.ctx.state.favorites = saved.favorites if (saved.blacklist) { this.ctx.state.blacklist = saved.blacklist this.blacklistManager.init(saved.blacklist) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left load AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saved AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SettingsState AST#identifier#Right AST#)#Left ) AS...
load(saved: SettingsState): void { if (saved.favorites) this.ctx.state.favorites = saved.favorites if (saved.blacklist) { this.ctx.state.blacklist = saved.blacklist this.blacklistManager.init(saved.blacklist) } }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/SocialListSettings.ets#L110-L116
8486b165c7843a6c96d62f338656c01dc6bb7505
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/ComponentBase.ets
arkts
setTextSize
sets the size of the label text in density pixels min = 6f, max = 24f, default 10f @param size the text size, in DP
public setTextSize(size: number): void { if (size > 24) { size = 24; } if (size < 6) { size = 6; } this.mTextSize = size; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
public setTextSize(size: number): void { if (size > 24) { size = 24; } if (size < 6) { size = 6; } this.mTextSize = size; }
https://gitee.com/openharmony/developtools_profiler.git
4eb909150219b21820e39f457a3f62dd71ce4a3b
gitee
CLMC2025/Vignette
entry/src/main/ets/context/TemplateManager.ets
arkts
getStyleName
获取风格的中文名称
getStyleName(style: ContextStyle): string { switch (style) { case ContextStyle.RANDOM: return '随机'; case ContextStyle.CONVERSATIONAL: return '对话式'; case ContextStyle.FORMAL: return '正式'; case ContextStyle.HUMOROUS: return '幽默'; case ContextStyle.NARRAT...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStyleName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left style AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContextStyle AST#identifier#Right AST#)#Le...
getStyleName(style: ContextStyle): string { switch (style) { case ContextStyle.RANDOM: return '随机'; case ContextStyle.CONVERSATIONAL: return '对话式'; case ContextStyle.FORMAL: return '正式'; case ContextStyle.HUMOROUS: return '幽默'; case ContextStyle.NARRAT...
https://github.com/CLMC2025/Vignette
6d29520800b5a47c7de01798f4b89fd5f234dca2
github
LongLiveY96/chatcube
entry/src/main/ets/services/ImageGenerationRcpClient.ets
arkts
getBinary
下载二进制内容(图片等)
async getBinary( url: string, headers: Record<string, string>, controller?: HttpRequestController ): Promise<ArrayBuffer> { const session = this.getSession() const request = new rcp.Request(url, 'GET', headers) let cancelId = '' if (controller !== undefined) { if (controller.isCanc...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBinary AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async getBinary( url: string, headers: Record<string, string>, controller?: HttpRequestController ): Promise<ArrayBuffer> { const session = this.getSession() const request = new rcp.Request(url, 'GET', headers) let cancelId = '' if (controller !== undefined) { if (controller.isCanc...
https://github.com/LongLiveY96/chatcube
137f66426d2ae3b5ff0270d0904a1e8313a78687
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets
arkts
entryToTemplate
将条目转换为用户模板对象
entryToTemplate(entry: KdbxEntry): IUserTemplate | null { try { const title = KdbxUtils.getValueString(entry.fields.get('Title')) || '未命名模板'; const customFields: ITemplateField[] = []; // 收集自定义字段(排除标准字段和模板标识字段) const standardFields = ['Title', 'UserName', 'Password', 'URL', 'Notes', 'Tags...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left entryToTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
entryToTemplate(entry: KdbxEntry): IUserTemplate | null { try { const title = KdbxUtils.getValueString(entry.fields.get('Title')) || '未命名模板'; const customFields: ITemplateField[] = []; // 收集自定义字段(排除标准字段和模板标识字段) const standardFields = ['Title', 'UserName', 'Password', 'URL', 'Notes', 'Tags...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets#L122-L201
9ebd409d02607d19ee0e6ae785feb82f56babb9e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SourceUpdateManager.ets
arkts
updateLocalIndex
更新本地索引
public async updateLocalIndex(index: SourceRepoIndex): Promise<void> { this.localIndex = index; 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 updateLocalIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left :...
public async updateLocalIndex(index: SourceRepoIndex): Promise<void> { this.localIndex = index; await this.saveSettings(); }
https://github.com/DaLongZhuaZi/manxia
5bdee2c5408f0ee6db85a87887f95e57ff096f01
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPPerformanceManager.ets
arkts
decompressImageFormat
解压缩 JPEG/PNG - 使用 HarmonyOS image API
private async decompressImageFormat(data: ArrayBuffer): Promise<ArrayBuffer> { try { const imageSource = image.createImageSource(data) const pixelMap = await imageSource.createPixelMap() // 获取像素数据 const imageInfo = await pixelMap.getImageInfo() const bufferSize = imageInfo.siz...
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 decompressImageFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:...
private async decompressImageFormat(data: ArrayBuffer): Promise<ArrayBuffer> { try { const imageSource = image.createImageSource(data) const pixelMap = await imageSource.createPixelMap() // 获取像素数据 const imageInfo = await pixelMap.getImageInfo() const bufferSize = imageInfo.siz...
https://github.com/AetheriumSimulator/qemu-hmos
3a02e7bf7d774639fb45a53625ed5b3f377fbfad
github
the-wwyang/kids-learning-app
src/main/ets/storage/DataStorageManager.ets
arkts
saveString
保存字符串数据 @param storeName 存储文件名 @param key 键名 @param value 值
async saveString(storeName: string, key: string, value: string): Promise<void> { try { const prefs = await this.getPreferences(storeName); await prefs.put(key, value); await prefs.flush(); console.log(`[DataStorageManager] Saved string: ${storeName}/${key}`); } catch (error) { co...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveString AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async saveString(storeName: string, key: string, value: string): Promise<void> { try { const prefs = await this.getPreferences(storeName); await prefs.put(key, value); await prefs.flush(); console.log(`[DataStorageManager] Saved string: ${storeName}/${key}`); } catch (error) { co...
https://github.com/the-wwyang/kids-learning-app
f6cd3d132e5f429d555e6a4d9498779f486d4f4c
github
openharmony/applications_call
mobiledatasettings/src/main/ets/pages/index.ets
arkts
getCellularDataState
Get mobile data on or off
getCellularDataState() { isCellularDataEnabled().then((data) => { LogUtils.i(TAG, 'isCellularDataEnabled success: isON:' + JSON.stringify(data)); this.isDataEnable = data; }).catch((error) => { LogUtils.i(TAG, 'isCellularDataEnabled error catch' + JSON.stringify(error)); }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCellularDataState 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...
getCellularDataState() { isCellularDataEnabled().then((data) => { LogUtils.i(TAG, 'isCellularDataEnabled success: isON:' + JSON.stringify(data)); this.isDataEnable = data; }).catch((error) => { LogUtils.i(TAG, 'isCellularDataEnabled error catch' + JSON.stringify(error)); }); }
https://gitee.com/openharmony/applications_call.git
c55e7aa222ee70d0d64ffe3b72a7e85df9c08938
gitee
HarmonyOS_Samples/guide-snippets
ArkGraphics2D/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/BasicEffect.ets
arkts
setDrawIndex
设置当前绘制函数的下标
setDrawIndex(index: number) { if (index >= 0 && index < this.drawFunctions.length) { this.currentDrawIndex = index; this.invalidate(); // 触发重绘 } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setDrawIndex 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...
setDrawIndex(index: number) { if (index >= 0 && index < this.drawFunctions.length) { this.currentDrawIndex = index; this.invalidate(); // 触发重绘 } }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
e7f704f1a224dc9ebb617f8ab41fbf2fd0097384
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/PlayStateApi.ets
arkts
pingPlaybackSession
pingPlaybackSession @summary Pings a playback session. @param {PlayStateApiPingPlaybackSessionRequest} requestParameters Request parameters. @throws {RequiredError} @memberof PlayStateApi
public async pingPlaybackSession(requestParameters: PlayStateApiPingPlaybackSessionRequest): Promise<void> { return this.apiClient.post({path: "/Sessions/Playing/Ping", parameters: requestParameters}) }
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 pingPlaybackSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Rig...
public async pingPlaybackSession(requestParameters: PlayStateApiPingPlaybackSessionRequest): Promise<void> { return this.apiClient.post({path: "/Sessions/Playing/Ping", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
724c097c89de4521962cbb90fd43d8ac5d5a2e94
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
animateMgr
@see {@link ZRouter.animateMgr()} @returns
public animateMgr(): NavAnimationMgr { this.routerMgr.animateMgr.setNavigation(this as object as NavDestBuilder<ObjectOrNull>) return this.routerMgr.animateMgr }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateMgr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left NavAnimatio...
public animateMgr(): NavAnimationMgr { this.routerMgr.animateMgr.setNavigation(this as object as NavDestBuilder<ObjectOrNull>) return this.routerMgr.animateMgr }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L506-L509
546c27e2216326e7d5c14a8919d02c53e1d193b6
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamIMEManager.ets
arkts
isLocked
当前是否处于锁定模式
get isLocked(): boolean { return this.locked; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isLocked 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...
get isLocked(): boolean { return this.locked; }
https://github.com/AlkaidLab/moonlight-harmony
1b44a753ba95a062a17275c38e59fd9d3096e6bc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/RegExp.ets
arkts
advanceStringIndex
Returns next index from a passed one @param s @param index start position @param unicode true if unicode is used @returns new index
public static advanceStringIndex(s: String, index: int, unicode: boolean): int { if (!unicode) { return index + 1; } let length = s.length(); if (index + 1 >= length) { return index + 1; } return index + s.codePointCount(index, index + 1); ...
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 advanceStringIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : ...
public static advanceStringIndex(s: String, index: int, unicode: boolean): int { if (!unicode) { return index + 1; } let length = s.length(); if (index + 1 >= length) { return index + 1; } return index + s.codePointCount(index, index + 1); ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1b072225679a7f48fa1e8d85121033538019373e
gitee
openharmony-sig/FastBle
library/src/main/ets/bluetooth/BleConnector.ets
arkts
disableCharacteristicIndicate
stop indicate
public disableCharacteristicIndicate(userCharacteristicDescriptor: boolean): boolean { if (this.mCharacteristic != null /*&& (this.mCharacteristic.getProperties() | bluetooth.BLECharacteristic.PROPERTY_NOTIFY) > 0*/ ) { return this.setCharacteristicIndication(this.mBluetoothGatt, this.mCharacteristi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disableCharacteristicIndicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userCharacteristicDescriptor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ...
public disableCharacteristicIndicate(userCharacteristicDescriptor: boolean): boolean { if (this.mCharacteristic != null /*&& (this.mCharacteristic.getProperties() | bluetooth.BLECharacteristic.PROPERTY_NOTIFY) > 0*/ ) { return this.setCharacteristicIndication(this.mBluetoothGatt, this.mCharacteristi...
https://gitee.com/openharmony-sig/FastBle.git
e04dd009ed8cb7fd6c8f5b156af88a291de6381e
gitee
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/count-down/TnCountDown.ets
arkts
getHoursText
获取小时显示文本
getHoursText(): string { const totalSec = this.getTotalSec(); const hours = this.showDay ? Math.floor((totalSec % DAY_S) / HOUR_S) : Math.floor(totalSec / HOUR_S); return padZero(hours); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHoursText 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...
getHoursText(): string { const totalSec = this.getTotalSec(); const hours = this.showDay ? Math.floor((totalSec % DAY_S) / HOUR_S) : Math.floor(totalSec / HOUR_S); return padZero(hours); }
https://github.com/codelably/tuniao-ui
16999b33449f988932f3296895c57c39d4d8929a
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/TokenStoreRepository.ets
arkts
saveToken
保存 Token @param {string} token Token @returns {Promise<void>} Promise<void>
saveToken(token: string): Promise<void> { return this.dataSource.setToken(token); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left saveToken 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#L...
saveToken(token: string): Promise<void> { return this.dataSource.setToken(token); }
https://github.com/Joker-x-dev/CoolMallArkTS
ef42e8c84cd1c3fde9fa5b03b77bcc42d177f54c
github
offlinecat-dev/OCNetORM
src/main/ets/errors/QueryError.ets
arkts
constructor
构造函数 @param entityName 实体名称 @param scopeName 作用域名称
constructor(entityName: string, scopeName: string) { const context = new ErrorContext() context.entityName = entityName context.operation = '应用查询作用域' context.details = `作用域 '${scopeName}' 未在实体 '${entityName}' 中注册` super(`查询作用域未找到: ${scopeName}`, ERROR_SUB_QUERY, context) this.name = 'ScopeNotF...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST...
constructor(entityName: string, scopeName: string) { const context = new ErrorContext() context.entityName = entityName context.operation = '应用查询作用域' context.details = `作用域 '${scopeName}' 未在实体 '${entityName}' 中注册` super(`查询作用域未找到: ${scopeName}`, ERROR_SUB_QUERY, context) this.name = 'ScopeNotF...
https://github.com/offlinecat-dev/OCNetORM
fcf450e342eaa13bcd5348b9b160c3af5ff5959c
github
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/HttpProxyCacheServer.ets
arkts
destroyCurrentSource
销毁指定URL的当前连接 @param url 视频URL
public destroyCurrentSource(url: string): void { try { const source = this.getCurrentSource(url); if (source) { source.destroy(); this.httpUrlSourceMap.remove(url); } } catch (err) { LogUtil.error('destroyCurrentSource error: ' + JSON.stringify(err)); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroyCurrentSource 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#L...
public destroyCurrentSource(url: string): void { try { const source = this.getCurrentSource(url); if (source) { source.destroy(); this.httpUrlSourceMap.remove(url); } } catch (err) { LogUtil.error('destroyCurrentSource error: ' + JSON.stringify(err)); } }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
30b6fbb91fe27253bcf31437582cbb61466c51d0
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/utils/BaseEventUtil.ets
arkts
once
订阅带数据的事件(只执行一次) @param eventName 事件名称 @param callback 回调函数 @returns 取消订阅的函数
once(eventName: string, callback: EventCallback<T>): () => void { return this.on(eventName, callback, true) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left once AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
once(eventName: string, callback: EventCallback<T>): () => void { return this.on(eventName, callback, true) }
https://github.com/Yebingiscn/SweetVideo
554e452374254386cef63e6415b4294e0c0dd94e
github
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
stripQueryAndFragment
移除 URI 查询参数和 fragment,便于解析扩展名和文件名
static stripQueryAndFragment(filePath: string): string { const queryIndex = filePath.indexOf('?'); const fragmentIndex = filePath.indexOf('#'); let endIndex = filePath.length; if (queryIndex !== -1) { endIndex = Math.min(endIndex, queryIndex); } if (fragmentIndex !== -1) { endInde...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left stripQueryAndFragment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
static stripQueryAndFragment(filePath: string): string { const queryIndex = filePath.indexOf('?'); const fragmentIndex = filePath.indexOf('#'); let endIndex = filePath.length; if (queryIndex !== -1) { endIndex = Math.min(endIndex, queryIndex); } if (fragmentIndex !== -1) { endInde...
https://github.com/kumaleap/ArkLuban
d7664709cef3cf9a1305d2df0743660d0310092a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/IndexManager.ets
arkts
createSmartCategoryIndexes
创建智能分类表的索引
private static async createSmartCategoryIndexes(): Promise<void> { const store = DatabaseManager.getDatabase(); try { // 训练记录表 - 用户训练查询索引 await store.executeSql(` CREATE INDEX IF NOT EXISTS idx_training_records_user ON smart_category_training(user_id, is_correct, created_at DESC);...
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 createSmartCategoryIndexes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Righ...
private static async createSmartCategoryIndexes(): Promise<void> { const store = DatabaseManager.getDatabase(); try { // 训练记录表 - 用户训练查询索引 await store.executeSql(` CREATE INDEX IF NOT EXISTS idx_training_records_user ON smart_category_training(user_id, is_correct, created_at DESC);...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
39088bce8b58c5814212d4dba0ad2f85fa1dcb8a
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/download/FileTypes.ets
arkts
utd
扩展名 → UTD 类型(ShareKit 用)。
static utd(ext: string): string { const e: string = ext.toLowerCase(); if (e === 'pdf') return 'general.pdf'; if (e === 'epub') return 'general.epub'; if (e === 'txt') return 'general.plain-text'; return 'general.file'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left utd AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
static utd(ext: string): string { const e: string = ext.toLowerCase(); if (e === 'pdf') return 'general.pdf'; if (e === 'epub') return 'general.epub'; if (e === 'txt') return 'general.plain-text'; return 'general.file'; }
https://github.com/LZZLHY/hlib
8ee94d00c317f62173348ad66076bc0c96d50d5d
github
harmonyos/codelabs
AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
queryDatabaseAlarms
Querying alarm task database tables. @param callback (alarms: Array<AlarmItem>) => void
private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) { let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; preference.get(CommonConstants.ALARM_KEY).then((data: string) => { if (!DataTypeUtils.isNull(data)) { this.alarms = JSON.parse(da...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left queryDatabaseAlarms AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Lef...
private queryDatabaseAlarms(callback: (alarms: Array<AlarmItem>) => void) { let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; preference.get(CommonConstants.ALARM_KEY).then((data: string) => { if (!DataTypeUtils.isNull(data)) { this.alarms = JSON.parse(da...
https://gitee.com/harmonyos/codelabs.git
fea94eea8c38494501d23287b9bbd44cff4d28f4
gitee
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/http/RetryService.ets
arkts
calculateDelay
计算延迟时间(指数退避 + 抖动)
function calculateDelay(attempt: number, config: RetryConfig): number { const delay = config.initialDelay * Math.pow(config.backoffFactor, attempt - 1) const jitter = Math.random() * 0.3 * delay return Math.min(delay + jitter, config.maxDelay) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateDelay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left attempt AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function calculateDelay(attempt: number, config: RetryConfig): number { const delay = config.initialDelay * Math.pow(config.backoffFactor, attempt - 1) const jitter = Math.random() * 0.3 * delay return Math.min(delay + jitter, config.maxDelay) }
https://github.com/encorexin/WordPressCMS
83a1a4e75e52807e8e3f50c64df691c698c80c68
github
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmStateManager.ets
arkts
isSnoozed
is current snoozed
async isSnoozed(): Promise<boolean> { const currentState = await this.getState(); return currentState === STATE_SNOOZE; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isSnoozed AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_ty...
async isSnoozed(): Promise<boolean> { const currentState = await this.getState(); return currentState === STATE_SNOOZE; }
https://gitee.com/openharmony-sig/applications_clock.git
083d6c632b75295c8d41dcb4d42d6917c2bf0940
gitee
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
delayUpdateParentChildNum
delay update all parentnodes childNum @param isAdd whether addNode or delete node @param count node count @param nodeIdNodeItemMap nodeId and nodeItem relation map @param updateNodeIdList nodeId list whose childNum need update
function delayUpdateParentChildNum(isAdd: boolean, count: int, nodeIdNodeItemMap: Map<number, NodeItem>, updateNodeIdList: Array<number>): void { let taskId: number = 0; taskId = setTimeout(() => { updateNodeIdList.forEach((parentNodeId) => { updateParentChildNumHandler(parentNodeId, nodeIdNodeItemMap, ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left delayUpdateParentChildNum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isAdd AST#identifier#Right AST#type_annotation#Left AST#:#Le...
function delayUpdateParentChildNum(isAdd: boolean, count: int, nodeIdNodeItemMap: Map<number, NodeItem>, updateNodeIdList: Array<number>): void { let taskId: number = 0; taskId = setTimeout(() => { updateNodeIdList.forEach((parentNodeId) => { updateParentChildNumHandler(parentNodeId, nodeIdNodeItemMap, ...
https://gitcode.com/openharmony/arkui_ace_engine
80412effc18e3980c8b8a91937d3308ac63d78c1
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPDriveManager.ets
arkts
generateVirtio9pArgs
生成 QEMU virtio-9p 参数
public generateVirtio9pArgs(vmName: string): string[] { if (!this.config.enableVirtio9p) { return []; } const sharedPath = this.getVMSharedPath(vmName); return [ '-virtfs', `local,path=${sharedPath},mount_tag=shared,security_model=mapped-xattr,id=shared0` ]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateVirtio9pArgs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public generateVirtio9pArgs(vmName: string): string[] { if (!this.config.enableVirtio9p) { return []; } const sharedPath = this.getVMSharedPath(vmName); return [ '-virtfs', `local,path=${sharedPath},mount_tag=shared,security_model=mapped-xattr,id=shared0` ]; }
https://github.com/AetheriumSimulator/qemu-hmos
c5324902d7d389d8782316c11a267db276d0b88e
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
getBytes
获取字节数
getBytes(): number { return this.bytes; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_blo...
getBytes(): number { return this.bytes; }
https://github.com/richshaw2015/nds
ba72a58a27092366bbd549958ecfe8c640dcdacf
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/ShopExportImportManager.ets
arkts
queryShopById
根据ID查询店铺
private async queryShopById(id: number): Promise<ShopRecord | null> { const shops = await this.shopDao.queryAll(); for (let i = 0; i < shops.length; i++) { if (shops[i].id === id) { return shops[i]; } } return null; }
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 queryShopById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AS...
private async queryShopById(id: number): Promise<ShopRecord | null> { const shops = await this.shopDao.queryAll(); for (let i = 0; i < shops.length; i++) { if (shops[i].id === id) { return shops[i]; } } return null; }
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
dd1505eb83afc017bc52e115e1bc17878481537a
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/utils/DrawingUtils.ets
arkts
drawSplitLine
Draw split line. @param ctx @param crop @param split @param isShow
static drawSplitLine(ctx: CanvasRenderingContext2D, crop: RectF, split: number, isShow: boolean) { if (!isShow) { return; } ctx.lineWidth = CommonConstants.DEFAULT_LINE_WIDTH; ctx.strokeStyle = CommonConstants.DEFAULT_LINE_COLOR; let w = Math.ceil(crop.getWidth() / split); let h = Math.c...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left drawSplitLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Can...
static drawSplitLine(ctx: CanvasRenderingContext2D, crop: RectF, split: number, isShow: boolean) { if (!isShow) { return; } ctx.lineWidth = CommonConstants.DEFAULT_LINE_WIDTH; ctx.strokeStyle = CommonConstants.DEFAULT_LINE_COLOR; let w = Math.ceil(crop.getWidth() / split); let h = Math.c...
https://gitee.com/openharmony/codelabs.git
cb506ffd936ed5afc12f02168a42bdabd22fdd35
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/external_manager.ets
arkts
add_external_song
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 外部函数 // ////////// 添加外部歌曲 //
async add_external_song() { // 获取 const audioSelectOptions = new picker.AudioSelectOptions() const audioPicker = new picker.AudioViewPicker() const tmp = await audioPicker.select(audioSelectOptions) // 导入 let success: number = 0 log(`外部添加${tmp.length}首歌曲`) for (const i of tmp) { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left add_external_song AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS...
async add_external_song() { // 获取 const audioSelectOptions = new picker.AudioSelectOptions() const audioPicker = new picker.AudioViewPicker() const tmp = await audioPicker.select(audioSelectOptions) // 导入 let success: number = 0 log(`外部添加${tmp.length}首歌曲`) for (const i of tmp) { ...
https://github.com/Nekofox-POT/LinMusic
77b324ff0a80aafab78bdbdb4fd6d0f42c2f19f4
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CartRepository.ets
arkts
getCartByGoodsId
根据商品ID获取购物车商品 @param {number} goodsId 商品ID @returns {Promise<Cart | undefined>} 匹配到的购物车商品
getCartByGoodsId(goodsId: number): Promise<Cart | undefined> { return this.dataSource.getCartByGoodsId(goodsId); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCartByGoodsId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST...
getCartByGoodsId(goodsId: number): Promise<Cart | undefined> { return this.dataSource.getCartByGoodsId(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS
166ff59e770e39a39588396de074ba48314f6184
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/smartHome/src/main/ets/pages/alarm.ets
arkts
customParseInt
解析字符串为整数
customParseInt(value: string): number | null { let result = 0; let sign = 1; let i = 0; if (value.length === 0) { return null; } // 检查是否为负数 if (value[0] === '-') { sign = -1; i = 1; } for (; i < value.length; i++) { const charCode = value.charCodeAt(i); ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left customParseInt 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#Lef...
customParseInt(value: string): number | null { let result = 0; let sign = 1; let i = 0; if (value.length === 0) { return null; } // 检查是否为负数 if (value[0] === '-') { sign = -1; i = 1; } for (; i < value.length; i++) { const charCode = value.charCodeAt(i); ...
https://gitee.com/openharmony/vendor_unionman.git
d7ed3ec394f656adf0ed0368ddef33e316592566
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/AccountService.ets
arkts
saveLoginState
登录成功时调用:写 Preferences + 同步 AppStorage。 openId / unionId 至少一个必须有值;nickName / avatarUri 可能为空。
async saveLoginState(openId: string, unionId: string, nickName: string, avatarUri: string): Promise<void> { const normalizedOpenId: string = openId !== '' ? openId : '' const normalizedUnionId: string = unionId !== '' ? unionId : '' const normalizedNickName: string = nickName !== '' ? nickName : '' co...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveLoginState AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left openId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async saveLoginState(openId: string, unionId: string, nickName: string, avatarUri: string): Promise<void> { const normalizedOpenId: string = openId !== '' ? openId : '' const normalizedUnionId: string = unionId !== '' ? unionId : '' const normalizedNickName: string = nickName !== '' ? nickName : '' co...
https://github.com/LongLiveY96/chatcube
fe6c924402bc1d413e7f237ed94e41f93bc12d99
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
applyConfig
应用所有配置
static applyConfig(): void { MelonDSNative.native.applyConfig(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applyConfig 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...
static applyConfig(): void { MelonDSNative.native.applyConfig(); }
https://github.com/richshaw2015/nds
aedcee207294a5bbe2a8fff71e35d314695fdf3a
github