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
honjow/Next2V
shared/src/main/ets/parser/V2exWriteFormParser.ets
arkts
findTextareaInnerText
The title/content textareas' inner text (the edit form pre-fills both between the tags). HTML-decoded.
private static findTextareaInnerText(formHtml: string, fieldName: string): string { const re = new RegExp(`<textarea\\b[^>]*name=['"]${fieldName}['"][^>]*>([\\s\\S]*?)</textarea>`, 'i') const m = formHtml.match(re) if (!m) { // Fall back to the first textarea's body when the named match misses (id-o...
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 findTextareaInnerText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left formHtml AST#identifier#Right AST#ERROR#Left ...
private static findTextareaInnerText(formHtml: string, fieldName: string): string { const re = new RegExp(`<textarea\\b[^>]*name=['"]${fieldName}['"][^>]*>([\\s\\S]*?)</textarea>`, 'i') const m = formHtml.match(re) if (!m) { // Fall back to the first textarea's body when the named match misses (id-o...
https://github.com/honjow/Next2V
5541ebc4736f0150ff033557c5979ef444345888
github
openharmony-sig/applications_calculator
common/src/main/ets/util/RdbHelper.ets
arkts
insert
insert record @param expression entry
async insert(valueBucket: relationalStore.ValuesBucket): Promise<void> { await this.getRdbStore(); if (this.rdbStore === null) { LogUtil.error(TAG, 'rdbStore is null, insert fail.'); return; } let insertPromise: Promise<number> = this.rdbStore.insert(DB.STORE_CONFIGV9.tableName, valueBucke...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insert AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left valueBucket AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async insert(valueBucket: relationalStore.ValuesBucket): Promise<void> { await this.getRdbStore(); if (this.rdbStore === null) { LogUtil.error(TAG, 'rdbStore is null, insert fail.'); return; } let insertPromise: Promise<number> = this.rdbStore.insert(DB.STORE_CONFIGV9.tableName, valueBucke...
https://gitee.com/openharmony-sig/applications_calculator.git
22638743cf0e05c53e97b1206d52a5dead2f49a6
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
getTempImagePath
获取临时缓存路径
getTempImagePath( sourceId: number, mangaId: string, chapterId: string, pageIndex: number, imageUrl: string ): string { if (!this.ensureCachePathsReady('getTempImagePath')) { return ''; } let ext = '.jpg'; const urlLower = imageUrl.toLowerCase(); if (urlLower.includes('...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left getTempImagePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb...
getTempImagePath( sourceId: number, mangaId: string, chapterId: string, pageIndex: number, imageUrl: string ): string { if (!this.ensureCachePathsReady('getTempImagePath')) { return ''; } let ext = '.jpg'; const urlLower = imageUrl.toLowerCase(); if (urlLower.includes('...
https://github.com/DaLongZhuaZi/manxia
7d410ec088c3e6207b82ee1864843627853b8161
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getElementsByCSSWithBridge
使用HTML桥接获取元素(优先使用DOM解析) 注意:对于大型HTML(>50KB),DOM解析可能导致主线程阻塞,应使用字符串解析
private getElementsByCSSWithBridge(selector: string): string[] { // 性能保护:对于大型HTML,直接使用字符串解析避免ANR // DOM解析的querySelectorAll对于大型HTML有O(n²)复杂度问题 const HTML_SIZE_THRESHOLD = 50000; // 50KB const contentLength = this.content.length; if (contentLength > HTML_SIZE_THRESHOLD) { if (LegadoRuleAn...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByCSSWithBridge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st...
private getElementsByCSSWithBridge(selector: string): string[] { // 性能保护:对于大型HTML,直接使用字符串解析避免ANR // DOM解析的querySelectorAll对于大型HTML有O(n²)复杂度问题 const HTML_SIZE_THRESHOLD = 50000; // 50KB const contentLength = this.content.length; if (contentLength > HTML_SIZE_THRESHOLD) { if (LegadoRuleAn...
https://github.com/DaLongZhuaZi/manxia
f5cdb483eb4f8e71c1751c745771ce359fe7dacb
github
LJ666-ui/harmony-health-care
entry/src/main/ets/store/AppStore.ets
arkts
resetState
Action: 重置状态(用于测试)
public resetState(): void { this.state = { user: initialState.user, healthRecords: [], medications: [], appointments: [], reminders: [], healthMetrics: [], settings: initialState.settings, healthStats: initialState.healthStats, isLoading: false }; this...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_...
public resetState(): void { this.state = { user: initialState.user, healthRecords: [], medications: [], appointments: [], reminders: [], healthMetrics: [], settings: initialState.settings, healthStats: initialState.healthStats, isLoading: false }; this...
https://github.com/LJ666-ui/harmony-health-care
d5c814c343d935105b375ceaa735f44430bd47fd
github
ASweetBite/HarmonyPulse
entry/src/main/ets/pages/components/MiniPlayBar.ets
arkts
build
--- 迷你播放条构建 ---
build() { Row() { // 小封面 Image(this.musicState.img ? this.musicState.img : $r('app.media.ic_default')) .width(40) .height(40) .borderRadius(4) .margin({ left: 20, right: 12 }) .backgroundColor('#eee') // 歌曲信息 Text(this.musicState.name || "未在播放") ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Row() { // 小封面 Image(this.musicState.img ? this.musicState.img : $r('app.media.ic_default')) .width(40) .height(40) .borderRadius(4) .margin({ left: 20, right: 12 }) .backgroundColor('#eee') // 歌曲信息 Text(this.musicState.name || "未在播放") ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/pages/components/MiniPlayBar.ets#L639-L686
ef3f1951451a0d0f8dcd364c6344103a3d71c169
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaBuilder.ets
arkts
generateCreateTableSqlByName
根据实体名称生成 CREATE TABLE SQL 语句 @param entityName 实体类名 @returns CREATE TABLE SQL 语句,如果实体未注册返回空字符串
generateCreateTableSqlByName(entityName: string): string { const storage = MetadataStorage.getInstance() const metadata = storage.getEntityMetadata(entityName) if (metadata === null) { return '' } return this.generateCreateTableSql(metadata) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateCreateTableSqlByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A...
generateCreateTableSqlByName(entityName: string): string { const storage = MetadataStorage.getInstance() const metadata = storage.getEntityMetadata(entityName) if (metadata === null) { return '' } return this.generateCreateTableSql(metadata) }
https://github.com/offlinecat-dev/OCNetORM
ce3a2828e942f17dfdc064638e7392f41688922d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets
arkts
deleteFile
删除文件或目录
async deleteFile(remotePath: string): Promise<void> { const url = this.getFullUrl(remotePath); logger.info(TAG, `删除: ${url}`); const result = await this.sendRequest('DELETE', url); if (result.statusCode !== 200 && result.statusCode !== 204 && result.statusCode !== 404) { const errorMsg...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async deleteFile(remotePath: string): Promise<void> { const url = this.getFullUrl(remotePath); logger.info(TAG, `删除: ${url}`); const result = await this.sendRequest('DELETE', url); if (result.statusCode !== 200 && result.statusCode !== 204 && result.statusCode !== 404) { const errorMsg...
https://github.com/DaLongZhuaZi/manxia
83f21d89b0e6437d9f90076b0947ba7358f04d0c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/EventSourcingDAO.ets
arkts
getByUser
获取用户的所有事件
static async getByUser(userId: number, limit: number = 100): Promise<DomainEvent[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(DomainEvent.tableName); predicates.equalTo('us...
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 getByUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:...
static async getByUser(userId: number, limit: number = 100): Promise<DomainEvent[]> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(DomainEvent.tableName); predicates.equalTo('us...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ceea26e7ee8a08c17e6b6112fd169badbf47abb8
github
openharmony-sig/ohos_react_native
tester/harmony/react_native_openharmony/src/main/ets/RNOH/EtsRNOHContext.ets
arkts
constructor
@internal
constructor(deps: EtsUITurboModuleContextDependencies) { super(deps.rnohContext); this.deps = deps; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deps AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EtsUITurboModuleContextDepend...
constructor(deps: EtsUITurboModuleContextDependencies) { super(deps.rnohContext); this.deps = deps; }
https://gitee.com/openharmony-sig/ohos_react_native.git
4efc7e1a7466688c7852ff59337630a0f57f7111
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
updateTimerImmediately
Refresh the timer immediately regardless of whether the latest start time changes.
async updateTimerImmediately(): Promise<void> { const triggerTime = await TimerManager.getTriggerTime(); const nearestAlarm = await this.getNearestAlarm(); if (!nearestAlarm) { LogUtil.info(TAG, 'No alarms enabled!'); triggerTime && triggerTime !== TRIGGER_TIME_NEVER && await TimerManager.stop...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateTimerImmediately 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 A...
async updateTimerImmediately(): Promise<void> { const triggerTime = await TimerManager.getTriggerTime(); const nearestAlarm = await this.getNearestAlarm(); if (!nearestAlarm) { LogUtil.info(TAG, 'No alarms enabled!'); triggerTime && triggerTime !== TRIGGER_TIME_NEVER && await TimerManager.stop...
https://gitee.com/openharmony-sig/applications_clock.git
09ef52a130916272cd8d50b446c5fcad76be377a
gitee
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Column.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example ColumnStartCenter() { Text("Hi"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginV...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginV...
https://github.com/Joker-x-dev/CoolMallArkTS
34d62fadf32fa2ba9a744c4475d546e8cf07d1c8
github
offlinecat-dev/OCNetORM
src/main/ets/core/MetadataStorage.ets
arkts
getRelationOrThrow
获取关联关系,如果不存在则抛出错误 @param entityName 实体名称 @param propertyName 属性名 @returns 关联关系元数据 @throws RelationNotFoundError 如果关联关系不存在
getRelationOrThrow(entityName: string, propertyName: string): RelationMetadata { const relation = this.getRelation(entityName, propertyName) if (!relation) { throw new RelationNotFoundError(entityName, propertyName) } return relation }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRelationOrThrow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left ...
getRelationOrThrow(entityName: string, propertyName: string): RelationMetadata { const relation = this.getRelation(entityName, propertyName) if (!relation) { throw new RelationNotFoundError(entityName, propertyName) } return relation }
https://github.com/offlinecat-dev/OCNetORM
4c401cf06789dab3cd0c2de6f538b3bbfca8fd0f
github
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/services/LocalDeviceService.ets
arkts
updateLocations
从设备列表中提取所有位置(自动去重)
private updateLocations(): void { const locationSet = new Set<string>(); this.devices.forEach(device => locationSet.add(device.location)); this.locations = Array.from(locationSet); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateLocations 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#...
private updateLocations(): void { const locationSet = new Set<string>(); this.devices.forEach(device => locationSet.add(device.location)); this.locations = Array.from(locationSet); }
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
b29dfa777cfd6466257fe21d3e227a7f8668c9ec
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
isTrue
Checks if this instance is true @returns { boolean } True if the instance value is true, false otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isTrue(): boolean { return this.value == true; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isTrue 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#boolea...
public isTrue(): boolean { return this.value == true; }
https://gitcode.com/iop123123/arkts-static-skills
247625bcf0902dd57bf52dfb6b283a17340d3662
gitcode
erosTeam/NextE
shared/src/main/ets/constants/EhConstants.ets
arkts
fCats
f_cats value to show ONLY the selected categories (EH encodes the inverse: bits to exclude).
static fCats(selected: string[]): number { if (selected.length === 0) { return 0 } let includeBits: number = 0 const map: Map<string, number> = EhConstants.cats() selected.forEach((name: string) => { const bit: number | undefined = map.get(name) if (bit !== undefined) { i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left fCats AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selected AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST...
static fCats(selected: string[]): number { if (selected.length === 0) { return 0 } let includeBits: number = 0 const map: Map<string, number> = EhConstants.cats() selected.forEach((name: string) => { const bit: number | undefined = map.get(name) if (bit !== undefined) { i...
https://github.com/erosTeam/NextE
7eca37ac0f21bdc7b09182d03bda961cdc995234
github
fbinba3955/Flymby
common/src/main/ets/utils/StringUtil.ets
arkts
formatTime
计算影片时长,展示为几天几小时几分几秒
static formatTime(time: number): string { // 将RunTimeTicks转换为秒 let second = time / 10000000; // 计算天数 const days = Math.floor(second / (60 * 60 * 24)); second %= 60 * 60 * 24; // 计算小时数 const hours = Math.floor(second / (60 * 60)); second %= 60 * 60; // 计算分钟数 const minutes = M...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
static formatTime(time: number): string { // 将RunTimeTicks转换为秒 let second = time / 10000000; // 计算天数 const days = Math.floor(second / (60 * 60 * 24)); second %= 60 * 60 * 24; // 计算小时数 const hours = Math.floor(second / (60 * 60)); second %= 60 * 60; // 计算分钟数 const minutes = M...
https://github.com/fbinba3955/Flymby
c576078f14c2a455b2fd784935841ac586dd8b93
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/utils/RouterManager.ets
arkts
clear
清空路由栈
static clear(): void { if (RouterManager.pathStack !== null) { RouterManager.pathStack.clear(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear 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...
static clear(): void { if (RouterManager.pathStack !== null) { RouterManager.pathStack.clear(); } }
https://github.com/Amaz1ny/HarmonyDO-public
f450b2f63d2c5abbede7a19db180ca2756577507
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
splitByAt
使用@分割规则链 正确处理引号和括号内的@符号
splitByAt(): string[] { const rules: string[] = []; let start = 0; // 跳过开头的@符号 while (this.pos < this.queue.length && (this.queue[this.pos] === '@' || this.queue[this.pos] <= ' ')) { this.pos++; } start = this.pos; while (this.pos < this.queue.length) { const c = this...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left splitByAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AS...
splitByAt(): string[] { const rules: string[] = []; let start = 0; // 跳过开头的@符号 while (this.pos < this.queue.length && (this.queue[this.pos] === '@' || this.queue[this.pos] <= ' ')) { this.pos++; } start = this.pos; while (this.pos < this.queue.length) { const c = this...
https://github.com/DaLongZhuaZi/manxia
0713414baed1b24d4db282b3ee0cd1e1666d55df
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/crypto/CryptoService.ets
arkts
isInitialized
检查加密服务是否已初始化
static isInitialized(): boolean { return cachedPassword.length > 0 }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isInitialized 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...
static isInitialized(): boolean { return cachedPassword.length > 0 }
https://github.com/encorexin/WordPressCMS
10c00cb49545f62fa7f62dda135279d82df3f0fa
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/CategoryDao.ets
arkts
updateCategory
更新分类信息 @param categoryId 分类ID @param updates 要更新的字段 @returns 是否更新成功
public async updateCategory(categoryId: number, updates: Category): Promise<boolean> { const valueBucket: relationalStore.ValuesBucket = {}; if (updates.name) { valueBucket.name = updates.name; } if (updates.icon_name) { valueBucket.icon_name = updates.icon_name; } if (updates.typ...
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 updateCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async updateCategory(categoryId: number, updates: Category): Promise<boolean> { const valueBucket: relationalStore.ValuesBucket = {}; if (updates.name) { valueBucket.name = updates.name; } if (updates.icon_name) { valueBucket.icon_name = updates.icon_name; } if (updates.typ...
https://github.com/fuhhhhhhhh/openharmony
432da5db708e953c9d5a4ff0d2d676c38acdc375
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets
arkts
xComponentAttachFlutterEngine
xcomponet绑定flutterEngine @param xcomponentId
xComponentAttachFlutterEngine(xcomponentId: string) { flutter.nativeXComponentAttachFlutterEngine(xcomponentId, this.nativeShellHolderId!); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left xComponentAttachFlutterEngine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xcomponentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right...
xComponentAttachFlutterEngine(xcomponentId: string) { flutter.nativeXComponentAttachFlutterEngine(xcomponentId, this.nativeShellHolderId!); }
https://gitee.com/openharmony-sig/flutter_engine.git
2583f235704488079b6d5755d6d6498a17bf014d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVBackupManager.ets
arkts
addToBackupIndex
添加备份到索引
private async addToBackupIndex(backupInfo: RemoteBackupInfo): Promise<void> { const index = await this.readBackupIndex(); // 检查是否已存在 const safeBackupInfo: RemoteBackupInfo = { fileName: this.sanitizeBackupFileName(backupInfo.fileName), remotePath: this.buildBackupRemotePath(backupInfo.fil...
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 addToBackupIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left backupInfo AST#identifier#Right AST#...
private async addToBackupIndex(backupInfo: RemoteBackupInfo): Promise<void> { const index = await this.readBackupIndex(); // 检查是否已存在 const safeBackupInfo: RemoteBackupInfo = { fileName: this.sanitizeBackupFileName(backupInfo.fileName), remotePath: this.buildBackupRemotePath(backupInfo.fil...
https://github.com/DaLongZhuaZi/manxia
ce8a68f834f8ccb987d0bbfe4b7e31ebd14b2a8f
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/ParentBindingFlow.ui.test.ets
arkts
scrollConfigToParentAccountRow
The parent-account row sits below `ConfigParentPinButton` and above the sync row, well below the fold on the landscape OpenHarmony emulator. V0.6.5.1 inserted the 📦 packPickerSection (5+ pack rows) between autoSpeak and parentPin, so a single upward swipe is no longer enough — iterate until the bind/bound button is on...
async function scrollConfigToParentAccountRow(driver: Driver): Promise<void> { try { for (let attempt: number = 0; attempt < 5; attempt++) { const bind: Component | null = await driver.findComponent(ON.id('ConfigBindParentButton')); const bound: Component | null = await driver.findComp...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left scrollConfigToParentAccountRow AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identif...
async function scrollConfigToParentAccountRow(driver: Driver): Promise<void> { try { for (let attempt: number = 0; attempt < 5; attempt++) { const bind: Component | null = await driver.findComponent(ON.id('ConfigBindParentButton')); const bound: Component | null = await driver.findComp...
https://github.com/terryma2024/happyword
1a083556664975eb7386f5f7f007251a6f0a55e0
github
Joker-x-dev/CoolMallArkTS
feature/common/src/main/ets/view/AboutPage.ets
arkts
build
构建关于我们页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "关于我们", viewModel: this.vm }) { this.AboutContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "关于我们", viewModel: this.vm }) { this.AboutContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
8150b43e723835162f7c5c6d6d7b0078e63c6c17
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an Uint16Array with respect to length. @param { number } length - Number of elements @throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Uint16Array.BYTES_PER_ELEMENT)) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLengthInt = this.le...
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 length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Uint16Array.BYTES_PER_ELEMENT)) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLengthInt = this.le...
https://gitcode.com/iop123123/arkts-static-skills
865e390c4d358410b68069b6ee553b2bd1d338d3
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
getUserAgentForSource
获取指定图源应使用的User-Agent @param sourceId 图源ID @param configUA 图源配置中的UA(可选) @returns User-Agent字符串
async getUserAgentForSource(sourceId: number, configUA?: string): Promise<string> { return this.userAgentManager.getUserAgent(sourceId, configUA); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserAgentForSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS...
async getUserAgentForSource(sourceId: number, configUA?: string): Promise<string> { return this.userAgentManager.getUserAgent(sourceId, configUA); }
https://github.com/DaLongZhuaZi/manxia
c1f83bbab0ab3cfff9e8b39e6f853c3065225047
github
Countly/countly-sdk-hos
library/src/main/ets/CountlyInstance.ets
arkts
onFeedbackOverlayClosed
@internal, called by the exported feedback overlay when dismissed.
public onFeedbackOverlayClosed(): void { this.config.logger.w('onFeedbackOverlayClosed, feedback module is disabled, no-op'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onFeedbackOverlayClosed 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 AS...
public onFeedbackOverlayClosed(): void { this.config.logger.w('onFeedbackOverlayClosed, feedback module is disabled, no-op'); }
https://github.com/Countly/countly-sdk-hos
b133525a17b66ba8720d3f6d8918eea299b2b990
github
openharmony/vendor_unionman
unionpi_tiger/sample_api10/app/metartc_app/entry/src/main/ets/module/CustomDialogExample.ets
arkts
build
弹窗中的内容描述
build() { Column() { Text(this.title || "是否修改文本框内容?") .fontSize(16) .margin(24) .textAlign(TextAlign.Center) .width("100%") Text(this.inputValue) .height(60) .textAlign(TextAlign.Center) .width('90%') Flex({ justifyContent: FlexAlign.SpaceA...
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() { Column() { Text(this.title || "是否修改文本框内容?") .fontSize(16) .margin(24) .textAlign(TextAlign.Center) .width("100%") Text(this.inputValue) .height(60) .textAlign(TextAlign.Center) .width('90%') Flex({ justifyContent: FlexAlign.SpaceA...
https://gitee.com/openharmony/vendor_unionman.git
6b652963516b389044da8de8b485d2633fb74cbf
gitee
egavrin/arkts_agent_kit
examples/fslib/src/tests/fslib.test.ets
arkts
testChmod
--- chmod ---
function testChmod(): void { ensureSetup() let fs = new FileSystem() let fpath: string = TMPDIR + "/chmod.txt" fs.writeText(fpath, "data") fs.chmod(fpath, 0o600) let st: FileStat = fs.stat(fpath) arktest.assertEQ(st.permissions, 0o600) fs.remove(fpath) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testChmod 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#L...
function testChmod(): void { ensureSetup() let fs = new FileSystem() let fpath: string = TMPDIR + "/chmod.txt" fs.writeText(fpath, "data") fs.chmod(fpath, 0o600) let st: FileStat = fs.stat(fpath) arktest.assertEQ(st.permissions, 0o600) fs.remove(fpath) }
https://gitcode.com/egavrin/arkts_agent_kit
dcaa845d4325fad57eb44b7b0bef4002bbba1759
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
importHSPModule
动态导入HSP模块
private async importHSPModule(moduleName: string): Promise<PluginModule | null> { try { // 使用动态导入语法加载HSP模块 // 注意:实际的HSP模块导入可能需要不同的语法 const module = await import(`@bundle:${moduleName}/ets/index`) as PluginModule; return module; } catch (error) { logger.error(TAG, `导入HSP模块失败: ${mo...
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 importHSPModule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#:...
private async importHSPModule(moduleName: string): Promise<PluginModule | null> { try { // 使用动态导入语法加载HSP模块 // 注意:实际的HSP模块导入可能需要不同的语法 const module = await import(`@bundle:${moduleName}/ets/index`) as PluginModule; return module; } catch (error) { logger.error(TAG, `导入HSP模块失败: ${mo...
https://github.com/DaLongZhuaZi/manxia
1764602e227ffe206962124caacf464f7791a35a
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
read
Reads a buffer of a specified size from the buffer. If the available buffer is sufficient, the result of the specified size is returned. Otherwise, if Readable has ended, all remaining buffers are returned. @param { int } size - Expected length of the data to be read. @returns { Any } The return value is of the buffer ...
read(size?: int): buffer.Buffer | string | null { const originSize = size; if (size !== undefined && size! > this.readableHighWatermarkInner) { this.readableHighWatermarkInner = this.computeNewReadableHighWatermark(size!); } if (size !== 0) { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left read AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST...
read(size?: int): buffer.Buffer | string | null { const originSize = size; if (size !== undefined && size! > this.readableHighWatermarkInner) { this.readableHighWatermarkInner = this.computeNewReadableHighWatermark(size!); } if (size !== 0) { ...
https://gitcode.com/iop123123/arkts-static-skills
8f5121451f29d83d591567228b8eee13d89cc781
gitcode
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/model/repository/HabitRepository.ets
arkts
queryById
🆕 根据 ID 查询单个习惯 (用于回显)
queryById(id: number): Promise<Habit | null> { const store = RdbHelper.getRdbStore(); if (!store) { return Promise.reject('DB not initialized'); } try { let predicates = new relationalStore.RdbPredicates(CommonConstants.HABIT_TABLE_NAME); predicates.equalTo('id', id); // 只查这一个 ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left queryById 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...
queryById(id: number): Promise<Habit | null> { const store = RdbHelper.getRdbStore(); if (!store) { return Promise.reject('DB not initialized'); } try { let predicates = new relationalStore.RdbPredicates(CommonConstants.HABIT_TABLE_NAME); predicates.equalTo('id', id); // 只查这一个 ...
https://gitcode.com/openharmony/codelabs
c3609358b0543023a914e2aa40c1a91eeb658539
gitcode
openharmony/applications_mms
entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets
arkts
recallMsg
Cancel Sending
recallMsg(e) { let messageCode = common.route.MESSAGE_CODE_UPDATE_RECALL_MESSAGES_VALUE; let actionData: LooseObject = {}; this.recallMessageSwitch = e.checked; if (this.recallMessageSwitch) { actionData.booleanValue = common.bool.TRUE; } else { action...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left recallMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left e AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_s...
recallMsg(e) { let messageCode = common.route.MESSAGE_CODE_UPDATE_RECALL_MESSAGES_VALUE; let actionData: LooseObject = {}; this.recallMessageSwitch = e.checked; if (this.recallMessageSwitch) { actionData.booleanValue = common.bool.TRUE; } else { action...
https://gitee.com/openharmony/applications_mms.git
03bdde7292f4f7b86400d108a8778c400386483e
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/RomParser.ets
arkts
createIconPixelMap
将图标像素数据转换为 PixelMap @param iconPixels 32x32 RGBA 像素数据 @returns PixelMap 对象
static async createIconPixelMap(iconPixels: Uint8Array): Promise<image.PixelMap | null> { try { const opts: image.InitializationOptions = { size: { width: 32, height: 32 }, srcPixelFormat: image.PixelMapFormat.RGBA_8888, // 源数据格式为 RGBA pixelFormat: image.PixelMapFormat.RGBA_8888, ...
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 createIconPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iconPixels AST#identifier#Right AST#:...
static async createIconPixelMap(iconPixels: Uint8Array): Promise<image.PixelMap | null> { try { const opts: image.InitializationOptions = { size: { width: 32, height: 32 }, srcPixelFormat: image.PixelMapFormat.RGBA_8888, // 源数据格式为 RGBA pixelFormat: image.PixelMapFormat.RGBA_8888, ...
https://github.com/richshaw2015/nds
507c8231f9bad7bd8f9eaa868d859537f4035c49
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/pages/CategoryManagement.ets
arkts
flattenTree
将树形结构扁平化为列表
flattenTree(nodes: CategoryTreeNode[], level: number): FlatTreeItem[] { const result: FlatTreeItem[] = [] nodes.forEach((node: CategoryTreeNode) => { const isExpanded = this.expandedIds.has(node.category.categoryId) const hasChildren = node.children.length > 0 result.push({ ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left flattenTree AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left CategoryTreeN...
flattenTree(nodes: CategoryTreeNode[], level: number): FlatTreeItem[] { const result: FlatTreeItem[] = [] nodes.forEach((node: CategoryTreeNode) => { const isExpanded = this.expandedIds.has(node.category.categoryId) const hasChildren = node.children.length > 0 result.push({ ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
39350a9a7381588a21b1b897d02e7f8ce0598011
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
saveEventInstances
批量保存事件实例
async saveEventInstances(instances: EventInstance[]): Promise<boolean> { if (instances.length === 0) { return true; } const rdbStore = await this.initDatabase(); try { await rdbStore.beginTransaction(); for (const instance of instances) { const valueBucket = this.instanceT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveEventInstances AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left instances AST#identifier#R...
async saveEventInstances(instances: EventInstance[]): Promise<boolean> { if (instances.length === 0) { return true; } const rdbStore = await this.initDatabase(); try { await rdbStore.beginTransaction(); for (const instance of instances) { const valueBucket = this.instanceT...
https://gitcode.com/openharmony/codelabs
c76037202bb9e4a688f23d222d6b091a180474f1
gitcode
Joker-x-dev/HarmonyKit
core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets
arkts
getAllItems
查询全部 Demo 记录并按更新时间倒序 @returns {Promise<DemoEntity[]>} Demo 列表
async getAllItems(): Promise<DemoEntity[]> { const list: DemoEntity[] = this.orm.query(DemoEntity).find(); // 以更新时间/创建时间倒序排列,便于展示最新数据 return list.sort((left: DemoEntity, right: DemoEntity) => { const leftTime: number = new Date(left.updatedAt ?? left.createdAt ?? "").getTime() || 0; const righ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllItems AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_...
async getAllItems(): Promise<DemoEntity[]> { const list: DemoEntity[] = this.orm.query(DemoEntity).find(); // 以更新时间/创建时间倒序排列,便于展示最新数据 return list.sort((left: DemoEntity, right: DemoEntity) => { const leftTime: number = new Date(left.updatedAt ?? left.createdAt ?? "").getTime() || 0; const righ...
https://github.com/Joker-x-dev/HarmonyKit
5b830e6d68852ab968cd6b844a1129af23a65deb
github
honjow/Next2V
shared/src/main/ets/settings/ThemeSettings.ets
arkts
setColorModeIfChanged
Only call setColorMode when the target differs from context.config.colorMode, to avoid triggering unnecessary rebuilds.
private static setColorModeIfChanged(context: common.UIAbilityContext, target: ConfigurationConstant.ColorMode): void { if (context.config.colorMode === target) { return } context.setColorMode(target) }
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 setColorModeIfChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right A...
private static setColorModeIfChanged(context: common.UIAbilityContext, target: ConfigurationConstant.ColorMode): void { if (context.config.colorMode === target) { return } context.setColorMode(target) }
https://github.com/honjow/Next2V
60317ba2a7283e9d6a7ea9dc91849097f38317c6
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GameControllerService.ets
arkts
getDeviceCount
获取已连接设备数量
getDeviceCount(): number { if (!native) return 0; return native.getDeviceCount(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDeviceCount 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#stateme...
getDeviceCount(): number { if (!native) return 0; return native.getDeviceCount(); }
https://github.com/AlkaidLab/moonlight-harmony
a5f725b9f5f820f27562edeccbf1adf909bd167f
github
ibestservices/ibest-ui
library/src/main/ets/components/timePicker/index.ets
arkts
handleGroupTimeChange
处理同组时间变化
handleGroupTimeChange(uniId: number, selectedValues: string[]) { if(this.uniId > uniId){ let selectTime = selectedValues.join(":") this.minTime = selectTime if(selectTime > this.maxTime || selectTime < this.minTime){ this.value = selectedValues } this.init() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleGroupTimeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uniId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identif...
handleGroupTimeChange(uniId: number, selectedValues: string[]) { if(this.uniId > uniId){ let selectTime = selectedValues.join(":") this.minTime = selectTime if(selectTime > this.maxTime || selectTime < this.minTime){ this.value = selectedValues } this.init() } }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/timePicker/index.ets#L243-L252
5e8b1825478f6a7f2e66fc0a6c3e414315966bb4
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/usercontributor/UserContributorNetworkDataSourceImpl.ets
arkts
getUserContributorPage
获取用户贡献者分页数据 @param {PageRequest} params - 分页参数 @returns {Promise<NetworkResponse<NetworkPageData<UserContributor>>>} 贡献者列表
async getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<UserContributor>>> = await NetworkClient.http.post("user/contributor/page", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserContributorPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST...
async getUserContributorPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<UserContributor>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<UserContributor>>> = await NetworkClient.http.post("user/contributor/page", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
3c49c8232123df5127208b3d6837283d966a0e99
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/security/CryptoDemo.ets
arkts
md5File
计算指定路径的文件的 md5 哈希值
public static md5File(filePath: string): Uint8Array { const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); const md5 = cryptoFramework.createMd('MD5'); const bufferSize = 1 * 1024; const buffer = new ArrayBuffer(bufferSize); let readLength: number; while ((readLength = fs.readSync(file...
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 md5File AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public static md5File(filePath: string): Uint8Array { const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); const md5 = cryptoFramework.createMd('MD5'); const bufferSize = 1 * 1024; const buffer = new ArrayBuffer(bufferSize); let readLength: number; while ((readLength = fs.readSync(file...
https://github.com/webabcd/HarmonyDemo
4a73dbf7cb60235de52a22e9fdbfcfae6ce787ff
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
removeSession
Remove a session
static removeSession(instance: number): void { const session = GlobalSessionManager.sessions.get(instance); if (session) { session.cleanup(); GlobalSessionManager.sessions.delete(instance); console.info(`GlobalSessionManager: Removed session ${instance}`); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left removeSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left instance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
static removeSession(instance: number): void { const session = GlobalSessionManager.sessions.get(instance); if (session) { session.cleanup(); GlobalSessionManager.sessions.delete(instance); console.info(`GlobalSessionManager: Removed session ${instance}`); } }
https://github.com/tangwengang-del/freerdp-harmonyos
0e3f0519604c1514f03445701827dae1dad193f0
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getXMin
Returns the minimum x-value this data object contains. @return
public getXMin(): number { return this.mXMin; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getXMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
public getXMin(): number { return this.mXMin; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a27178848d89e375884f63a2aa2bd78bf66595d0
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisLineDashedLine
Enables the axis line to be drawn in dashed mode, e.g. like this "- - - - - -". THIS ONLY WORKS IF HARDWARE-ACCELERATION IS TURNED OFF. Keep in mind that hardware acceleration boosts performance. @param effect the DashPathEffect
public setAxisLineDashedLine(effect: DashPathEffect): void { this.mAxisLineDashPathEffect = effect; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAxisLineDashedLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left effect AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
public setAxisLineDashedLine(effect: DashPathEffect): void { this.mAxisLineDashPathEffect = effect; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
46dafb67c23d78568f37c98f37869f93cb87a449
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
getCategoryItems
获取分类中的所有内容ID
getCategoryItems(categoryId: string): CategoryItem[] { const items: CategoryItem[] = []; this.itemCategoryMap.forEach((item) => { if (item.categoryId === categoryId) { items.push(item); } }); return items; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCategoryItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Righ...
getCategoryItems(categoryId: string): CategoryItem[] { const items: CategoryItem[] = []; this.itemCategoryMap.forEach((item) => { if (item.categoryId === categoryId) { items.push(item); } }); return items; }
https://github.com/DaLongZhuaZi/manxia
af6b41cfae76d02f7ae6f857155188b9e33de7f7
github
axiomaster/bonio
harmonyos/entry/src/main/ets/voice/VoiceWakeManager.ets
arkts
handleTranscription
Process transcribed text from speech recognition. This should be called by the speech recognizer callback.
public handleTranscription(text: string): void { const command = VoiceWakeCommandExtractor.extractCommand(text, this._triggerWords); if (!command) return; if (command === this.lastDispatched) return; this.lastDispatched = command; this.onCommand(command).catch((e: Error) => { hilog.error(DO...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleTranscription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public handleTranscription(text: string): void { const command = VoiceWakeCommandExtractor.extractCommand(text, this._triggerWords); if (!command) return; if (command === this.lastDispatched) return; this.lastDispatched = command; this.onCommand(command).catch((e: Error) => { hilog.error(DO...
https://github.com/axiomaster/bonio
cbdc5b125b46f110a274e99321251cc417797821
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CryptoUtils.ets
arkts
uint8ArrayToHex
将Uint8Array转换为十六进制字符串
function uint8ArrayToHex(arr: Uint8Array): string { const hexTable: string = '0123456789abcdef'; let result: string = ''; for (let i: number = 0; i < arr.length; i++) { const value: number = arr[i]; result += hexTable.charAt(value >>> 4); result += hexTable.charAt(value & 0x0f); } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left uint8ArrayToHex AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function uint8ArrayToHex(arr: Uint8Array): string { const hexTable: string = '0123456789abcdef'; let result: string = ''; for (let i: number = 0; i < arr.length; i++) { const value: number = arr[i]; result += hexTable.charAt(value >>> 4); result += hexTable.charAt(value & 0x0f); } return result; }
https://github.com/DaLongZhuaZi/manxia
4369adca9bb6303f8a20a0478529eec8f39f6003
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/02.lexical_elements/07.keywords/keywords.ets
arkts
main
--- desc: The following keywords are reserved in any context (hard keywords) and cannot be used as identifiers. tags: [negative, compile-only] params: '{{kwd}}' ---
function main(): void { let {{kwd}} = 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let {{kwd}} = 0; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
06a944aa010886becb33a3a0c33f327096a8cf83
gitee
LZZLHY/hlib
entry/src/main/ets/api/ZLibraryClient.ets
arkts
getPopularByLanguage
按语言过滤的热门书(首页推荐用)。 等价于 zlib 官方 app 行为:调 `/eapi/book/search?message=*&languages[]=chinese&order=popular`。 由于 most-popular endpoint 不尊重 languages 过滤,必须走 search 替代。
async getPopularByLanguage(languages: string[], limit: number = 30): Promise<Book[]> { const result: SearchPage = await this.search({ languages: languages, order: 'popular', page: 1, limit: limit, }); return result.books; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPopularByLanguage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left languages AST#identifier#Right AST#type_annotation#Left AS...
async getPopularByLanguage(languages: string[], limit: number = 30): Promise<Book[]> { const result: SearchPage = await this.search({ languages: languages, order: 'popular', page: 1, limit: limit, }); return result.books; }
https://github.com/LZZLHY/hlib
aa52ab610c46a89f9c66c2b61c690eeb8d1eebcc
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test16_original_index.ets
arkts
isPalindrome
--- Two-pointer palindrome check ---
function isPalindrome(s: string): boolean { let left: number = 0; let right: number = s.length - 1; while (left < right) { let cLeft: string = s.charAt(left); let cRight: string = s.charAt(right); if (cLeft !== cRight) { return false; } left = left + 1; right = right - 1; } retur...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isPalindrome AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function isPalindrome(s: string): boolean { let left: number = 0; let right: number = s.length - 1; while (left < right) { let cLeft: string = s.charAt(left); let cRight: string = s.charAt(right); if (cLeft !== cRight) { return false; } left = left + 1; right = right - 1; } retur...
https://github.com/miaochiahao/ark-ghidra
64c721e910cfd9b8340c92dcf16ec8e478a72d11
github
tdcare/tdwebrtc
src/main/ets/utils/PermissionUtil.ets
arkts
requestPermissionOnSettingEasy
二次向用户申请授权(多个权限建议使用该方法)。 @param permissions 需要授权的权限集合
static async requestPermissionOnSettingEasy(permissions: Array<Permissions>): Promise<boolean> { for (let i = 0; i < permissions.length; i++) { let check = await PermissionUtil.checkPermissions(permissions[i]); //判断是否授权。 if (!check) { //未授权,二次向用户申请授权。 let grant = await PermissionUtil.requestPe...
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 requestPermissionOnSettingEasy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left permis...
static async requestPermissionOnSettingEasy(permissions: Array<Permissions>): Promise<boolean> { for (let i = 0; i < permissions.length; i++) { let check = await PermissionUtil.checkPermissions(permissions[i]); //判断是否授权。 if (!check) { //未授权,二次向用户申请授权。 let grant = await PermissionUtil.requestPe...
https://github.com/tdcare/tdwebrtc
56bdb76360e3fb7dc09eb8d9269059a790666be8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies all elements of arr to the current Uint8ClampedArray starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<number> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inse...
public set(arr: FixedArray<number>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8ClampedArray.length") } for (let i = 0; i < arr.length; i+...
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#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<number>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8ClampedArray.length") } for (let i = 0; i < arr.length; i+...
https://gitcode.com/iop123123/arkts-static-skills
1a24e49c33bbdf8a5e9f9a80a65635dbc8545097
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
rowToEventInstance
将数据库行转换为 EventInstance 对象
private rowToEventInstance(resultSet: relationalStore.ResultSet): EventInstance { return { id: resultSet.getString(resultSet.getColumnIndex('id')), originalId: resultSet.getString(resultSet.getColumnIndex('original_id')), title: resultSet.getString(resultSet.getColumnIndex('title')), descr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rowToEventInstance 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 rowToEventInstance(resultSet: relationalStore.ResultSet): EventInstance { return { id: resultSet.getString(resultSet.getColumnIndex('id')), originalId: resultSet.getString(resultSet.getColumnIndex('original_id')), title: resultSet.getString(resultSet.getColumnIndex('title')), descr...
https://gitcode.com/openharmony/codelabs
14cbc93af851d34ebb8b574a97b42f204c9d3227
gitcode
openharmony/vendor_isoftstone
yangfan/samples/hhording/entry/src/main/ets/mainability/common/utlis/WindowUtils.ets
arkts
setFullScreen
设置屏幕全屏 @param isFull 是否全屏 不含状态栏和导航栏
setFullScreen(isFull: boolean): Promise<void> { return new Promise<void>((resolve, reject) => { window.getTopWindow().then((win) => { try { win.setFullScreen(isFull).then(() => { resolve() }).catch((err) => { reject(err) }) } catch (err) ...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left setFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isFull AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
setFullScreen(isFull: boolean): Promise<void> { return new Promise<void>((resolve, reject) => { window.getTopWindow().then((win) => { try { win.setFullScreen(isFull).then(() => { resolve() }).catch((err) => { reject(err) }) } catch (err) ...
https://gitee.com/openharmony/vendor_isoftstone.git
a339cf80017d3fa5cdd54ec75b19bb1e7e5a0899
gitee
HunZiLei/ArkTS_PokePomodoro
entry/src/main/ets/pages/customCpt/home.ets
arkts
touchUpPullRefresh
手指抬起,处理下拉刷新
touchUpPullRefresh(){ // 是否可以刷新 if (this.isCanRefresh) { console.info('======执行下拉刷新========') // 偏移量为下拉刷新布局高度 this.offsetY = vp2px(this.pullRefreshHeight) // 状态2:正在刷新 this.pullRefreshState(2) // 耗时操作 this.refreshData() } else { console.info('======关闭下拉刷新!未...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left touchUpPullRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block...
touchUpPullRefresh(){ // 是否可以刷新 if (this.isCanRefresh) { console.info('======执行下拉刷新========') // 偏移量为下拉刷新布局高度 this.offsetY = vp2px(this.pullRefreshHeight) // 状态2:正在刷新 this.pullRefreshState(2) // 耗时操作 this.refreshData() } else { console.info('======关闭下拉刷新!未...
https://github.com/HunZiLei/ArkTS_PokePomodoro
3d5dbd6f27621a4804b44848a8030f403c07585d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceAntiCrawler.ets
arkts
handleIpBlock
处理IP封禁
async handleIpBlock(): Promise<boolean> { try { logger.warn(TAG, '检测到IP封禁,开始处理'); const config = this.config.ipBlock as IpBlockConfig; const delay = config.delay || 60000; const maxRetries = config.maxRetries || 5; for (let i = 0; i < maxRetries; i++) { logger.info(TAG, `等待...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left handleIpBlock 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#generi...
async handleIpBlock(): Promise<boolean> { try { logger.warn(TAG, '检测到IP封禁,开始处理'); const config = this.config.ipBlock as IpBlockConfig; const delay = config.delay || 60000; const maxRetries = config.maxRetries || 5; for (let i = 0; i < maxRetries; i++) { logger.info(TAG, `等待...
https://github.com/DaLongZhuaZi/manxia
6a0f24876bfa338ba9712764437c0aeb881f39e4
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test38_original_index.ets
arkts
isLeapYear
--- Leap year check (multi-condition) ---
function isLeapYear(year: number): boolean { if (year % 4 !== 0) { return false; } if (year % 100 !== 0) { return true; } if (year % 400 === 0) { return true; } return false; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isLeapYear AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function isLeapYear(year: number): boolean { if (year % 4 !== 0) { return false; } if (year % 100 !== 0) { return true; } if (year % 400 === 0) { return true; } return false; }
https://github.com/miaochiahao/ark-ghidra
a0004592664c18074f0b930aa5e3eea2810d1076
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onBackground
onBackground 生命周期 应用切换到后台时调用
onBackground(): void { // Ability has back to background hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); // // 退出前台即停止监控,避免后台轮询/耗电 // MonitorCoreService.stopAll() // .then(() => { // hilog.info(DOMAIN, 'testTag', '%{public}s', 'MonitorCoreService stopped'); // ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block...
onBackground(): void { // Ability has back to background hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground'); // // 退出前台即停止监控,避免后台轮询/耗电 // MonitorCoreService.stopAll() // .then(() => { // hilog.info(DOMAIN, 'testTag', '%{public}s', 'MonitorCoreService stopped'); // ...
https://gitcode.com/openharmony/codelabs
930eee02e5f6226ffb0a2783a7d5220c412a1974
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets
arkts
setOvershootTension
设置过冲张力(OVERSHOOT插值器) @param tension 张力值
setOvershootTension(tension: number): AnimationConfig { this.overshootTension = tension; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOvershootTension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tension AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) ...
setOvershootTension(tension: number): AnimationConfig { this.overshootTension = tension; return this; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
c334b24466987be78af19bc7cb9c8a23a62fc999
gitcode
richshaw2015/nds
ohos/entry/src/test/NativeSync.test.ets
arkts
getSyncCallCount
============================================================================ 测试辅助方法 ============================================================================ 获取同步调用次数
getSyncCallCount(): number { return this.syncCallCount; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSyncCallCount 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#state...
getSyncCallCount(): number { return this.syncCallCount; }
https://github.com/richshaw2015/nds
c0975b460626683150b4fa4992e643ae861ed83a
github
tcodestudio/HiGit
entry/src/main/ets/utils/PipWindowUtil.ets
arkts
initPipController
[End start_pip] [Start init_pip_controller]
initPipController(): void { if (!this.pipController) { return; } if (canIUse('SystemCapability.Window.SessionManager')) { this.pipController.on('stateChange', (state: PiPWindow.PiPState, reason: string) => { this.onStateChange(state, reason); }); this.pipController.on('cont...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initPipController 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_...
initPipController(): void { if (!this.pipController) { return; } if (canIUse('SystemCapability.Window.SessionManager')) { this.pipController.on('stateChange', (state: PiPWindow.PiPState, reason: string) => { this.onStateChange(state, reason); }); this.pipController.on('cont...
https://github.com/tcodestudio/HiGit
59b7c751bec7e422121e4cc74593d2fc31a31520
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
checkAndAnnounce
检查并播报导航指令 @param currentPosition 当前位置 @param currentWaypoint 当前途经点 @param distanceToWaypoint 到途经点的距离
public checkAndAnnounce( currentPosition: Position3D, currentWaypoint: Waypoint, distanceToWaypoint: number ): void { // 检查是否应该播报 if (!this.shouldAnnounce(currentWaypoint, distanceToWaypoint)) { return; } // 生成播报文本 const text = this.generateAnnouncementText(currentWaypoint); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left checkAndAnnounce 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 Posi...
public checkAndAnnounce( currentPosition: Position3D, currentWaypoint: Waypoint, distanceToWaypoint: number ): void { // 检查是否应该播报 if (!this.shouldAnnounce(currentWaypoint, distanceToWaypoint)) { return; } // 生成播报文本 const text = this.generateAnnouncementText(currentWaypoint); ...
https://github.com/LJ666-ui/harmony-health-care
cad5a6ef79edef08e162099e78e7d35bca1f5f09
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbility.ets
arkts
stillAttachedForEvent
host所有实现方法结束======end
private stillAttachedForEvent(event: string) { Log.i(TAG, 'Ability ' + event); if (this?.delegate == null) { Log.w(TAG, "FlutterAbility " + event + " call after release."); return false; } if (!this?.delegate?.isAttached) { Log.w(TAG, "FlutterAbility " + event + " call after detach."...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stillAttachedForEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private stillAttachedForEvent(event: string) { Log.i(TAG, 'Ability ' + event); if (this?.delegate == null) { Log.w(TAG, "FlutterAbility " + event + " call after release."); return false; } if (!this?.delegate?.isAttached) { Log.w(TAG, "FlutterAbility " + event + " call after detach."...
https://gitee.com/openharmony-sig/flutter_engine.git
b8488ae56d6d7bf1428594f97c7c953571eec6e3
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getShelfFilteredNovelList
获取书架筛选后的小说列表(应用排序和标签/作者筛选)
private getShelfFilteredNovelList(): NovelBook[] { let baseList: NovelBook[] = this.novelList; // 如果是自定义书架,只显示用户明确添加的内容 if (this.selectedShelf !== null) { const itemIds = this.typeShelfManager.getShelfItemIdsByType(this.selectedShelf.id, ContentType.NOVEL); baseList = this.novelList.filte...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getShelfFilteredNovelList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Rig...
private getShelfFilteredNovelList(): NovelBook[] { let baseList: NovelBook[] = this.novelList; // 如果是自定义书架,只显示用户明确添加的内容 if (this.selectedShelf !== null) { const itemIds = this.typeShelfManager.getShelfItemIdsByType(this.selectedShelf.id, ContentType.NOVEL); baseList = this.novelList.filte...
https://github.com/DaLongZhuaZi/manxia
bd721f83d0ea0121ab91df9a20a6512a6b9bba9a
github
bhengubv/aether-protocol
harmonyos/teal/entry/src/main/ets/pages/Index.ets
arkts
aboutToAppear
── Lifecycle ──────────────────────────────────────────────────────────
aboutToAppear(): void { const ctx = getContext(this) as common.UIAbilityContext; this.service = new NearLinkTransportService(ctx); this.service.onDataReceived((data: Uint8Array) => { this.pushLog(`[Rx] ${data.byteLength} bytes`); }); this.service.probeAvailability().then((available: boolea...
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 { const ctx = getContext(this) as common.UIAbilityContext; this.service = new NearLinkTransportService(ctx); this.service.onDataReceived((data: Uint8Array) => { this.pushLog(`[Rx] ${data.byteLength} bytes`); }); this.service.probeAvailability().then((available: boolea...
https://github.com/bhengubv/aether-protocol
bbdd9d91844278c98248b3cd98d9a90cc5d11639
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets
arkts
setHighlightLineWidth
Sets the width of the highlight line in vp. @param width
public setHighlightLineWidth(width: number): void { this.mHighlightLineWidth = Utils.handleDataValues(width); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public setHighlightLineWidth(width: number): void { this.mHighlightLineWidth = Utils.handleDataValues(width); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c73df0d8816486bc39713e7c2807d8df4cc2f855
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/SshPreflightService.ets
arkts
consume
消费 token — 取出后立即删除 @returns token 数据, 或 null (不存在/过期)
consume(tokenId: string): SshPreflightTokenData | null { if (!tokenId || tokenId === '') { return null; } const data = this.tokens.get(tokenId); if (!data) { return null; } // 检查过期 if (Date.now() - (data.createdAt || 0) > this.TTL_MS) { this.tokens.delete(tokenId); return null; } ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left consume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tokenId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right...
consume(tokenId: string): SshPreflightTokenData | null { if (!tokenId || tokenId === '') { return null; } const data = this.tokens.get(tokenId); if (!data) { return null; } // 检查过期 if (Date.now() - (data.createdAt || 0) > this.TTL_MS) { this.tokens.delete(tokenId); return null; } ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
fc04132a06bbd2243ada918c268eb90fae9e38d6
github
arkui-x/samples
CodeLab/Cases/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets
arkts
createAnimation
创建移动动画 用于移动圆球和重绘canvas中凹陷部分
createAnimation() { if (!this.circleInfo) { return; } // 动画等待时长 let animateDelay = 0; // 动画执行次数 let animateIterations = 1; this.canvasAnimator = animator.create({ duration: this.animateTime, easing: "ease", delay: animateDelay, fill: "forwards", directio...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
createAnimation() { if (!this.circleInfo) { return; } // 动画等待时长 let animateDelay = 0; // 动画执行次数 let animateIterations = 1; this.canvasAnimator = animator.create({ duration: this.animateTime, easing: "ease", delay: animateDelay, fill: "forwards", directio...
https://gitcode.com/arkui-x/samples
8edfeb966061516dee57d5ee4cb6a5d183f251db
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Network/ProxyManager.ets
arkts
toggle
切换代理状态
async toggle(): Promise<boolean> { this.config.enabled = !this.config.enabled; await this.saveConfig(this.config); return this.config.enabled; }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left toggle AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right A...
async toggle(): Promise<boolean> { this.config.enabled = !this.config.enabled; await this.saveConfig(this.config); return this.config.enabled; }
https://github.com/DaLongZhuaZi/manxia
3e9337941527ee019ecf9907027fe68921858961
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets
arkts
resize
Resize the bitVector's length. @param { int } size - The new size for bitVector. If count is greater than the current size of bitVector, the additional bit elements are set to 0. @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. @...
public resize(size: int): void { if (size < 0) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of \"length\" is out of range. It must be >= 0. Received value is: ${size}`); } let sizeInt: int = size; if (this._length >= sizeInt) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right ...
public resize(size: int): void { if (size < 0) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of \"length\" is out of range. It must be >= 0. Received value is: ${size}`); } let sizeInt: int = size; if (this._length >= sizeInt) { ...
https://gitcode.com/iop123123/arkts-static-skills
d928d428dbc8a0c03aa6ddaadc33a00a91fa72b4
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets
arkts
getChunk
Accessors
getChunk(index: number) { return this.chunks[index]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getChunk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST...
getChunk(index: number) { return this.chunks[index]; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
9f197029669c31925b6b2c7aa897b4c7d8f7b201
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractController.ets
arkts
getLastActivityTime
获取最后活动时间戳 用于检测静默断开 @returns 最后活动的时间戳(毫秒),未实现的返回 0
getLastActivityTime(): number { return 0; // 默认实现,子类可覆盖 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastActivityTime 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#st...
getLastActivityTime(): number { return 0; // 默认实现,子类可覆盖 }
https://github.com/AlkaidLab/moonlight-harmony
1f43f3205abd344a971f81515566a48ac094d5be
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
constructor
构造函数 @param context 应用上下文,用于数据库操作
constructor(context: Context) { super(context, 'pixiv_manager', 'illust_history'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Rig...
constructor(context: Context) { super(context, 'pixiv_manager', 'illust_history'); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L20-L22
a8c17fe6c6497146eab920ce7de41bd93d40aff0
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setVisibleXRange
Limits the maximum and minimum x range that can be visible by pinching and zooming. e.g. minRange=10, maxRange=100 the smallest range to be displayed at once is 10, and no more than a range of 100 values can be viewed at once without scrolling @param minXRange @param maxXRange
public setVisibleXRange(minXRange: number, maxXRange: number): void { let minScale: number = 1; if (this.mXAxis) { minScale = this.mXAxis.mAxisRange / minXRange; } let maxScale: number = 1; if (this.mXAxis) { maxScale = this.mXAxis.mAxisRange / maxXRange; } this.mViewPortHandle...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVisibleXRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minXRange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num...
public setVisibleXRange(minXRange: number, maxXRange: number): void { let minScale: number = 1; if (this.mXAxis) { minScale = this.mXAxis.mAxisRange / minXRange; } let maxScale: number = 1; if (this.mXAxis) { maxScale = this.mXAxis.mAxisRange / maxXRange; } this.mViewPortHandle...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
5c4431f438e3f382313982d875ef3f801303a5d6
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/DataTransformTask.ets
arkts
get
获取列值 @param columnName 列名 @returns 值,如果不存在返回 null
get(columnName: string): string | number | null { const index = this.columnNames.indexOf(columnName) if (index >= 0) { return this.values[index] } return null }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left columnName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Le...
get(columnName: string): string | number | null { const index = this.columnNames.indexOf(columnName) if (index >= 0) { return this.values[index] } return null }
https://github.com/offlinecat-dev/OCNetORM
a5fd9d9714cad308f4be34a89b7fd862c8f77078
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets
arkts
resetStats
重置统计数据
public resetStats(): void { this.behaviorHistory = []; this.stats = { totalPages: 0, forwardPages: 0, backwardPages: 0, totalDuration: 0 }; this.updateStrategy(); logger.info(TAG, '统计数据已重置'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_...
public resetStats(): void { this.behaviorHistory = []; this.stats = { totalPages: 0, forwardPages: 0, backwardPages: 0, totalDuration: 0 }; this.updateStrategy(); logger.info(TAG, '统计数据已重置'); }
https://github.com/DaLongZhuaZi/manxia
cbe5822b7dae1dd7546f2af550dcae6e193a5f9c
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicPlayerService.ets
arkts
resetPlayer
重置播放器到初始状态
private async resetPlayer(): Promise<void> { if (!this.avPlayer) { return; } try { console.info(`[MusicPlayer] 当前状态: ${this.currentState}`); // 根据当前状态执行不同的操作 if (this.currentState === 'playing' || this.currentState === 'paused') { console.info('[MusicPlayer] 停止当前播放'); ...
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 resetPlayer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
private async resetPlayer(): Promise<void> { if (!this.avPlayer) { return; } try { console.info(`[MusicPlayer] 当前状态: ${this.currentState}`); // 根据当前状态执行不同的操作 if (this.currentState === 'playing' || this.currentState === 'paused') { console.info('[MusicPlayer] 停止当前播放'); ...
https://github.com/cpdd5201314/harmonyOS-music-app
ad8c85de7808c87a476290ea92514a605f817ef9
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
clearAll
清空词汇数据
clearAll(): void { this.vocabulary.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef...
clearAll(): void { this.vocabulary.clear(); }
https://github.com/CLMC2025/Vignette
001e971ad1dda3ced715652d5a5b8a70c385287a
github
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
deleteFolderAsync
异步删除文件目录 必须保证文件夹里面没有文件 @param path 待删除目录的绝对路径
deleteFolderAsync(path: string, deleteComplete:(value:void)=>void | PromiseLike<void>, deleteError:(value:void)=>void | PromiseLike<void>) { if (this.existFolder(path)) { fs.rmdir(path) .then(deleteComplete).catch(deleteError); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteFolderAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#R...
deleteFolderAsync(path: string, deleteComplete:(value:void)=>void | PromiseLike<void>, deleteError:(value:void)=>void | PromiseLike<void>) { if (this.existFolder(path)) { fs.rmdir(path) .then(deleteComplete).catch(deleteError); } }
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
72c841f861b04e568036da19cf0bb2e29b4b11cf
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets
arkts
registerFoldStatusListener
注册折叠状态变化监听器
private registerFoldStatusListener(): void { try { display.on('foldStatusChange', (status: display.FoldStatus) => { this.currentFoldStatus = this.convertFoldStatus(status); logger.info(TAG, `🔄 折叠状态变化: ${this.getFoldStatusName(this.currentFoldStatus)}`); // 折叠状态变化时更新设备信息 this...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerFoldStatusListener 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#Ri...
private registerFoldStatusListener(): void { try { display.on('foldStatusChange', (status: display.FoldStatus) => { this.currentFoldStatus = this.convertFoldStatus(status); logger.info(TAG, `🔄 折叠状态变化: ${this.getFoldStatusName(this.currentFoldStatus)}`); // 折叠状态变化时更新设备信息 this...
https://github.com/DaLongZhuaZi/manxia
64b421ce73d52f6e00b89f541855067e416fbccc
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/SmartTVController.ets
arkts
getDeviceStatus
获取电视设备状态
public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> { let status = this.statusCache.get(deviceId); // 如果没有缓存状态,创建默认状态 if (!status) { const properties: Map<string, DeviceProperty> = new Map(); properties.set('volume', { key: 'volume', value: 50, unit: ...
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 getDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> { let status = this.statusCache.get(deviceId); // 如果没有缓存状态,创建默认状态 if (!status) { const properties: Map<string, DeviceProperty> = new Map(); properties.set('volume', { key: 'volume', value: 50, unit: ...
https://github.com/LJ666-ui/harmony-health-care
893bb4932c95612dd694f36babc251304f3a298b
github
the-wwyang/kids-learning-app
src/main/ets/services/QuestionGenerator.ets
arkts
getComparisonMaxNum
获取比较题最大数值 @param difficulty 难度等级 @returns 最大数值
private static getComparisonMaxNum(difficulty: Difficulty): number { const maxNums: Record<Difficulty, number> = { [Difficulty.EASY]: 20, [Difficulty.MEDIUM]: 50, [Difficulty.HARD]: 100 }; return maxNums[difficulty]; }
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 getComparisonMaxNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right ...
private static getComparisonMaxNum(difficulty: Difficulty): number { const maxNums: Record<Difficulty, number> = { [Difficulty.EASY]: 20, [Difficulty.MEDIUM]: 50, [Difficulty.HARD]: 100 }; return maxNums[difficulty]; }
https://github.com/the-wwyang/kids-learning-app
55778802ce7cfa7a3397a5227c432f68b54d7cd3
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets
arkts
maybeSendBossIntro
Mirrors the Swift maybeSendBossIntro bookkeeping exactly: an intro is sent the first time a monster's CATALOG index is seen, and only when the engine's monster slot actually changed. The scene owns the 1.05 s auto-dismiss. Dialogue comes from the monster catalog like the native BattlePage's showIntroForCatalog.
private maybeSendBossIntro(): void { const state: BattleState = this.engine.getState(); if (state.status !== BattleStatus.Playing) { return; } const catalogIndex: number = this.catalogIndexProvider(); if (state.monsterIndex === this.lastBossIntroMonsterIndex || this.shownBossIntroCatal...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left maybeSendBossIntro 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 A...
private maybeSendBossIntro(): void { const state: BattleState = this.engine.getState(); if (state.status !== BattleStatus.Playing) { return; } const catalogIndex: number = this.catalogIndexProvider(); if (state.monsterIndex === this.lastBossIntroMonsterIndex || this.shownBossIntroCatal...
https://github.com/terryma2024/happyword
65becc5dc6fcc979039a088745b7c20fa8deb1f6
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/XboxOneController.ets
arkts
ackModeReport
确认模式报告
private async ackModeReport(seqNum: number): Promise<void> { const payload = new Uint8Array([ 0x01, 0x20, seqNum, 0x09, 0x00, 0x07, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 ]); await this.bulkWrite(payload); }
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 ackModeReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left seqNum AST#identifier#Right AST#:#Left ...
private async ackModeReport(seqNum: number): Promise<void> { const payload = new Uint8Array([ 0x01, 0x20, seqNum, 0x09, 0x00, 0x07, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 ]); await this.bulkWrite(payload); }
https://github.com/AlkaidLab/moonlight-harmony
d28f054504548c675b5b07e3ba5bec0d0860e070
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
removeEntry
Removes the given Entry object from the DataSet at the specified index. @param e @param dataSetIndex
public removeEntry(e: EntryOhos, dataSetIndex: number): boolean { if (!this.mDataSets) { return true; } // entry null, outofbounds if (e == null || dataSetIndex >= this.mDataSets.listSize) return false; let data: IDataSet<EntryOhos> = this.mDataSets.get(dataSetIndex); if (data !...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EntryOh...
public removeEntry(e: EntryOhos, dataSetIndex: number): boolean { if (!this.mDataSets) { return true; } // entry null, outofbounds if (e == null || dataSetIndex >= this.mDataSets.listSize) return false; let data: IDataSet<EntryOhos> = this.mDataSets.get(dataSetIndex); if (data !...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
80ac0077f73187531ee4666017e20e40e85b9d2a
gitee
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/AdvancedSunshineCalculator.ets
arkts
getUnitCenterPoint
获取单元中心点坐标
private getUnitCenterPoint(building: BuildingModel, unitIndex: number): Point3D { const units = Math.max(1, Math.round(building.units)); // 右起编号: 1=最右, 转换为左起偏移 const offset = units - unitIndex; const fracCenter = (offset + 0.5) / units; // 0..1 从左到右 const localX = (fracCenter - 0.5) * buildin...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getUnitCenterPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left building AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private getUnitCenterPoint(building: BuildingModel, unitIndex: number): Point3D { const units = Math.max(1, Math.round(building.units)); // 右起编号: 1=最右, 转换为左起偏移 const offset = units - unitIndex; const fracCenter = (offset + 0.5) / units; // 0..1 从左到右 const localX = (fracCenter - 0.5) * buildin...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
259e7d4770bdb94eef26dc194ebaa65411c9fe7a
github
offlinecat-dev/OCNetORM
src/main/ets/core/MetadataStorage.ets
arkts
hasEntity
检查实体是否已注册 @param entityName 实体类名 @returns 是否已注册
hasEntity(entityName: string): boolean { return this.entities.has(entityName) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasEntity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
hasEntity(entityName: string): boolean { return this.entities.has(entityName) }
https://github.com/offlinecat-dev/OCNetORM
0044ee10d252399d8b90678b2aa61211e9eeb8ae
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/viewmodel/ChatViewModel.ets
arkts
getLimitedContextMessages
Limits the conversation context to the most recent messages for API efficiency (5 user messages and 5 agent messages) @param conversation - Full conversation history @returns Limited context with most recent messages
private getLimitedContextMessages(conversation: ChatMessage[]): ChatMessage[] { let humanCount = 0; let aiCount = 0; const limitedMessages: ChatMessage[] = []; for (let i = conversation.length - 1; i >= 0; i--) { const msg = conversation[i]; if (msg.apiMessageType === ApiMessageType.HUMAN...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLimitedContextMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left conversation AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right...
private getLimitedContextMessages(conversation: ChatMessage[]): ChatMessage[] { let humanCount = 0; let aiCount = 0; const limitedMessages: ChatMessage[] = []; for (let i = conversation.length - 1; i >= 0; i--) { const msg = conversation[i]; if (msg.apiMessageType === ApiMessageType.HUMAN...
https://github.com/somnio-software/my-bot-pal
840f4507f12f49543bee7e38fd788fa1b795a698
github
openharmony-tpc/VCard
library/src/main/ets/components/utils/PhoneNumberUtils.ets
arkts
isReallyDialable
True if c is ISO-LATIN characters 0-9, *, # , + (no WILD)
public static isReallyDialable(c:string) :boolean{ return (c >= '0' && c <= '9') || c == '*' || c == '#' || c == '+'; }
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 isReallyDialable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AS...
public static isReallyDialable(c:string) :boolean{ return (c >= '0' && c <= '9') || c == '*' || c == '#' || c == '+'; }
https://gitee.com/openharmony-tpc/VCard.git
593d3666c9b14a8c85a344ab83117bd9b6e0e554
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheStorage.ets
arkts
readFromCache
从本地缓存读取文件 @param cachePath 缓存文件路径 @returns 文件内容
private async readFromCache(cachePath: string): Promise<ArrayBuffer> { let file: fs.File | null = null; try { file = await fs.open(cachePath, fs.OpenMode.READ_ONLY); const stat = await fs.stat(file.fd); const buffer = new ArrayBuffer(stat.size); await fs.read(file.fd, buffer); hi...
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 readFromCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cachePath AST#identifier#Right AST#ERROR#Left AST#:#Le...
private async readFromCache(cachePath: string): Promise<ArrayBuffer> { let file: fs.File | null = null; try { file = await fs.open(cachePath, fs.OpenMode.READ_ONLY); const stat = await fs.stat(file.fd); const buffer = new ArrayBuffer(stat.size); await fs.read(file.fd, buffer); hi...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L214-L229
97a8516c6158fe20f7db598de666eb1f13282909
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/background/ReminderTaskDemo.ets
arkts
publishReminder
发布一个日历提醒(到了指定的时间后会弹出一个通知)
publishReminder() { let date = new Date() date.setMinutes(date.getMinutes() + 1) // 构造一个 ReminderRequestCalendar 类型的日历提醒 let reminderRequestCalendar: reminderAgentManager.ReminderRequestCalendar = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR, // 提醒类型为日历类型 dateT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left publishReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
publishReminder() { let date = new Date() date.setMinutes(date.getMinutes() + 1) // 构造一个 ReminderRequestCalendar 类型的日历提醒 let reminderRequestCalendar: reminderAgentManager.ReminderRequestCalendar = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR, // 提醒类型为日历类型 dateT...
https://github.com/webabcd/HarmonyDemo
d8a94a741859ceffa2bdd0c02d81ae54b898c6b8
github
751496032/ZRouter
RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets
arkts
setPushEnterAnimate
进入状态(PUSH) 进入页的动画转场参数(A进入B 的 B进入转场) @param param @returns
public setPushEnterAnimate(param: INavSingleAnimationParam) { if (this._callback) { this._callback.pushEnterParam = param } return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPushEnterAnimate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public setPushEnterAnimate(param: INavSingleAnimationParam) { if (this._callback) { this._callback.pushEnterParam = param } return this }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets#L79-L84
32171f6e8da4216a55eaba8934478b55d701175f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Editor/FileEditorService.ets
arkts
renameFile
重命名/移动文件
public async renameFile(oldPath: string, newPath: string): Promise<boolean> { try { logger.info(TAG, `重命名文件: ${oldPath} -> ${newPath}`); await fileIo.rename(oldPath, newPath); logger.info(TAG, '文件重命名成功'); return true; } catch (e) { logger.error(TAG, `重命名文件失败: ${e}`); throw ...
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 renameFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left oldPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
public async renameFile(oldPath: string, newPath: string): Promise<boolean> { try { logger.info(TAG, `重命名文件: ${oldPath} -> ${newPath}`); await fileIo.rename(oldPath, newPath); logger.info(TAG, '文件重命名成功'); return true; } catch (e) { logger.error(TAG, `重命名文件失败: ${e}`); throw ...
https://github.com/DaLongZhuaZi/manxia
8f63f6bb7bae8b6a5fce43b7466b15aec08b8625
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets
arkts
deleteApproval
删除审批草稿 @param approvalId 审批ID
async deleteApproval(approvalId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/approval/approvals/${approvalId}`) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteApproval AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async deleteApproval(approvalId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/approval/approvals/${approvalId}`) }
https://github.com/David8Idira/AI-OA
be42c4ec65eeb520caa2848f0903445d73b736f9
github
CLMC2025/Vignette
entry/src/main/ets/ui/Animations.ets
arkts
clearAllStates
清空所有动画状态
clearAllStates(): void { this.animationStates.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAllStates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
clearAllStates(): void { this.animationStates.clear(); }
https://github.com/CLMC2025/Vignette
8e391e413a77b12744368d99b79e31f932be24d9
github
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets
arkts
writeFileToBox
将rawFile中的文件写到沙箱中
async writeFileToBox(fileName: string): Promise<string> { let context = getContext(this); let value = await context.resourceManager.getRawFileContent(fileName); let myBuffer: ArrayBufferLike = value.buffer; let filePath = context.filesDir + `/` + fileName; this.logger.log(`filepath is ` + filePath...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left writeFileToBox AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileName AST#identifier#Right AST#type_annotation#Left ...
async writeFileToBox(fileName: string): Promise<string> { let context = getContext(this); let value = await context.resourceManager.getRawFileContent(fileName); let myBuffer: ArrayBufferLike = value.buffer; let filePath = context.filesDir + `/` + fileName; this.logger.log(`filepath is ` + filePath...
https://github.com/openharmony/applications_app_samples
3f671068e7f1f5b4fbc7998581a2be0838585057
github
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallService.ets
arkts
unreadCallNotification
Unread missed call notification
public async unreadCallNotification(map: Map<string, string>) { MissedCallNotifier.getInstance().sendUnreadCallNotification(map); }
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 unreadCallNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Le...
public async unreadCallNotification(map: Map<string, string>) { MissedCallNotifier.getInstance().sendUnreadCallNotification(map); }
https://gitee.com/openharmony/applications_contacts.git
44ba074607efbe5874d19fdd790b933b24b28bce
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
createEmptyState
创建空状态
private createEmptyState(): GamepadState { return { buttons: 0, leftStickX: 0, leftStickY: 0, rightStickX: 0, rightStickY: 0, leftTrigger: 0, rightTrigger: 0 }; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createEmptyState 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 Ga...
private createEmptyState(): GamepadState { return { buttons: 0, leftStickX: 0, leftStickY: 0, rightStickX: 0, rightStickY: 0, leftTrigger: 0, rightTrigger: 0 }; }
https://github.com/AlkaidLab/moonlight-harmony
d06dc1115a5b99a1a1094e669dad0af40e468c08
github