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
zhangmeng1847/RDB
entry/src/main/ets/viewmodels/TaskHandle.ets
arkts
addTask
添加一个新的任务 @param name 任务名称 @returns 任务id
addTask(name: string): Promise<number>{ return this.rdbStore.insert(this.tableName, {name, finished: false}) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left addTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#ident...
addTask(name: string): Promise<number>{ return this.rdbStore.insert(this.tableName, {name, finished: false}) }
https://github.com/zhangmeng1847/RDB
8fa2e24b7a48ee35998d5db38b3e62261c498153
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
startInitialization
开始初始化流程
startInitialization(): void { if (this.state.startTime > 0) { logger.warn(TAG, '初始化已经开始,忽略重复调用'); return; } this.state = this.createInitialState(); this.state.startTime = Date.now(); // 重置completionPromise this.completionPromise = null; this.completionResolve = null; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startInitialization AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expres...
startInitialization(): void { if (this.state.startTime > 0) { logger.warn(TAG, '初始化已经开始,忽略重复调用'); return; } this.state = this.createInitialState(); this.state.startTime = Date.now(); // 重置completionPromise this.completionPromise = null; this.completionResolve = null; ...
https://github.com/DaLongZhuaZi/manxia
4ed3480ccb2781351405b699faf0d020f12f08cb
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/InputProcessor.ets
arkts
getAxisDeadZone
获取当前轴死区阈值(用于测试)
getAxisDeadZone(): number { return this.axisDeadZone }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAxisDeadZone 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#statem...
getAxisDeadZone(): number { return this.axisDeadZone }
https://github.com/richshaw2015/nds
105b7cdc72bfc032971af38ca966ecbcd1541d1d
github
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/constants/WeatherTheme.ets
arkts
getResponsiveFontSize
> 1.6 inch screens Responsive font scaling
static getResponsiveFontSize(baseSize: number, screenSize: number): number { if (screenSize < WeatherBreakpoints.SMALL_WATCH) { return Math.max(baseSize * 0.9, 10 as number); // Scale down but maintain readability } else if (screenSize > WeatherBreakpoints.LARGE_WATCH) { return baseSize * 1.1; // ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getResponsiveFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST...
static getResponsiveFontSize(baseSize: number, screenSize: number): number { if (screenSize < WeatherBreakpoints.SMALL_WATCH) { return Math.max(baseSize * 0.9, 10 as number); // Scale down but maintain readability } else if (screenSize > WeatherBreakpoints.LARGE_WATCH) { return baseSize * 1.1; // ...
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
46756cda4b09df7fdbf36ff43e62dcfed4d35b29
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/components/RDPDisplay.ets
arkts
createKeyboardInputEvent
创建键盘输入事件
static createKeyboardInputEvent(scanCode: number, flags: number): ArrayBuffer { const buffer = new ArrayBuffer(8) const view = new DataView(buffer) view.setUint16(0, 0x8002, true) // 键盘事件标识 view.setUint16(2, flags, true) view.setUint16(4, scanCode, true) return buffer }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createKeyboardInputEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scanCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ...
static createKeyboardInputEvent(scanCode: number, flags: number): ArrayBuffer { const buffer = new ArrayBuffer(8) const view = new DataView(buffer) view.setUint16(0, 0x8002, true) // 键盘事件标识 view.setUint16(2, flags, true) view.setUint16(4, scanCode, true) return buffer }
https://github.com/AetheriumSimulator/qemu-hmos
668b4e58eed23b551eab51ba55ba3abee4e39d36
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypeConverter.ets
arkts
toDbValue
ArkTS 值转换为数据库值 根据目标列类型进行适当的转换 @param value ArkTS 值 @param columnType 目标列类型 @param propertyType 属性类型标识(用于特殊类型如 Date、boolean) @returns 数据库值
static toDbValue( value: ValueType, columnType: ColumnType, propertyType: string, options?: TypeConversionOptions, columnName: string = 'unknown' ): DbValueType { // 处理 null 值 if (value === null) { return null } // 根据属性类型进行转换 if (propertyType === 'Date') { if (va...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toDbValue 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 Value...
static toDbValue( value: ValueType, columnType: ColumnType, propertyType: string, options?: TypeConversionOptions, columnName: string = 'unknown' ): DbValueType { // 处理 null 值 if (value === null) { return null } // 根据属性类型进行转换 if (propertyType === 'Date') { if (va...
https://github.com/offlinecat-dev/OCNetORM
65be65fd63432c7319f26559fbcf4b48e357a1aa
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/DataMapper.ets
arkts
toValuesBucket
实体数据转换为 ValuesBucket(用于插入/更新) @param entityData 实体数据 @param includeAutoIncrement 是否包含自增主键 @returns ValuesBucket 对象
toValuesBucket(entityData: EntityData, includeAutoIncrement: boolean = false): ValuesBucket { const bucket = new ValuesBucket() for (let i = 0; i < this.entityMetadata.columns.length; i++) { const column = this.entityMetadata.columns[i] // 跳过自增主键(除非明确要求包含) if (column.isAutoIncrement && !in...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toValuesBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entityData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EntityData AST#identifier#Right AST...
toValuesBucket(entityData: EntityData, includeAutoIncrement: boolean = false): ValuesBucket { const bucket = new ValuesBucket() for (let i = 0; i < this.entityMetadata.columns.length; i++) { const column = this.entityMetadata.columns[i] // 跳过自增主键(除非明确要求包含) if (column.isAutoIncrement && !in...
https://github.com/offlinecat-dev/OCNetORM
4c0d6a59edfd29d548d82548dd9c173f6cc09258
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/FinalizationRegistry.ets
arkts
getSize
@returns size of the FinalizationRegistry
public getSize(): int { let count: int = 0; this.mutex.lockGuard(() => { count = this.mapSize + this.listSize; }); return count; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi...
public getSize(): int { let count: int = 0; this.mutex.lockGuard(() => { count = this.mapSize + this.listSize; }); return count; }
https://gitcode.com/iop123123/arkts-static-skills
95dbc7d5ddc21ea83932eb5b0cd14693b6fbd0ea
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
getPuzzleImages
获取滑块图片(供 UI 解码显示)
getPuzzleImages(puzzle: SliderPuzzle): PuzzleImages { const base64Helper: util.Base64Helper = new util.Base64Helper(); return { bigPm: base64Helper.decodeSync(puzzle.bigImage), smallPm: base64Helper.decodeSync(puzzle.smallImage) }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPuzzleImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left puzzle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SliderPuzzle AST#identifier#Right AST#...
getPuzzleImages(puzzle: SliderPuzzle): PuzzleImages { const base64Helper: util.Base64Helper = new util.Base64Helper(); return { bigPm: base64Helper.decodeSync(puzzle.bigImage), smallPm: base64Helper.decodeSync(puzzle.smallImage) }; }
https://github.com/PollenWang6/HiXD
4ca8eb24aee6ac97ac241765722ee87e9ae01930
github
xiaofenger_705/protobuf-arkts-generator
test/Address.ets
arkts
isEmpty
Check if all fields are default
isEmpty(): boolean { return this.street === '' && this.city === '' && this.zipCode === '' && this.unknownFields.isEmpty() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b...
isEmpty(): boolean { return this.street === '' && this.city === '' && this.zipCode === '' && this.unknownFields.isEmpty() }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
5ad752a34db95fa397dbd5397a474c1900df570e
gitcode
LongLiveY96/chatcube
entry/src/main/ets/pages/LoginPage.ets
arkts
isDevEmulatorBypassEnabled
是否启用"debug 构建 + 模拟器自动跳过登录"。 - debug 判断:bundleManager.getBundleInfoForSelfSync 得到的 appProvisionType === 'debug' - 模拟器判断:deviceInfo.productModel === 'emulator' 只有两个条件都满足才返回 true,release 包永不触发。 结果缓存一次,避免重复查询。
function isDevEmulatorBypassEnabled(): boolean { if (cachedDevEmulatorBypass !== null) { return cachedDevEmulatorBypass } let isDebug: boolean = false try { const info = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) isDebug = info.appInfo.appProvis...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isDevEmulatorBypassEnabled AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function isDevEmulatorBypassEnabled(): boolean { if (cachedDevEmulatorBypass !== null) { return cachedDevEmulatorBypass } let isDebug: boolean = false try { const info = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) isDebug = info.appInfo.appProvis...
https://github.com/LongLiveY96/chatcube
35363ee0d8db0152222e45587a80bbffc73e5b42
github
Tencent-TDS/KuiklyBase-components
knoi/ohosApp/entry/src/main/ets/pages/Index.ets
arkts
onJumpClick
在Home页面中
function onJumpClick(): void { router.pushUrl({ url: 'pages/benchmark' // 目标url }, router.RouterMode.Standard, (err) => { if (err) { console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); return; } console.info('Invoke pushUrl succeeded.'); }); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left onJumpClick AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type...
function onJumpClick(): void { router.pushUrl({ url: 'pages/benchmark' // 目标url }, router.RouterMode.Standard, (err) => { if (err) { console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); return; } console.info('Invoke pushUrl succeeded.'); }); }
https://github.com/Tencent-TDS/KuiklyBase-components
ba0bdcb62584dbf85248303286e5d016e6dffd81
github
openharmony/xts_acts
ability/ability_runtime/actsabilityamstest/systemappa/entry/src/main/ets/mainability23/MainAbility23.ets
arkts
marshalling
将此可序列对象封送到MessageSequence中。
marshalling(messageSequence: rpc.MessageSequence){ messageSequence.writeInt(this.num); // 将整数值写入MessageSequence实例 messageSequence.writeString(this.str); console.log(`MyMessageAble marshalling num[${this.num}] str[${this.str}] name[${this.name}]`); return true; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left marshalling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left messageSequence AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left rpc AST...
marshalling(messageSequence: rpc.MessageSequence){ messageSequence.writeInt(this.num); // 将整数值写入MessageSequence实例 messageSequence.writeString(this.str); console.log(`MyMessageAble marshalling num[${this.num}] str[${this.str}] name[${this.name}]`); return true; }
https://gitee.com/openharmony/xts_acts.git
c1a3cea2a4c3dbcc1a33ebf376a758d39eadf9dc
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
getRecentGames
获取最近游戏列表
public getRecentGames(): GameInfo[] { return [...this.recentGames]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRecentGames 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 GameInf...
public getRecentGames(): GameInfo[] { return [...this.recentGames]; }
https://github.com/richshaw2015/nds
1dd2324584f964c31976ad37480e365a8b06b1b0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceVerifier.ets
arkts
batchVerify
批量校验书源 HTTP 可达性 @param context UIAbility 上下文(用于申请后台长时任务) @param sourceUrls 书源 URL 列表 @param options 校验选项 @returns 批量校验结果(含每个书源的可达状态)
static async batchVerify( context: common.UIAbilityContext, sourceUrls: string[], options?: { /** 单个请求超时(ms),默认 10 秒 */ timeout?: number; /** 并发数,默认 5 */ concurrency?: number; /** 进度回调:(已完成数, 总数) */ onProgress?: (completed: number, total: number) => void; } ): Pro...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left batchVerify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ER...
static async batchVerify( context: common.UIAbilityContext, sourceUrls: string[], options?: { /** 单个请求超时(ms),默认 10 秒 */ timeout?: number; /** 并发数,默认 5 */ concurrency?: number; /** 进度回调:(已完成数, 总数) */ onProgress?: (completed: number, total: number) => void; } ): Pro...
https://github.com/DaLongZhuaZi/manxia
f058c4bf962bb21d724079ce103489006d218d27
github
LZZLHY/hlib
entry/src/main/ets/utils/UrlUtils.ets
arkts
encodeForm
将一个表单对象编码为 application/x-www-form-urlencoded。 支持数组:序列化为 key[]=v1&key[]=v2(与 PHP / Z-Library API 默认习惯一致)。
static encodeForm(form: Record<string, string | number | boolean | undefined | null | string[] | number[]>): string { const parts: string[] = []; const keys = Object.keys(form); for (let i = 0; i < keys.length; i++) { const k = keys[i]; const v = form[k]; if (v === undefined || v === nul...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left encodeForm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left form AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_express...
static encodeForm(form: Record<string, string | number | boolean | undefined | null | string[] | number[]>): string { const parts: string[] = []; const keys = Object.keys(form); for (let i = 0; i < keys.length; i++) { const k = keys[i]; const v = form[k]; if (v === undefined || v === nul...
https://github.com/LZZLHY/hlib
203b891c935d0b593a0f3838b3b2bae66ee0e295
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
getByTimeRange
按时间范围查询
static async getByTimeRange( userId: number, startDate: string, endDate: string ): Promise<OCRRecognitionRecord[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${OCRRecognitionRecord.tableName} WHERE user_id = ? AND cr...
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 getByTimeRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ...
static async getByTimeRange( userId: number, startDate: string, endDate: string ): Promise<OCRRecognitionRecord[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${OCRRecognitionRecord.tableName} WHERE user_id = ? AND cr...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
27d151e032b7e8144c0fb500dbc84be6d56a2d8c
github
HarmonyOS_Samples/MusicHome
products/pc/src/main/ets/pcability/PcAbility.ets
arkts
onWindowStageCreate
Loads pages/Index, assigns UIContext, initializes MediaService and WindowUtil (immersive title, window info). @param windowStage Main window stage for the PC window.
onWindowStageCreate(windowStage: window.WindowStage): void { Logger.info('PcAbility: Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err) => { try { getAppRuntime().uiContext = windowStage.getMainWindowSync().getUIContext(); } catch (error) { Logger.error(`g...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif...
onWindowStageCreate(windowStage: window.WindowStage): void { Logger.info('PcAbility: Ability onWindowStageCreate'); windowStage.loadContent('pages/Index', (err) => { try { getAppRuntime().uiContext = windowStage.getMainWindowSync().getUIContext(); } catch (error) { Logger.error(`g...
https://gitcode.com/HarmonyOS_Samples/MusicHome
57ac846c9509238e04f2f34f162de0f465cff442
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { long } value - value to set @returns { BigUint64Array } - an BigUint64Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAn...
public with(index: int, value: long): BigUint64Array { let res = new BigUint64Array(this) res.setUnsafeClamp(index, value) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: long): BigUint64Array { let res = new BigUint64Array(this) res.setUnsafeClamp(index, value) return res }
https://gitcode.com/iop123123/arkts-static-skills
91da043ee3f0e427cfdb95fe19a5bc566ec0fd6d
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamIMEManager.ets
arkts
isVisible
当前 IME 是否正在显示
get isVisible(): boolean { return this.imeController !== null; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isVisible 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#Righ...
get isVisible(): boolean { return this.imeController !== null; }
https://github.com/AlkaidLab/moonlight-harmony
1c2e5b68c5c51f52b74903161da04c71c10092ac
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets
arkts
setIcon
设置菜单项图标 @param icon 图标资源
public setIcon(icon: ImageResourceType): void { this.icon = icon; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left icon AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageRes...
public setIcon(icon: ImageResourceType): void { this.icon = icon; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
fcbbe009bc03f046e6b4d55c2723ec28bcac598f
gitcode
CLMC2025/Vignette
entry/src/main/ets/algorithm/Algorithm.ets
arkts
reloadParameters
Reload parameters from store (call after optimization)
reloadParameters(): void { const storedParams = FSRSParameterStore.getInstance().loadParameters(); if (storedParams !== null && storedParams.length >= 21) { this.w = storedParams; this.usingOptimizedParams = true; this.decay = -this.w[20]; this.factor = Math.pow(0.9, 1 / this.decay) - ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reloadParameters 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...
reloadParameters(): void { const storedParams = FSRSParameterStore.getInstance().loadParameters(); if (storedParams !== null && storedParams.length >= 21) { this.w = storedParams; this.usingOptimizedParams = true; this.decay = -this.w[20]; this.factor = Math.pow(0.9, 1 / this.decay) - ...
https://github.com/CLMC2025/Vignette
a3ff3bc85071fc8db8ee8d8ed8aaa48e80b9b3ee
github
genjishare/snake-game
entry/src/main/ets/common/service/EventBus.ets
arkts
getInstance
获取EventBus的单例
public static getInstance(): EventBus { if (!EventBus.instance) { EventBus.instance = new EventBus(); } return EventBus.instance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): EventBus { if (!EventBus.instance) { EventBus.instance = new EventBus(); } return EventBus.instance; }
https://github.com/genjishare/snake-game
ae232814a98f45120dc1df92bea0ea9e1c8d4c62
github
OHPG/FinSdk
jellyfin/src/main/ets/api/MediaInfoApi.ets
arkts
getBitrateTestBytesUrl
getBitrateTestBytes @summary Tests the network with a request with the size of the bitrate. @param {MediaInfoApiGetBitrateTestBytesRequest} requestParameters Request parameters. @throws {RequiredError} @memberof MediaInfoApi
public async getBitrateTestBytesUrl(requestParameters: MediaInfoApiGetBitrateTestBytesRequest = {}): Promise<string> { return this.apiClient.createUrl({ method: "GET", path: "/Playback/BitrateTest", 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 getBitrateTestBytesUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#...
public async getBitrateTestBytesUrl(requestParameters: MediaInfoApiGetBitrateTestBytesRequest = {}): Promise<string> { return this.apiClient.createUrl({ method: "GET", path: "/Playback/BitrateTest", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
e12f920e5fe21a88a8891cc0b0ca8a6a4bb147af
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets
arkts
set
Sets the element at the specified index. @param index The index of the element to set. @param element The new element. @returns The previous element at the specified index, or undefined if the index is out of range. @throws BusinessError if the index is out of range.
public set(index: int, element: T): T { return this.buffer.set(index, element); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public set(index: int, element: T): T { return this.buffer.set(index, element); }
https://gitcode.com/iop123123/arkts-static-skills
c6331d3385168b18140fc0e778bac56ac000ec27
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
orderBy
添加排序 @param column 列名或属性名 @param direction 排序方向 @returns 当前实例(支持链式调用)
orderBy(column: string, direction: SortDirection): QueryBuilder { const resolvedColumn = this.getResolvedColumnName(column) if (resolvedColumn === null) { throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`) } const safeDirection = normalizeSortDirectionOrThrow(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left orderBy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,...
orderBy(column: string, direction: SortDirection): QueryBuilder { const resolvedColumn = this.getResolvedColumnName(column) if (resolvedColumn === null) { throw new InvalidConditionError(column, `列 '${column}' 在实体 '${this.entityName}' 中不存在`) } const safeDirection = normalizeSortDirectionOrThrow(...
https://github.com/offlinecat-dev/OCNetORM
f01c6a5d6ff42d4a16863952a330e461dc8d7dbc
github
arkui-x/samples
CodeLab/Cases/feature/decompressfile/src/main/ets/view/MainPage.ets
arkts
decompressFileByWorker
性能:使用Worker子线程解压文件,https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/performance/multi_thread_capability.md/
decompressFileByWorker(rawfileZipName: string): void { /** * TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。 * TODO:知识点:@标识路径加载形式:所有种类的模块加载本地HAR中的Worker线程文件,加载路径规则:@{moduleName}/ets/{relativePath}。 */ let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../workers/Worker.ets'); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decompressFileByWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rawfileZipName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST...
decompressFileByWorker(rawfileZipName: string): void { /** * TODO:知识点:主线程中使用new worker.ThreadWorker创建Worker对象。 * TODO:知识点:@标识路径加载形式:所有种类的模块加载本地HAR中的Worker线程文件,加载路径规则:@{moduleName}/ets/{relativePath}。 */ let workerInstance: worker.ThreadWorker = new worker.ThreadWorker('../workers/Worker.ets'); ...
https://gitcode.com/arkui-x/samples
a39536201987e14d68e0851b764750a710218287
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
subarray
Creates a Uint32Array with the same ArrayBuffer @param begin start index, inclusive @returns new Uint32Array with the same ArrayBuffer
public subarray(begin: number): Uint32Array { return this.subarray(begin as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number): Uint32Array { return this.subarray(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e2730bc973fa63b503887e29ad9f12a222d7d4a9
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/UUIDGenerator.ets
arkts
generateUUID
生成UUID格式的字符串ID 格式:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
public generateUUID(): string { const timestamp = Date.now(); const random1 = Math.floor(Math.random() * 0x10000).toString(16).padStart(4, '0'); const random2 = Math.floor(Math.random() * 0x10000).toString(16).padStart(4, '0'); const random3 = Math.floor(Math.random() * 0x10000).toString(16).padStart(...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateUUID 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#st...
public generateUUID(): string { const timestamp = Date.now(); const random1 = Math.floor(Math.random() * 0x10000).toString(16).padStart(4, '0'); const random2 = Math.floor(Math.random() * 0x10000).toString(16).padStart(4, '0'); const random3 = Math.floor(Math.random() * 0x10000).toString(16).padStart(...
https://github.com/DaLongZhuaZi/manxia
cbf940e9a7a6cf116fc6095499df22328ed384cc
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets
arkts
remove
Removes the entry for the specified key in the HashMap @param key the key to remove from the HashMap @returns the value associated with the key if it was removed, undefined otherwise
remove(key: K): V | undefined { if (!this.buckets.has(key) || this.isEmpty()) { return undefined; } const res = this.buckets.get(key); this.buckets.delete(key); return res; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right A...
remove(key: K): V | undefined { if (!this.buckets.has(key) || this.isEmpty()) { return undefined; } const res = this.buckets.get(key); this.buckets.delete(key); return res; }
https://gitcode.com/iop123123/arkts-static-skills
6ec8146e3ed003cb5ac7887b21083b3bee561fc8
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Models/FTPModels.ets
arkts
generateFTPConnectionId
生成唯一的连接ID
function generateFTPConnectionId(): string { return 'ftp_' + Date.now().toString(36) + '_' + Math.random().toString(36).substring(2, 9); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateFTPConnectionId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#pre...
function generateFTPConnectionId(): string { return 'ftp_' + Date.now().toString(36) + '_' + Math.random().toString(36).substring(2, 9); }
https://github.com/DaLongZhuaZi/manxia
4d27d4d3b420cf20798e9249bc7a4002411ad846
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimatedGridState.ets
arkts
clearPendingAnimationType
清除待处理的动画类型
public clearPendingAnimationType(): void { this.pendingAnimationType = null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearPendingAnimationType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right ...
public clearPendingAnimationType(): void { this.pendingAnimationType = null; }
https://github.com/DaLongZhuaZi/manxia
279b3296e83e4892b3b3ea2dc2682e2aee25e7b9
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/AchievementService.ets
arkts
getTotalCount
获取总成就数量
getTotalCount(): number { return AchievementConfig.getAllAchievements().length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statemen...
getTotalCount(): number { return AchievementConfig.getAllAchievements().length; }
https://gitcode.com/openharmony/codelabs
846e2074f9cdc815be249afb25a858f17411419a
gitcode
xblLab/HarmonyProjectTemplate
products/phone/src/main/ets/viewmodels/IndexVM.ets
arkts
navDestinationListener
监听NavDestination组件的状态变化
navDestinationListener() { // 无感监听路由变化 uiObserver.on('navDestinationUpdate', (info: uiObserver.NavDestinationInfo) => { this.navRouteModel.navDestinationUpdateListeners.forEach((callback) => { callback(info) }) }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left navDestinationListener 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_b...
navDestinationListener() { // 无感监听路由变化 uiObserver.on('navDestinationUpdate', (info: uiObserver.NavDestinationInfo) => { this.navRouteModel.navDestinationUpdateListeners.forEach((callback) => { callback(info) }) }) }
https://github.com/xblLab/HarmonyProjectTemplate
cc45d8a2c55a45aaeaa69ae5a8efe1f1b1140b49
github
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
subscribeTopic
订阅自定义topic。系统topic由SDK自动订阅,此接口只能用于订阅自定义topic @param topic 自定义topic @param rawMessageListener 接收自定义消息的监听器 @param qos qos
subscribeTopic(topic: string, rawMessageListener: RawMessageListener, qos: IoTMqttQos = 1): Promise<IoTMqttResponse> { if (!this.mqttClient) { return new Promise<IoTMqttResponse>((resolve, reject) => reject("mqtt client is null")); } this.rawMessageListenerMap.set(topic, rawMessageListener); ret...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left subscribeTopic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left topic AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
subscribeTopic(topic: string, rawMessageListener: RawMessageListener, qos: IoTMqttQos = 1): Promise<IoTMqttResponse> { if (!this.mqttClient) { return new Promise<IoTMqttResponse>((resolve, reject) => reject("mqtt client is null")); } this.rawMessageListenerMap.set(topic, rawMessageListener); ret...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
12a01dd3b34cba10fc5b6e44f8fc3572b865912d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
addAccessModifier
Sets access modifier to provided @param accessMod new access modifier @returns this
public addAccessModifier(accessMod: int): FieldCreator throws { this.accessMod.set(accessMod); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addAccessModifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accessMod AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#i...
public addAccessModifier(accessMod: int): FieldCreator throws { this.accessMod.set(accessMod); return this; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
17aed2ed56d4b795a61944e1203e7cc542e65dea
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
forEach
Applies a function over all elements of Int16Array @param fn function to apply @returns undefined
public forEach(fn: (val: short) => short): void { let newF: (val: short, index: int, array: Int16Array) => short = (val: short, index: int, array: Int16Array): short => { return fn(val) } this.forEach(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
public forEach(fn: (val: short) => short): void { let newF: (val: short, index: int, array: Int16Array) => short = (val: short, index: int, array: Int16Array): short => { return fn(val) } this.forEach(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5b63661dddf6fe77c75e9da436f889cf080e1c13
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
fill
Fills the Uint16Array with specified value @param { number } value - new valuy @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { Uint16Array } - modified Uint16Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: number, start?: int, end?: int): Uint16Array { this.fill(Uint16Array.doubleToInt(value), start, end) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start?: int, end?: int): Uint16Array { this.fill(Uint16Array.doubleToInt(value), start, end) return this }
https://gitcode.com/iop123123/arkts-static-skills
7c0516033206f94b9c1cc90657f15012e80bb766
gitcode
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/utils/RouterManager.ets
arkts
pushSearch
跳转到搜索页
static pushSearch(initialQuery: string = '', initialInTypeValue: string = ''): void { RouterManager.pushPath( RouteConstants.PAGE_SEARCH, new SearchRouteParam(initialQuery, initialInTypeValue) as Object ); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pushSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left initialQuery AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_ex...
static pushSearch(initialQuery: string = '', initialInTypeValue: string = ''): void { RouterManager.pushPath( RouteConstants.PAGE_SEARCH, new SearchRouteParam(initialQuery, initialInTypeValue) as Object ); }
https://github.com/Amaz1ny/HarmonyDO-public
644aa9e96bd5a6e7aa676345488672696ebb96b3
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SmartCategoryService.ets
arkts
recommendCategory
为账单推荐分类 @param userId 用户ID @param billNote 账单备注 @param amount 账单金额(可选) @param topN 返回前N个推荐 @returns 推荐结果列表
static async recommendCategory( userId: number, billNote: string, amount: number = 0, topN: number = 3 ): Promise<CategoryRecommendation[]> { try { // 1. 获取激活的规则 const rules = await SmartCategoryRuleDAO.getActiveRules(userId); // 2. 计算每个规则的匹配度 const matchResults: Map<num...
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 recommendCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left...
static async recommendCategory( userId: number, billNote: string, amount: number = 0, topN: number = 3 ): Promise<CategoryRecommendation[]> { try { // 1. 获取激活的规则 const rules = await SmartCategoryRuleDAO.getActiveRules(userId); // 2. 计算每个规则的匹配度 const matchResults: Map<num...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
02b73d3eb637edcc3d838cda28b7633e2d2e3037
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
searchContacts
搜索联系人 @param keyword 关键词
async searchContacts(keyword: string): Promise<ApiResponse<Contact[]>> { return this.client.get<Contact[]>('/api/v1/im/contacts/search', { keyword }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchContacts AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async searchContacts(keyword: string): Promise<ApiResponse<Contact[]>> { return this.client.get<Contact[]>('/api/v1/im/contacts/search', { keyword }) }
https://github.com/David8Idira/AI-OA
9e860367ee58323a64662f4c3de8781b9c018413
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getDataSetByLabel
Returns the DataSet object with the given label. Search can be case sensitive or not. IMPORTANT: This method does calculations at runtime. Use with care in performance critical situations. @param label @param ignorecase @return
public getDataSetByLabel(label: string, ignorecase: boolean): T | null { if (!this.mDataSets) { return null; } let index: number = this.getDataSetIndexByLabel(this.mDataSets, label, ignorecase); if (index < 0 || index >= this.mDataSets.size()) return null; else return this.mData...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSetByLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public getDataSetByLabel(label: string, ignorecase: boolean): T | null { if (!this.mDataSets) { return null; } let index: number = this.getDataSetIndexByLabel(this.mDataSets, label, ignorecase); if (index < 0 || index >= this.mDataSets.size()) return null; else return this.mData...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f94f3c8ffdb963bbfeec3fb8719a3657fca12e66
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
isDragEnabled
Returns true if dragging is enabled for the chart, false if not. @return
public isDragEnabled(): boolean { return this.mDragXEnabled || this.mDragYEnabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDragEnabled 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...
public isDragEnabled(): boolean { return this.mDragXEnabled || this.mDragYEnabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
b0d05b21b3896a2fa81ab10b218055babc5bd0be
gitee
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/StorageUtils.ets
arkts
getIndividualCacheDirectory
Returns individual application cache directory (for only video caching from Proxy). Cache directory will be created on SD card <i>("/Android/data/[app_package_name]/cache/video-cache")</i> if card is mounted . Else - Android defines cache directory on device's file system. @param context Application context @return Cac...
public static getIndividualCacheDirectory(context: Context): string { let cacheDir = StorageUtils.getCacheDirectory(context, true); return cacheDir + '/' + StorageUtils.INDIVIDUAL_DIR_NAME; }
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 getIndividualCacheDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Righ...
public static getIndividualCacheDirectory(context: Context): string { let cacheDir = StorageUtils.getCacheDirectory(context, true); return cacheDir + '/' + StorageUtils.INDIVIDUAL_DIR_NAME; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
0117c920a04c79f9487e6f882f7f71b2a6a72b4d
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/IndoorLocator.ets
arkts
kalmanFilter
卡尔曼滤波平滑
private kalmanFilter(currentPosition: Position3D): Position3D { // 简化实现:移动平均滤波 if (this.positionHistory.length === 0) { return currentPosition; } // 取最近N个位置的平均 const recentPositions = this.positionHistory .slice(-5) .map(r => r.position); recentPositions.push(currentPosition...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left kalmanFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPosition AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Posit...
private kalmanFilter(currentPosition: Position3D): Position3D { // 简化实现:移动平均滤波 if (this.positionHistory.length === 0) { return currentPosition; } // 取最近N个位置的平均 const recentPositions = this.positionHistory .slice(-5) .map(r => r.position); recentPositions.push(currentPosition...
https://github.com/LJ666-ui/harmony-health-care
9ca5079c723cf1a1d91930d30a02fe1ab5b8626f
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
getEntityClass
获取实体类类型,用于AutoTable实例化 @returns IllustHistoryInfo类的构造函数
protected getEntityClass(): Function { return IllustHistoryInfo; }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getEntityClass 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#Lef...
protected getEntityClass(): Function { return IllustHistoryInfo; }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L45-L47
413314924bb60733b5196274398d2847555d745c
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/Windows11Config.ets
arkts
getPerformanceRecommendations
性能监控和优化建议
static getPerformanceRecommendations(hostSpecs: { cpu: string; memory: number; storage: string }): string[] { const recommendations: string[] = []; if (hostSpecs.memory < 8192) { recommendations.push('建议主机内存至少8GB以获得更好的Windows 11性能'); } if (!hostSpecs.cpu.includes('ARM') && !hostSpecs.c...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left getPerformanceRecommendations AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hostSpecs AST#identifier#Right AST#:#Left : AST#:#Right ...
static getPerformanceRecommendations(hostSpecs: { cpu: string; memory: number; storage: string }): string[] { const recommendations: string[] = []; if (hostSpecs.memory < 8192) { recommendations.push('建议主机内存至少8GB以获得更好的Windows 11性能'); } if (!hostSpecs.cpu.includes('ARM') && !hostSpecs.c...
https://github.com/AetheriumSimulator/qemu-hmos
89420e256badf50927b823f88b6f349f6be57a6b
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/PieDataSet.ets
arkts
getValueLinePart1Length
When valuePosition is OutsideSlice, indicates length of first half of the line @Override
public getValueLinePart1Length(): number { return this.mValueLinePart1Length; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueLinePart1Length 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 nu...
public getValueLinePart1Length(): number { return this.mValueLinePart1Length; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
251391fd141444ce95191b26598540da4e429205
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/JArrayList.ets
arkts
currPos
返回列表的当前位置
currPos() { return this.pos; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left currPos 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...
currPos() { return this.pos; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
42a58fd150031cf0a726bbd1b3bfa038328e252a
gitee
ibestservices/ibest-ui
library/src/main/ets/components/tree/index.ets
arkts
removeNode
删除指定节点
removeNode(node: IBestTreeNodeData){ let children: IBestTreeNodeData[] = JSON.parse(JSON.stringify(this.data.children)) let index = children.findIndex(e => e.$treeNodeId == node.$treeNodeId) if(index > -1){ children.splice(index, 1) this.data.children = children ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IBestTreeNodeData AST#identifi...
removeNode(node: IBestTreeNodeData){ let children: IBestTreeNodeData[] = JSON.parse(JSON.stringify(this.data.children)) let index = children.findIndex(e => e.$treeNodeId == node.$treeNodeId) if(index > -1){ children.splice(index, 1) this.data.children = children ...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/tree/index.ets#L410-L417
82dd42deb4f3eaca94edf732746b26672fbf6d7e
github
XHXYT/Pixark
entry/src/main/ets/common/utils/AnimationUtil.ets
arkts
animNormal
普通动画参数
public animNormal(d: number) { const animation: AnimateParam = { duration: 300, curve: Curve.EaseOut, iterations: 1, playMode: PlayMode.Normal, delay:d } return animation }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animNormal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A...
public animNormal(d: number) { const animation: AnimateParam = { duration: 300, curve: Curve.EaseOut, iterations: 1, playMode: PlayMode.Normal, delay:d } return animation }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/AnimationUtil.ets#L46-L55
32cf53cdedad465aea9923abe16aa81cf0a2908e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets
arkts
generateRecommendations
生成性能优化建议
private generateRecommendations(): string[] { const recommendations: string[] = []; if (this.metrics.frameRate.average < 30) { recommendations.push('考虑降低图形质量设置以提高帧率'); recommendations.push('检查是否有性能瓶颈的系统'); } if (this.metrics.memory.used > 400) { recommendations.push('考虑优化内存使用,释放不必要...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateRecommendations 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#...
private generateRecommendations(): string[] { const recommendations: string[] = []; if (this.metrics.frameRate.average < 30) { recommendations.push('考虑降低图形质量设置以提高帧率'); recommendations.push('检查是否有性能瓶颈的系统'); } if (this.metrics.memory.used > 400) { recommendations.push('考虑优化内存使用,释放不必要...
https://github.com/DaLongZhuaZi/manxia
b6fd0dccfb9c06c8746e4602cd93d26167ade9a9
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/Index.ets
arkts
build
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// UI构建 // /////////
build() { Stack() { // 更新弹窗页面 // if (!this.version_ready) { version_update({ version_ready: this.version_ready, global_config: this.global_config }) .width('100%').height('100%').zIndex(900) } // 开始页面 // if (this.start_ui) { sta...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Stack() { // 更新弹窗页面 // if (!this.version_ready) { version_update({ version_ready: this.version_ready, global_config: this.global_config }) .width('100%').height('100%').zIndex(900) } // 开始页面 // if (this.start_ui) { sta...
https://github.com/Nekofox-POT/LinMusic
9490b03e8bd47aea0751e46efc93471905a934f5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets
arkts
executeTask
执行单个任务
private async executeTask(task: WebViewTask): Promise<void> { const options = task.options; const resolve = task.resolve; const reject = task.reject; const timeoutId = task.timeoutId; try { // 清除超时 if (timeoutId) { clearTimeout(timeoutId); } let result: WebViewRes...
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 executeTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AS...
private async executeTask(task: WebViewTask): Promise<void> { const options = task.options; const resolve = task.resolve; const reject = task.reject; const timeoutId = task.timeoutId; try { // 清除超时 if (timeoutId) { clearTimeout(timeoutId); } let result: WebViewRes...
https://github.com/DaLongZhuaZi/manxia
40c3c069d93a7e0b862b06ac646482996c4a7ecf
github
openharmony/codelabs
ETSUI/Foodbook/entry/src/main/ets/newpages/baozi.ets
arkts
onCollectChange
收藏状态变化处理
onCollectChange(): void { const favorites: Dish[] = AppStorage.get(Constants.FAVORITE_LIST) || []; if (this.isCollected) { // 添加到收藏 if (!favorites.some((item: Dish) => item.id === this.dishData.id)) { const newFavorites = [...favorites, this.dishData]; AppStorage.set(Constants.FAVO...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCollectChange 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_bl...
onCollectChange(): void { const favorites: Dish[] = AppStorage.get(Constants.FAVORITE_LIST) || []; if (this.isCollected) { // 添加到收藏 if (!favorites.some((item: Dish) => item.id === this.dishData.id)) { const newFavorites = [...favorites, this.dishData]; AppStorage.set(Constants.FAVO...
https://gitcode.com/openharmony/codelabs
68049388da80f0e556f9de68d13a9b6d084d5466
gitcode
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/WindowUtil.ets
arkts
registerBreakpoint
注册断点 @param windowClass window.Window
private static registerBreakpoint(windowClass: window.Window): void { BreakpointSystemUtil.getInstance().updateWidthBp(windowClass) try { const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO) || new GlobalInfoModel() const systemAvoidArea: window.AvoidArea = windowCla...
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 registerBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#ident...
private static registerBreakpoint(windowClass: window.Window): void { BreakpointSystemUtil.getInstance().updateWidthBp(windowClass) try { const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO) || new GlobalInfoModel() const systemAvoidArea: window.AvoidArea = windowCla...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
db303926853e66da89a6d2031060eae5bd291383
gitcode
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets
arkts
move
Move by current offset. @param offsetX @param offsetY
move(offsetX: number, offsetY: number): void { this.left += offsetX; this.right += offsetX; this.top += offsetY; this.bottom += offsetY; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left move AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST...
move(offsetX: number, offsetY: number): void { this.left += offsetX; this.right += offsetX; this.top += offsetY; this.bottom += offsetY; }
https://gitee.com/openharmony/codelabs.git
db70faffbef7f219bec16d95c59974cd7fc208bf
gitee
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/DatabaseHelper.ets
arkts
executeSql
执行原始 SQL @param sql SQL 语句
async executeSql(sql: string): Promise<void> { if (!this.rdbStore) { Logger.error(this.LOG_TAG, 'RdbStore is null, cannot execute SQL'); return; } try { await this.rdbStore.executeSql(sql); Logger.debug(this.LOG_TAG, `SQL executed: ${sql}`); } catch (err) { const error =...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeSql AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sql AST#identifier#Right AST#type_...
async executeSql(sql: string): Promise<void> { if (!this.rdbStore) { Logger.error(this.LOG_TAG, 'RdbStore is null, cannot execute SQL'); return; } try { await this.rdbStore.executeSql(sql); Logger.debug(this.LOG_TAG, `SQL executed: ${sql}`); } catch (err) { const error =...
https://github.com/Kira-Yagami-Light/Kira-Projects
0b8c397c411ab8dce215685cf2397e4b6705e5a5
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/RdbManager.ets
arkts
parseSongResultSet
--- 辅助方法:将数据库结果集转为对象数组 ---
private parseSongResultSet(resultSet: relationalStore.ResultSet): SongItemType[] { const songs: SongItemType[] = []; while (resultSet.goToNextRow()) { songs.push({ id: resultSet.getString(resultSet.getColumnIndex('id')), name: resultSet.getString(resultSet.getColumnIndex('name')), ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSongResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#membe...
private parseSongResultSet(resultSet: relationalStore.ResultSet): SongItemType[] { const songs: SongItemType[] = []; while (resultSet.goToNextRow()) { songs.push({ id: resultSet.getString(resultSet.getColumnIndex('id')), name: resultSet.getString(resultSet.getColumnIndex('name')), ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L520-L535
372ffc7dc90ceae5f713bd009ca5984dbefe208f
github
midori52000/ArkPilot
Agent/entry/src/main/ets/apim/ApiManagementService.ets
arkts
loadProvidersFromStore
── config store helpers ──
function loadProvidersFromStore(): ProviderRecord[] { const defs: ProviderDefinition[] = providerConfigStore.loadDefinitions(); const creds: Map<string, string> = providerConfigStore.loadCredentials(); const providers: ProviderRecord[] = []; for (let i = 0; i < defs.length; i++) { const def: ProviderDefinit...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left loadProvidersFromStore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#arra...
function loadProvidersFromStore(): ProviderRecord[] { const defs: ProviderDefinition[] = providerConfigStore.loadDefinitions(); const creds: Map<string, string> = providerConfigStore.loadCredentials(); const providers: ProviderRecord[] = []; for (let i = 0; i < defs.length; i++) { const def: ProviderDefinit...
https://github.com/midori52000/ArkPilot
023fbf6b43392d31cd2a49e61da8ed8f4389ccba
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/PreferencesUtil.ets
arkts
getContext
获取已保存的 Context 引用
static getContext(): Context | null { return PreferencesUtil.contextRef; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#...
static getContext(): Context | null { return PreferencesUtil.contextRef; }
https://github.com/AlkaidLab/moonlight-harmony
048fb8427e5077b693de72692f7e544844b64a8c
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
configureOrientation
==================== 屏幕方向 ==================== 根据串流分辨率设置屏幕方向
async configureOrientation(): Promise<void> { try { const win = await window.getLastWindow(this.context); if (this.streamWidth > this.streamHeight) { await win.setPreferredOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE); console.info(`StreamWindowManager: 设置横屏模式 (${this.stream...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left configureOrientation 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...
async configureOrientation(): Promise<void> { try { const win = await window.getLastWindow(this.context); if (this.streamWidth > this.streamHeight) { await win.setPreferredOrientation(window.Orientation.AUTO_ROTATION_LANDSCAPE); console.info(`StreamWindowManager: 设置横屏模式 (${this.stream...
https://github.com/AlkaidLab/moonlight-harmony
a3276c88727ad6de88434564e43d6577b4d99894
github
honjow/Next2V
shared/src/main/ets/storage/LocalDataCloudSync.ets
arkts
tryEnableAndSync
One-shot best-effort enable + sync, safe to call at startup. Never throws. (Phase 1 wires this at app launch for on-device validation; Phase 2 will gate it behind a user "云同步" setting + a manual sync button instead of auto-requesting at startup.)
static async tryEnableAndSync(context: common.UIAbilityContext): Promise<void> { const granted = await LocalDataCloudSync.ensurePermission(context) if (!granted) { return } const marked = await LocalDataCloudSync.markDistributedTables(context) if (!marked) { return } // One-tim...
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 tryEnableAndSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left...
static async tryEnableAndSync(context: common.UIAbilityContext): Promise<void> { const granted = await LocalDataCloudSync.ensurePermission(context) if (!granted) { return } const marked = await LocalDataCloudSync.markDistributedTables(context) if (!marked) { return } // One-tim...
https://github.com/honjow/Next2V
8474cf8e976f70bd97286a2b5979b507f75eb07d
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/RAManager.ets
arkts
submitPendingAchievements
提交所有待处理的成就 对齐 Android: RetroAchievementsSubmissionWorker.doWork() 在心跳定时器中定期尝试,或在 onRomLoaded 成功后调用
async submitPendingAchievements(): Promise<void> { try { const pendingJson = await this.settingsManager.get<string>(RAManager.PENDING_KEY, '[]'); const pending: PendingAchievement[] = JSON.parse(pendingJson) as PendingAchievement[]; if (pending.length === 0) return; hilog.info(DOMAIN, TAG...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitPendingAchievements 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#:#Righ...
async submitPendingAchievements(): Promise<void> { try { const pendingJson = await this.settingsManager.get<string>(RAManager.PENDING_KEY, '[]'); const pending: PendingAchievement[] = JSON.parse(pendingJson) as PendingAchievement[]; if (pending.length === 0) return; hilog.info(DOMAIN, TAG...
https://github.com/richshaw2015/nds
d011fd57abed9962513df9e64b9970f3a39b1ddf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
convertObject
Converts object to this string type @param {Any} obj Object to convert @returns {Any} Converted object @throws {Error} If conversion is invalid @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.equals(objType)) { throw new Error("invalid conversion") } return obj }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : A...
public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (!this.equals(objType)) { throw new Error("invalid conversion") } return obj }
https://gitcode.com/iop123123/arkts-static-skills
c1c3c34b4c1aeacc93438d6671b7ad027be12836
gitcode
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/subSppTest/sppClientTest.ets
arkts
acceptClientSocket
获取的clientNumber用作客户端后续读/写操作socket的id @param number
acceptClientSocket(number: number) { console.log('spp clientSocket socketID: ' + number); // 获取的clientNumber用作服务端后续读/写操作socket的id。 this.clientNumber = number; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left acceptClientSocket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left number AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifie...
acceptClientSocket(number: number) { console.log('spp clientSocket socketID: ' + number); // 获取的clientNumber用作服务端后续读/写操作socket的id。 this.clientNumber = number; }
https://gitee.com/openharmony/communication_bluetooth_service.git
aeb1d47687ea978259170c46f667641d0b0225a2
gitee
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/manager/LocalRequestManager.ets
arkts
get
获取 @param localFileName 本地文件名 @returns Promise<T>
public get<T>(localFileName: string): Promise<T> { return new Promise((resolve: (value: T | PromiseLike<T>) => void, reject: ((reason?: BusinessError) => void)) => { try { const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext const result: Uint8...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_param...
public get<T>(localFileName: string): Promise<T> { return new Promise((resolve: (value: T | PromiseLike<T>) => void, reject: ((reason?: BusinessError) => void)) => { try { const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext const result: Uint8...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
5c2134a922f4d35be27b6d7e8896ce7435177b30
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/entryability/EntryAbility.ets
arkts
openDatabase
打开数据库
private openDatabase(dbUrl: string): void { if (this.windowStage && dbUrl) { this.createStorage(dbUrl); this.openPage('pages/Password'); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dbUrl AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private openDatabase(dbUrl: string): void { if (this.windowStage && dbUrl) { this.createStorage(dbUrl); this.openPage('pages/Password'); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/entryability/EntryAbility.ets#L164-L169
a85280e8ef6b32ccc37a1e720c3db850e3c88b78
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets
arkts
isGreaterThan
Checks if this instance value is greater than value of provided instance @param { Byte } other Right hand side of the comparison @returns { boolean } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isGreaterThan(other: Byte): boolean { return this.value > other.toByte(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGreaterThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Byte AST#identifi...
public isGreaterThan(other: Byte): boolean { return this.value > other.toByte(); }
https://gitcode.com/iop123123/arkts-static-skills
43d05a13217827467be0910e3f2751c9489064df
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets
arkts
insert
Insert new elements at a specific position in the ArrayList. @param element - the added element. @param index - the index.
public insert(element: T, index: int): void { this.checkIndex(index, this.length); if (this.length + 1 <= this.capacity) { this.buffer.push(element); // length++ for (let i: int = (this.length - 1); i > index; i--) { this.buffer[i] = this.buffer[i - 1]; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right...
public insert(element: T, index: int): void { this.checkIndex(index, this.length); if (this.length + 1 <= this.capacity) { this.buffer.push(element); // length++ for (let i: int = (this.length - 1); i > index; i--) { this.buffer[i] = this.buffer[i - 1]; ...
https://gitcode.com/iop123123/arkts-static-skills
3693ab99aed93a77d35d10908ad60ad8c48ea0b7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
addOnlineReadHistory
添加在线阅读历史
public async addOnlineReadHistory(history: ReadHistoryInput): Promise<number> { try { const historyData: ReadHistory = { id: this.generateId(), comicId: history.comicId, chapterId: history.chapterId, pageIndex: history.pageIndex, userId: history.userId, readTi...
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 addOnlineReadHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left history AST#identifier#Right AST#:#...
public async addOnlineReadHistory(history: ReadHistoryInput): Promise<number> { try { const historyData: ReadHistory = { id: this.generateId(), comicId: history.comicId, chapterId: history.chapterId, pageIndex: history.pageIndex, userId: history.userId, readTi...
https://github.com/DaLongZhuaZi/manxia
90533536cbd56654df15cecdc6e4657a16306eeb
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_or_equal/less_or_equal_ubyte.ets
arkts
main
--- desc: check less or equal operation for unsigned byte ---
function main(): void { const a: ubyte = {{v.left}} const b: ubyte = {{v.right}} assert (a <= b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ubyte = {{v.left}} const b: ubyte = {{v.right}} assert (a <= b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f414dd35e295e9f8b49ae1f9f0901c539fd35e19
gitee
OHPG/FinVideo
entry/src/main/ets/data/Repository.ets
arkts
getMediaSource
获取媒体数据源列表(支持多版本) @param id @returns
public getMediaSource(id: string): Promise<Array<FinItemSource>> { return this.requireApi().getItemSource(id) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMediaSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
public getMediaSource(id: string): Promise<Array<FinItemSource>> { return this.requireApi().getItemSource(id) }
https://github.com/OHPG/FinVideo
c532d1a4dcac67b65a1006f7e6e902a498a045a3
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
divide
Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Decimal } x dividend @param { Decimal } y divisor @param { double } pr rounding precision @param { int } rm rounding mode @param { boolean } dp the flag of decimal places @param { d...
public static divide(x: Decimal, y: Decimal, pr?: double, rm?: int, dp?: boolean, base?: double): Decimal { let sign = x.s == y.s ? 1 : -1; let xd = x.d; let yd = y.d; if (!xd || !xd![0] || !yd || !yd![0]) { return new Decimal( !x.s || !y.s || (xd ? yd && ...
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 divide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right ...
public static divide(x: Decimal, y: Decimal, pr?: double, rm?: int, dp?: boolean, base?: double): Decimal { let sign = x.s == y.s ? 1 : -1; let xd = x.d; let yd = y.d; if (!xd || !xd![0] || !yd || !yd![0]) { return new Decimal( !x.s || !y.s || (xd ? yd && ...
https://gitcode.com/iop123123/arkts-static-skills
f0deaf7cc21495ede1bd001f43ad21e25ad88b16
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets
arkts
openEndTimePicker
打开结束时间选择器
openEndTimePicker(): void { const date = new Date(this.scheduleEndTime) this.tempHour = date.getHours() this.tempMinute = date.getMinutes() this.showEndTimePicker = true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openEndTimePicker 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_...
openEndTimePicker(): void { const date = new Date(this.scheduleEndTime) this.tempHour = date.getHours() this.tempMinute = date.getMinutes() this.showEndTimePicker = true }
https://gitcode.com/openharmony/codelabs
573e8b0710e096039089784481bcb06de4f7dbc7
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/tag/index.ets
arkts
getBorderRadius
获取边框radius
getBorderRadius(borderRadius: IBestStringNumber): BorderRadiuses | Length { if (this.round) { return this.baseStyle.borderRadiusMax } else if (this.mark) { return { topLeft: 0, topRight: this.baseStyle.borderRadiusMax, bottomLeft: 0, bottomRight: this.baseStyle.borderRadiusMax } } else {...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getBorderRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left borderRadius AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
getBorderRadius(borderRadius: IBestStringNumber): BorderRadiuses | Length { if (this.round) { return this.baseStyle.borderRadiusMax } else if (this.mark) { return { topLeft: 0, topRight: this.baseStyle.borderRadiusMax, bottomLeft: 0, bottomRight: this.baseStyle.borderRadiusMax } } else {...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/tag/index.ets#L114-L127
37d3fbb8e0809131cf499883895675049c60085a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
poll
Attempts to remove and return the head element without waiting. Returns undefined immediately when the queue is empty. @returns { T | undefined } The removed head element when the queue is not empty, else undefined when the queue is empty. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public poll(): T | undefined { if (this.atomicsGetSize() == 0) { return undefined; } let previousSize: int = -1; ConcurrencyHelpers.mutexLock(this.popMutex); try { if (this.atomicsGetSize() > 0) { con...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left poll AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#cal...
public poll(): T | undefined { if (this.atomicsGetSize() == 0) { return undefined; } let previousSize: int = -1; ConcurrencyHelpers.mutexLock(this.popMutex); try { if (this.atomicsGetSize() > 0) { con...
https://gitcode.com/iop123123/arkts-static-skills
a330179be87ba1ffbc1c9fab549e02e296c9157f
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Int32Array that satisfies the condition @param { function } fn - condition @returns { int } - the index of the last element that satisfies fn, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLastIndex(fn: (val: number, index: int, array: Int32Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; --i) { let val = this.getUnsafe(i) if (fn((val).toDouble(), i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public findLastIndex(fn: (val: number, index: int, array: Int32Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; --i) { let val = this.getUnsafe(i) if (fn((val).toDouble(), i, this)) { return i } } return -1 }
https://gitcode.com/iop123123/arkts-static-skills
4802d40b0618e2e347ecad0388f16e18a8dd77d8
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/utils/DlpAntiPeepUtil.ets
arkts
checkDlpAntiPeepStatus
检查防窥保护开关并订阅通知
static async checkDlpAntiPeepStatus() { if (canIUse('SystemCapability.Security.DlpAntiPeep')) { try { // 先取消之前的订阅,避免重复订阅 try { dlpAntiPeep.off('dlpAntiPeep', DlpAntiPeepUtil.onStatusChange) } catch { // 忽略取消订阅时的错误 } const isOpen = await dlpAntiPee...
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 checkDlpAntiPeepStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
static async checkDlpAntiPeepStatus() { if (canIUse('SystemCapability.Security.DlpAntiPeep')) { try { // 先取消之前的订阅,避免重复订阅 try { dlpAntiPeep.off('dlpAntiPeep', DlpAntiPeepUtil.onStatusChange) } catch { // 忽略取消订阅时的错误 } const isOpen = await dlpAntiPee...
https://github.com/Yebingiscn/SweetVideo
f309fe9639864de5b2db44886ec7632c84040294
github
codelably/HCompass
entry/src/main/ets/entryability/AppInterceptors.ets
arkts
logLines
按行与长度分割日志,避免单条日志过长被截断
private logLines(level: "info" | "error", lines: string[]): void { const logger: (content: string, tag: string) => void = level === "error" ? Logger.error : Logger.info; lines.forEach((line: string) => { this.splitLines(line).forEach((segment: string) => { this.splitChunks(segment, MAX_LOG...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L...
private logLines(level: "info" | "error", lines: string[]): void { const logger: (content: string, tag: string) => void = level === "error" ? Logger.error : Logger.info; lines.forEach((line: string) => { this.splitLines(line).forEach((segment: string) => { this.splitChunks(segment, MAX_LOG...
https://github.com/codelably/HCompass
db2bc52b37e8c2bb9f97a14167eb534b5436dce5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/AnomalyDetectionService.ets
arkts
calculateMedian
计算中位数
private static calculateMedian(sortedArray: number[]): number { if (sortedArray.length === 0) { return 0; } const mid = Math.floor(sortedArray.length / 2); if (sortedArray.length % 2 === 0) { return (sortedArray[mid - 1] + sortedArray[mid]) / 2; } return sortedArray[mid]; }
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 calculateMedian AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sortedArray AST#identifier#Right AST#ERROR#Left AST...
private static calculateMedian(sortedArray: number[]): number { if (sortedArray.length === 0) { return 0; } const mid = Math.floor(sortedArray.length / 2); if (sortedArray.length % 2 === 0) { return (sortedArray[mid - 1] + sortedArray[mid]) / 2; } return sortedArray[mid]; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6291c126151d517b6ded2aefea0f12b4b5ebc41c
github
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
entry/src/main/ets/pages/Minesweeper.ets
arkts
aboutToAppear
组件加载时初始化游戏和添加主题监听器
aboutToAppear(): void { this.initializeGame(); // 添加主题监听器 ThemeManager.getInstance().addThemeChangeListener((theme: ThemeType, colors: ThemeColors) => { this.currentTheme = theme; this.themeColors = colors; }); // 加载玩家等级 this.updatePlayerLevel(); }
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.initializeGame(); // 添加主题监听器 ThemeManager.getInstance().addThemeChangeListener((theme: ThemeType, colors: ThemeColors) => { this.currentTheme = theme; this.themeColors = colors; }); // 加载玩家等级 this.updatePlayerLevel(); }
https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
194f89250c6a47497ba3dccf351d9c401f47667b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
performDifferentialUpdate
执行差分更新
private async performDifferentialUpdate(updateInfo: PluginUpdateInfo): Promise<void> { try { // 下载差分补丁 const patchData = await this.downloadPatch(updateInfo.downloadUrl); // 解析差分补丁 const patch = await this.parseDifferentialPatch(patchData); // 应用差分补丁 await this.ap...
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 performDifferentialUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left updateInfo AST#identifier#R...
private async performDifferentialUpdate(updateInfo: PluginUpdateInfo): Promise<void> { try { // 下载差分补丁 const patchData = await this.downloadPatch(updateInfo.downloadUrl); // 解析差分补丁 const patch = await this.parseDifferentialPatch(patchData); // 应用差分补丁 await this.ap...
https://github.com/DaLongZhuaZi/manxia
f36b559ad4227b34ed413cdcc7e6a8c6cb5f15f6
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookTransitionOverlay.ets
arkts
onAnimationComplete
动画完成回调(由覆盖层组件调用) 翻开模式:触发导航但保持覆盖层可见,等待setReaderReady 关闭模式:直接完成并隐藏覆盖层
public onAnimationComplete(): void { logger.info(TAG, `动画完成: mode=${this.currentState.mode}`); const mode = this.currentState.mode; if (mode === TransitionMode.OPEN) { // 翻开模式:触发导航但保持覆盖层可见(黑色背景) // 等待阅读器加载完成后call setReaderReady()来隐藏覆盖层 if (this.onOpenComplete) { this.on...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onAnimationComplete 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 onAnimationComplete(): void { logger.info(TAG, `动画完成: mode=${this.currentState.mode}`); const mode = this.currentState.mode; if (mode === TransitionMode.OPEN) { // 翻开模式:触发导航但保持覆盖层可见(黑色背景) // 等待阅读器加载完成后call setReaderReady()来隐藏覆盖层 if (this.onOpenComplete) { this.on...
https://github.com/DaLongZhuaZi/manxia
ba3e59edf9dc8b6b07a1045da206c37517f048af
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleConsent.ets
arkts
setConsentInternal
Three-phase consent change: 1. compute the diff 2. apply the diff synchronously so a sync `hasConsent` call right after `giveConsent` returns sees the new value 3. await notifyConsentWillChange so modules can flush in-flight work 4. await notifyConsentDidChange; schedule the coalesced server snapshot willChange listene...
private async setConsentInternal(features: string[], given: boolean, emit: boolean): Promise<void> { const diff: ConsentDiff = this.computeDiff(features, given); if (diff.added.length === 0 && diff.removed.length === 0) return; // Apply the diff synchronously (before any await) so the public // giveC...
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 setConsentInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left features AST#identifier#Right AST#ERROR#Left AST#...
private async setConsentInternal(features: string[], given: boolean, emit: boolean): Promise<void> { const diff: ConsentDiff = this.computeDiff(features, given); if (diff.added.length === 0 && diff.removed.length === 0) return; // Apply the diff synchronously (before any await) so the public // giveC...
https://github.com/Countly/countly-sdk-hos
2fe1e36698c3e8af6f541caec5bda8ded6a68fdf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets
arkts
atan2
Method returns the angle in the plane (in radians) between the positive x-axis and the ray from (0, 0) to the point (x, y), for Math.atan2(y, x). @returns The angle in radians (between -π and π, inclusive) between the positive x-axis and the ray from (0, 0) to the point (x, y). @remark The atan2() method measures the c...
public static atan2(y: float, x: float): float { return atan2(y, x); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left atan2 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left y AST#iden...
public static atan2(y: float, x: float): float { return atan2(y, x); }
https://gitcode.com/iop123123/arkts-static-skills
2c4226b8c7f3c05569671f730ee5c861ef7f34ce
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleRequestQueue.ets
arkts
enableOfflineMode
Pause outbound traffic. `enqueue` still works and persists to storage, but nothing ships to the server until `disableOfflineMode(...)` is called.
public enableOfflineMode(): void { if (this.rejectIfHalted('ModuleRequestQueue', 'enableOfflineMode')) return; if (this.core.requestQueue.isPaused()) { this.config.logger.d('[ModuleRequestQueue] enableOfflineMode, already paused'); return; } this.core.requestQueue.pause(); this.config....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableOfflineMode 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#v...
public enableOfflineMode(): void { if (this.rejectIfHalted('ModuleRequestQueue', 'enableOfflineMode')) return; if (this.core.requestQueue.isPaused()) { this.config.logger.d('[ModuleRequestQueue] enableOfflineMode, already paused'); return; } this.core.requestQueue.pause(); this.config....
https://github.com/Countly/countly-sdk-hos
e435d8f6713ad99f7f788cfd0bb69bee958a98c2
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/commons/utils/src/main/ets/utils/BackgroundTaskManager.ets
arkts
stopContinuousTask
Cancel continuous task
public static stopContinuousTask(context: common.UIAbilityContext): void { try { backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { Logger.info(TAG, `stopBackgroundRunning failed Caus...
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 stopContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L...
public static stopContinuousTask(context: common.UIAbilityContext): void { try { backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { Logger.info(TAG, `stopBackgroundRunning failed Caus...
https://gitcode.com/HarmonyOS_Samples/hmosworld
899c6c8f63aea331a16b0e865315607134007aca
gitcode
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
constructor
Creates a SurfaceManager instance Triggers one-time AGenUIEngineBridge initialization on the first instance. Each constructor call creates an independent C++ ISurfaceManager instance. @param context UIAbilityContext
public constructor(context: common.UIAbilityContext) { AGenUIEngineBridge.getInstance().initialize(context); this._surfaceBridge = new AGenUIEngineSurfaceManagerBridge(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression...
public constructor(context: common.UIAbilityContext) { AGenUIEngineBridge.getInstance().initialize(context); this._surfaceBridge = new AGenUIEngineSurfaceManagerBridge(); }
https://github.com/AGenUI/AGenUI
fb7883c7b2aefadd91d52afc5630350692cfcf7f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
getServerInfoRobust
获取服务器信息(带瞬时错误重试) 使用场景:串流启动等"对单次失败容忍度低"的链路。 普通轮询(ComputerManager polling)不应使用此方法,否则会拖延状态判定。 重试策略: - 仅对瞬时网络错误(NvHttp.isTransientNetworkError)重试 - 硬错误(cert/401/协议错误)立即抛出,避免掩盖真实问题 - 每次重试前/sleep 后检查 isCancelled,及时响应取消 @param opts.maxAttempts 最大尝试次数,默认 3 @param opts.delayMs 重试间隔(ms),默认 1500 @param opts.isCancelled 取消检查回调,返回 ...
async getServerInfoRobust(opts?: GetServerInfoRobustOptions): Promise<ServerInfo> { const maxAttempts = opts?.maxAttempts ?? NvHttp.DEFAULT_ROBUST_MAX_ATTEMPTS; const delayMs = opts?.delayMs ?? NvHttp.DEFAULT_ROBUST_DELAY_MS; const isCancelled = opts?.isCancelled ?? ((): boolean => false); const onRet...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getServerInfoRobust AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left opts AST#identifier#Right AST#?#Left ? AST#?#Right AST#type...
async getServerInfoRobust(opts?: GetServerInfoRobustOptions): Promise<ServerInfo> { const maxAttempts = opts?.maxAttempts ?? NvHttp.DEFAULT_ROBUST_MAX_ATTEMPTS; const delayMs = opts?.delayMs ?? NvHttp.DEFAULT_ROBUST_DELAY_MS; const isCancelled = opts?.isCancelled ?? ((): boolean => false); const onRet...
https://github.com/AlkaidLab/moonlight-harmony
7e73f002ec8c540733388f9492a191c58e346b58
github
arkui-x/samples
CodeLab/Cases/feature/blendmode/src/main/ets/model/DataSource.ets
arkts
pushData
添加数据 @param data 虚拟数据
pushData(data: Array<PendantType>): void { data.forEach((item: PendantType) => { this.pendantData.push(item); this.notifyDataAdd(this.pendantData.length - 1); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Array AST#ide...
pushData(data: Array<PendantType>): void { data.forEach((item: PendantType) => { this.pendantData.push(item); this.notifyDataAdd(this.pendantData.length - 1); }) }
https://gitcode.com/arkui-x/samples
6141239c8d69a7e9735e257f8333a23fcbf95270
gitcode
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/utils/ShareUtil.ets
arkts
readFileFromUri
从URI读取文件内容
private static readFileFromUri(uri: string): string | null { try { // 将file:// URI转换为路径 const path = uri.replace('file://', ''); const file = fs.openSync(path, fs.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); // 1MB缓冲 const readLen = fs.readSync(file.fd, buffer); ...
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 readFileFromUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left ...
private static readFileFromUri(uri: string): string | null { try { // 将file:// URI转换为路径 const path = uri.replace('file://', ''); const file = fs.openSync(path, fs.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); // 1MB缓冲 const readLen = fs.readSync(file.fd, buffer); ...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
972060f77d7ba717e68c39484c4ba49b57dad024
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test5_original_index.ets
arkts
testFromCharCode
=== String.fromCharCode ===
function testFromCharCode(): string { let chars: number[] = [72, 101, 108, 108, 111]; let result: string = ''; for (const code of chars) { result = result + String.fromCharCode(code); } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFromCharCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
function testFromCharCode(): string { let chars: number[] = [72, 101, 108, 108, 111]; let result: string = ''; for (const code of chars) { result = result + String.fromCharCode(code); } return result; }
https://github.com/miaochiahao/ark-ghidra
04f8e97271320ad08b0577176edbe401a761a644
github
Harrisonls2004/WaterFlow
entry/src/main/ets/pages/LoginPage.ets
arkts
handleLogin
Handle login action.
handleLogin(): void { // Validate input if (this.username.trim() === '' || this.password.trim() === '') { promptAction.showToast({ message: '用户名和密码不能为空', duration: 2000 }); return; } this.isLoading = true; UserManager.loginWithResult(this.username, this.password...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Lef...
handleLogin(): void { // Validate input if (this.username.trim() === '' || this.password.trim() === '') { promptAction.showToast({ message: '用户名和密码不能为空', duration: 2000 }); return; } this.isLoading = true; UserManager.loginWithResult(this.username, this.password...
https://github.com/Harrisonls2004/WaterFlow
175ed08d4e4312f3baa07a0719bf45597302ae3a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
rotateDisplay
旋转显示器方向 (Sunshine 功能) 通知服务端同步修改分辨率方向,用于屏幕旋转同步 @param angle 旋转角度:0 表示横屏,90 表示竖屏 @param displayName 可选的显示器名称 @returns 是否成功
async rotateDisplay(angle: number, displayName?: string): Promise<boolean> { try { let query = `angle=${angle}`; if (displayName) { query += `&display_name=${encodeURIComponent(displayName)}`; } const url = this.buildUrl(await this.getHttpsBaseUrl(), 'rotate-display', query)...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left rotateDisplay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left angle AST#identifier#Right AST#type_annotation#Left AST#...
async rotateDisplay(angle: number, displayName?: string): Promise<boolean> { try { let query = `angle=${angle}`; if (displayName) { query += `&display_name=${encodeURIComponent(displayName)}`; } const url = this.buildUrl(await this.getHttpsBaseUrl(), 'rotate-display', query)...
https://github.com/AlkaidLab/moonlight-harmony
61f66faa995775bbba4968e176c5cc83cd9a53f4
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AiKeyService.ets
arkts
getRecommendationByPrompt
用户自定义提示获取推荐 @param prompt 用户的自定义描述 @returns 推荐的按键定义列表和说明
async getRecommendationByPrompt(prompt: string): Promise<AiKeyRecommendation> { const messages: AiMessage[] = [ { role: 'system', content: this.loadSystemPrompt() }, { role: 'user', content: prompt }, ]; const responseText = await this.nvHttp.aiCompletion(messages, 4096); return this.par...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getRecommendationByPrompt AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left prompt AST#identifier#Right AST#type_annotation#Left ...
async getRecommendationByPrompt(prompt: string): Promise<AiKeyRecommendation> { const messages: AiMessage[] = [ { role: 'system', content: this.loadSystemPrompt() }, { role: 'user', content: prompt }, ]; const responseText = await this.nvHttp.aiCompletion(messages, 4096); return this.par...
https://github.com/AlkaidLab/moonlight-harmony
3f3a1ed4cdf8099f4632b69c3e35060ebd223145
github
OHPG/FinSdk
emby/src/main/ets/network/EmbyApiClient.ets
arkts
buildEmbyAuthorization
构建 X-Emby-Authorization 值 格式参照 Emby 官方 JS SDK:MediaBrowser Client="...", Device="...", DeviceId="...", Version="...", Token="..." @param includeToken 是否包含 Token(登录请求时不含)
private buildEmbyAuthorization(includeToken: boolean): string { let values: string[] = [ `Client="${encodeURIComponent(this.clientInfo.name)}"`, `Device="${encodeURIComponent(this.deviceInfo.name)}"`, `DeviceId="${encodeURIComponent(this.deviceInfo.id)}"`, `Version="${encodeURIComponent(th...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildEmbyAuthorization AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left includeToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left b...
private buildEmbyAuthorization(includeToken: boolean): string { let values: string[] = [ `Client="${encodeURIComponent(this.clientInfo.name)}"`, `Device="${encodeURIComponent(this.deviceInfo.name)}"`, `DeviceId="${encodeURIComponent(this.deviceInfo.id)}"`, `Version="${encodeURIComponent(th...
https://github.com/OHPG/FinSdk
05a86d2d940b885d3552bf3c9610026f1fecfb24
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
addBaseType
Sets base class (super, that in ets follows `extends` keyword) @param base new base @returns this
public addBaseType(base: ClassType): ClassTypeCreator throws { this.checkNotCreated() this.base = TypeOrCreator.from(base) return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addBaseType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Clas...
public addBaseType(base: ClassType): ClassTypeCreator throws { this.checkNotCreated() this.base = TypeOrCreator.from(base) return this; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
149110460946b58eadec8e7c290848a8500fb50f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
createTimeoutPromise
创建超时Promise
private createTimeoutPromise(timeout: number): Promise<never> { return new Promise((_, reject) => { setTimeout(() => { reject(new Error(`插件执行超时: ${timeout}ms`)); }, timeout); }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createTimeoutPromise AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeout AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
private createTimeoutPromise(timeout: number): Promise<never> { return new Promise((_, reject) => { setTimeout(() => { reject(new Error(`插件执行超时: ${timeout}ms`)); }, timeout); }); }
https://github.com/DaLongZhuaZi/manxia
d117b554150794ff8bc13572896ede72f579db61
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/MouseEmulationService.ets
arkts
tick
定时器回调:发送鼠标移动 + 滚轮 对齐 Android: mouseEmulationRunnable
private tick(): void { if (!this.active || !this.callback) { return; } // 左摇杆 → 鼠标移动 const move = this.convertStickToPixelMovement(this.leftStickX, this.leftStickY); if (move.mag >= 1) { this.callback.sendMouseMove( Math.round(move.x), Math.round(-move.y) // Y轴取反(屏幕坐标 vs 摇杆坐标...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left tick AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
private tick(): void { if (!this.active || !this.callback) { return; } // 左摇杆 → 鼠标移动 const move = this.convertStickToPixelMovement(this.leftStickX, this.leftStickY); if (move.mag >= 1) { this.callback.sendMouseMove( Math.round(move.x), Math.round(-move.y) // Y轴取反(屏幕坐标 vs 摇杆坐标...
https://github.com/AlkaidLab/moonlight-harmony
bef5c4bbad0e646732146c30f2b319486868215a
github