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
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
announce
播报文本 @param text 播报文本
public async announce(text: string): Promise<void> { // 检查静音状态 if (this.isMuted) { console.log('[VoiceGuide] 静音模式,跳过播报:', text); return; } // 检查播报间隔 const now = Date.now(); if (now - this.lastAnnounceTime < this.minAnnounceInterval) { console.log('[VoiceGuide] 播报间隔过短,加入队列:',...
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 announce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Ri...
public async announce(text: string): Promise<void> { // 检查静音状态 if (this.isMuted) { console.log('[VoiceGuide] 静音模式,跳过播报:', text); return; } // 检查播报间隔 const now = Date.now(); if (now - this.lastAnnounceTime < this.minAnnounceInterval) { console.log('[VoiceGuide] 播报间隔过短,加入队列:',...
https://github.com/LJ666-ui/harmony-health-care
17835274d9c7898d054887c24f193283e3b8507c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets
arkts
addListener
添加设置变化监听器
public addListener(listener: AnimationSettingsListener): void { this.listeners.add(listener); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public addListener(listener: AnimationSettingsListener): void { this.listeners.add(listener); }
https://github.com/DaLongZhuaZi/manxia
f244ac78bf6c01d0ea5c887ae1da36d7e4aa6101
github
LJ666-ui/harmony-health-care
entry/src/main/ets/store/AppStore.ets
arkts
addHealthMetric
Action: 添加健康指标
public addHealthMetric(metric: Omit<HealthMetric, 'id'>): void { const newMetric: HealthMetric = { type: metric.type, value: metric.value, unit: metric.unit, date: metric.date, id: 'metric_' + Date.now() }; const newMetrics: HealthMetric[] = [newMetric]; for (let i =...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addHealthMetric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left metric AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ...
public addHealthMetric(metric: Omit<HealthMetric, 'id'>): void { const newMetric: HealthMetric = { type: metric.type, value: metric.value, unit: metric.unit, date: metric.date, id: 'metric_' + Date.now() }; const newMetrics: HealthMetric[] = [newMetric]; for (let i =...
https://github.com/LJ666-ui/harmony-health-care
83fe54f0d2b9b11a6927a777964954dd2d257da7
github
the-wwyang/kids-learning-app
src/main/ets/services/DataBackupService.ets
arkts
autoBackup
自动备份(定期调用)
public async autoBackup(): Promise<void> { try { const result = await this.exportData(); if (result.success) { console.info('DataBackupService: 自动备份成功'); } } catch (err) { console.error('DataBackupService: 自动备份失败', JSON.stringify(err)); } }
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 autoBackup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public async autoBackup(): Promise<void> { try { const result = await this.exportData(); if (result.success) { console.info('DataBackupService: 自动备份成功'); } } catch (err) { console.error('DataBackupService: 自动备份失败', JSON.stringify(err)); } }
https://github.com/the-wwyang/kids-learning-app
0d7e9400c7b117dc21e6490fbe668d11e12f8699
github
Gramony/Gramony
features/home/src/main/ets/viewmodel/Chat/ChatDataSource.ets
arkts
notifyDataAdd
通知LazyForEach组件需要在index对应索引处添加子组件
notifyDataAdd(index: number): void { Logger.debug('notifyDataAdd: ' + index); this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
notifyDataAdd(index: number): void { Logger.debug('notifyDataAdd: ' + index); this.listeners.forEach(listener => { listener.onDataAdd(index); }) }
https://github.com/Gramony/Gramony
15ace5dece2e066d059fce1d508cd51d8842e06d
github
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/executor.ets
arkts
formatFleetLabel
根据 deckId / combinedType 生成舰队标签
function formatFleetLabel(deckId: number, combinedType: number): string { switch (combinedType) { case 1: return `第${deckId}舰队(机动联合)`; case 2: return `第${deckId}舰队(水上联合)`; case 3: return `第${deckId}舰队(输送联合)`; default: return `第${deckId}舰队`; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatFleetLabel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deckId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function formatFleetLabel(deckId: number, combinedType: number): string { switch (combinedType) { case 1: return `第${deckId}舰队(机动联合)`; case 2: return `第${deckId}舰队(水上联合)`; case 3: return `第${deckId}舰队(输送联合)`; default: return `第${deckId}舰队`; } }
https://github.com/CsCesium/KantaiHomo
db24af31e6800d8ab82cf439e8471bfd22d0fa81
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets
arkts
calculateProgress
计算动画进度
public static calculateProgress(startTime: number, duration: number): number { const elapsed = Date.now() - startTime; return Math.min(elapsed / duration, 1); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startTime AST#identifier#Right AST#ERROR#Left AST#:#...
public static calculateProgress(startTime: number, duration: number): number { const elapsed = Date.now() - startTime; return Math.min(elapsed / duration, 1); }
https://github.com/DaLongZhuaZi/manxia
94ce0954f12b15c8bc490701ad2cfd655d32ea90
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/toast/ToastUtils.ets
arkts
showBreakAll
显示强制截断换行 Toast @param {string | ResourceStr} message - 提示内容 @returns {void} 无返回值
static showBreakAll(message: string | ResourceStr): void { IBestToast.show({ wordBreak: "break-all", message: message }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showBreakAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressio...
static showBreakAll(message: string | ResourceStr): void { IBestToast.show({ wordBreak: "break-all", message: message }); }
https://github.com/Joker-x-dev/CoolMallArkTS
2bdb75a980507cd9613516036c941b0bebd8f558
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/VideoInfoUtil.ets
arkts
getVideoSize
获取视频大小
static async getVideoSize(uri: string, return_string: boolean): Promise<string | number> { return new Promise((resolve, reject) => { try { let file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY) fileIo.stat(file.fd, (err: BusinessError, stat: fileIo.Stat) => { if (err) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getVideoSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:...
static async getVideoSize(uri: string, return_string: boolean): Promise<string | number> { return new Promise((resolve, reject) => { try { let file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY) fileIo.stat(file.fd, (err: BusinessError, stat: fileIo.Stat) => { if (err) { ...
https://github.com/Yebingiscn/SweetVideo
4d92f4711ba4518310ca493c4ee81e4d95f1557c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
deleteRecognition
删除识别记录
static async deleteRecognition(recordId: number): Promise<boolean> { try { return await OCRRecognitionRecordDAO.softDelete(recordId); } catch (error) { console.error('[OCRRecognitionService] 删除识别记录失败:', error); throw error instanceof Error ? error : new Error(String(error)); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteRecognition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Le...
static async deleteRecognition(recordId: number): Promise<boolean> { try { return await OCRRecognitionRecordDAO.softDelete(recordId); } catch (error) { console.error('[OCRRecognitionService] 删除识别记录失败:', error); throw error instanceof Error ? error : new Error(String(error)); } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1034504731c0f1415aa09cdb7e84be394eedfeaa
github
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
drawVersion
Draws two copies of the version bits (with its own error correction code), based on this object's version field, iff 7 <= version <= 40.
private drawVersion(): void { if (this.version < 7) return; // Calculate error correction code and pack bits let rem: int = this.version; // version is uint6, in the range [7, 40] for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1F25); const bits: int = th...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawVersion 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...
private drawVersion(): void { if (this.version < 7) return; // Calculate error correction code and pack bits let rem: int = this.version; // version is uint6, in the range [7, 40] for (let i = 0; i < 12; i++) rem = (rem << 1) ^ ((rem >>> 11) * 0x1F25); const bits: int = th...
https://gitee.com/openharmony-sig/qr-code-generator.git
4b7cbb625e199f1db0689193e037aa5ed94d5998
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
simpleHash
简单哈希函数(后备方案)
private simpleHash(str: string, length: number): string { let hash = 0; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; } // 转换为十六进制并填充到指定长度 let result = Math.abs(hash).toString(16); while (re...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left simpleHash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
private simpleHash(str: string, length: number): string { let hash = 0; for (let i = 0; i < str.length; i++) { const char = str.charCodeAt(i); hash = ((hash << 5) - hash) + char; hash = hash & hash; } // 转换为十六进制并填充到指定长度 let result = Math.abs(hash).toString(16); while (re...
https://github.com/DaLongZhuaZi/manxia
7cef50f069d7201b0f122bce411ac8b68424553b
github
arkui-x/samples
CodeLab/Cases/feature/clickanimation/src/main/ets/model/BasicDataSource.ets
arkts
notifyDataAdd
通知控制器数据增加 @param index 数组索引
notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
notifyDataAdd(index: number): void { this.listeners.forEach((listener: DataChangeListener) => { listener.onDataAdd(index); }) }
https://gitcode.com/arkui-x/samples
b9b13fb16a96e9d2566a591bf8fe2c6e7c464655
gitcode
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
get
读取键值,若不存在返回默认值 @param {string} key 键 @param {preferences.ValueType} defaultValue 默认值 @returns {Promise<preferences.ValueType>} 读取到的值
async get(key: string, defaultValue: preferences.ValueType): Promise<preferences.ValueType> { try { const prefs: preferences.Preferences = await this.getPrefs(); return prefs.get(key, defaultValue); } catch (error) { throw this.wrapError(error, `读取键 ${key} 失败`); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#get#Left get AST#get#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
async get(key: string, defaultValue: preferences.ValueType): Promise<preferences.ValueType> { try { const prefs: preferences.Preferences = await this.getPrefs(); return prefs.get(key, defaultValue); } catch (error) { throw this.wrapError(error, `读取键 ${key} 失败`); } }
https://github.com/Joker-x-dev/CoolMallArkTS
003fe59b0939f450349227c1139a8cbab8f441a5
github
erosTeam/NextE
shared/src/main/ets/network/EhApiService.ets
arkts
getGalleryTorrents
Fetch the torrent list for a gallery (eros_fe getTorrent / gallerytorrents.php).
async getGalleryTorrents( gid: string, token: string, isEx: boolean, ): Promise<EhGalleryTorrentList> { const url: string = `${EhConstants.baseUrl(isEx)}/gallerytorrents.php?gid=${gid}&t=${token}` const resp = await this.fetch(url, isEx, 'generic') return EhGalleryTorrentParser.parse(resp.bo...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGalleryTorrents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gid AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async getGalleryTorrents( gid: string, token: string, isEx: boolean, ): Promise<EhGalleryTorrentList> { const url: string = `${EhConstants.baseUrl(isEx)}/gallerytorrents.php?gid=${gid}&t=${token}` const resp = await this.fetch(url, isEx, 'generic') return EhGalleryTorrentParser.parse(resp.bo...
https://github.com/erosTeam/NextE
386eda5067e2db9c115c99ee4c4158b14efa0ca2
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaBuilder.ets
arkts
generateAllCreateTableSql
生成所有已注册实体的 CREATE TABLE SQL 语句 @returns SQL 语句数组
generateAllCreateTableSql(includeJoinTables: boolean = false): Array<string> { const storage = MetadataStorage.getInstance() const entities = storage.getAllEntities() const sqlStatements: Array<string> = [] for (let i = 0; i < entities.length; i++) { const sql = this.generateCreateTableSql(enti...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left generateAllCreateTableSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left includeJoinTables AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assign...
generateAllCreateTableSql(includeJoinTables: boolean = false): Array<string> { const storage = MetadataStorage.getInstance() const entities = storage.getAllEntities() const sqlStatements: Array<string> = [] for (let i = 0; i < entities.length; i++) { const sql = this.generateCreateTableSql(enti...
https://github.com/offlinecat-dev/OCNetORM
5e9734e274e9b5bebb89cc08138ebd93a3b46608
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/HealthQuerySkill.ets
arkts
extractDataType
从查询语句中提取数据类型
private static extractDataType(query: string): HealthDataType { if (query.includes('血压')) return 'blood_pressure'; if (query.includes('血糖')) return 'blood_glucose'; if (query.includes('心率') || query.includes('心跳') || query.includes('脉搏')) return 'heart_rate'; if (query.includes('体重')) return 'weight';...
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 extractDataType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Lef...
private static extractDataType(query: string): HealthDataType { if (query.includes('血压')) return 'blood_pressure'; if (query.includes('血糖')) return 'blood_glucose'; if (query.includes('心率') || query.includes('心跳') || query.includes('脉搏')) return 'heart_rate'; if (query.includes('体重')) return 'weight';...
https://github.com/LJ666-ui/harmony-health-care
61dffeb2df1480052b1e39fa287e8428dc03c32e
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/FootprintRepository.ets
arkts
removeFootprint
根据商品ID删除足迹记录 @param {number} goodsId 商品ID @returns {Promise<void>} Promise<void>
removeFootprint(goodsId: number): Promise<void> { return this.dataSource.removeFootprint(goodsId); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left removeFootprint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
removeFootprint(goodsId: number): Promise<void> { return this.dataSource.removeFootprint(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS
ef53a41056de92cd11c543f30713f65a578bcfda
github
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets
arkts
setExposurePoint
设置曝光区域中心点
setExposurePoint(result: MethodResult, point: Point) { const exposurePointFeature: ExposurePointFeature = this.cameraFeatures.getExposurePoint(); exposurePointFeature.setValue(point); const exposurePoint: camera.Point | null = (point.x == null || point.y == null) ? null : { x: point.x, y: point.y }...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setExposurePoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodResult AST#ident...
setExposurePoint(result: MethodResult, point: Point) { const exposurePointFeature: ExposurePointFeature = this.cameraFeatures.getExposurePoint(); exposurePointFeature.setValue(point); const exposurePoint: camera.Point | null = (point.x == null || point.y == null) ? null : { x: point.x, y: point.y }...
https://gitee.com/openharmony-sig/flutter_packages.git
28a6a088568adb38602d0bc279f6e79cddd020b0
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
addMessagePartsJsonColumnIfNeeded
添加 parts_json 字段(消息有序 parts 的 JSON 持久化)
private async addMessagePartsJsonColumnIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.MESSAGES} ADD COLUMN parts_json TEXT DEFAULT ''`) } catch (error) { console.info('DatabaseService', 'parts_json col...
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 addMessagePartsJsonColumnIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_...
private async addMessagePartsJsonColumnIfNeeded(): Promise<void> { if (this.rdbStore === null) { return } try { await this.rdbStore.executeSql(`ALTER TABLE ${TableNames.MESSAGES} ADD COLUMN parts_json TEXT DEFAULT ''`) } catch (error) { console.info('DatabaseService', 'parts_json col...
https://github.com/LongLiveY96/chatcube
76ef8a410ea45e9fee5dd40c267c17dd8434d0cb
github
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
previewOutputCallBack
监听预览事件
previewOutputCallBack(previewOutput: camera.PreviewOutput): void { Logger.info(TAG, 'previewOutputCallBack is called'); try { previewOutput.on('frameStart', (): void => { Logger.debug(TAG, 'Preview frame started'); AppStorage.setOrCreate('frameStart', ++this.frameStartFlag); }); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left previewOutputCallBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left previewOutput AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left camera AST#ide...
previewOutputCallBack(previewOutput: camera.PreviewOutput): void { Logger.info(TAG, 'previewOutputCallBack is called'); try { previewOutput.on('frameStart', (): void => { Logger.debug(TAG, 'Preview frame started'); AppStorage.setOrCreate('frameStart', ++this.frameStartFlag); }); ...
https://gitee.com/openharmony/multimedia_camera_framework.git
0a59e3a99419fa17c4c74dea1e608ef3bd4a9eab
gitee
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/repository/ChatRepository.ets
arkts
extractPoiData
Extract POI data from tool message
private extractPoiData(toolMessage?: ChatApiResponseMessage): PoiData[] | undefined { if (!toolMessage?.artifact?.nearby_search_response) { return undefined; } try { const nearbySearchData = toolMessage.artifact.nearby_search_response; console.log("[Nearby Search Data]:", JSON.stringify...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractPoiData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toolMessage AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AS...
private extractPoiData(toolMessage?: ChatApiResponseMessage): PoiData[] | undefined { if (!toolMessage?.artifact?.nearby_search_response) { return undefined; } try { const nearbySearchData = toolMessage.artifact.nearby_search_response; console.log("[Nearby Search Data]:", JSON.stringify...
https://github.com/somnio-software/my-bot-pal
a8363e2d06752b870cfbc74f6d723473e44f8a5e
github
openharmony-sig/earth
hpauditor/tests/issues/issue25.ets
arkts
foo1
1. Dynamically creating a class. Each time foo1 is invoked, class Add and Sub are recreated, affecting memory and performance.
function foo1(f: boolean): number { if (f) { class Add { operand1: number; operand2: number; constructor(operand1: number, operand2: number) { this.operand1 = operand1; this.operand2 = operand2; } add(): number { return this.operand1 + this.operand2; }...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left f AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#pred...
function foo1(f: boolean): number { if (f) { class Add { operand1: number; operand2: number; constructor(operand1: number, operand2: number) { this.operand1 = operand1; this.operand2 = operand2; } add(): number { return this.operand1 + this.operand2; }...
https://gitee.com/openharmony-sig/earth.git
95f13623a9a1967ee26b91b2a832e7f4d8b05ce8
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
mergeRecentFileLists
合并最近文件列表 @param localFiles 本地文件列表 @param remoteFiles 远端文件列表 @returns 合并后的文件列表
public static mergeRecentFileLists(localFiles: RecentFile[], remoteFiles: RecentFile[]): RecentFile[] { const fileMap = new Map<string, RecentFile>(); // 添加本地文件(优先级更高) localFiles.forEach(file => { if (file.filePath) { fileMap.set(file.filePath, 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 mergeRecentFileLists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left localFiles AST#identifier#Right AS...
public static mergeRecentFileLists(localFiles: RecentFile[], remoteFiles: RecentFile[]): RecentFile[] { const fileMap = new Map<string, RecentFile>(); // 添加本地文件(优先级更高) localFiles.forEach(file => { if (file.filePath) { fileMap.set(file.filePath, file); } }); // 添加远端文件(如果不存在则添加...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L307-L348
049baf46f36eaa8e7ec794bce9cc32686163f8aa
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/local/LocalFileStorage.ets
arkts
listDir
获取目录内容 @param path @returns
public listDir(path: string): Promise<FileInfo[]> { throw new StorageError(StorageErrorCodes.NOT_IMPLEMENTED); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left listDir 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 A...
public listDir(path: string): Promise<FileInfo[]> { throw new StorageError(StorageErrorCodes.NOT_IMPLEMENTED); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L187-L189
f737f0db86e27cfd87a630d1baa778f163cc6638
github
XJTUWYD/ArkDiff
entry/src/main/ets/engine/DiffEngine.ets
arkts
selectAndRunAlgorithm
========== 算法选择 ==========
private static selectAndRunAlgorithm(linesA: string[], linesB: string[]): LcsResult { const m = linesA.length; const n = linesB.length; if (m <= LCS_MAX_LINES && n <= LCS_MAX_LINES) { return LcsEngine.compute(linesA, linesB); } return MyersEngine.compute(linesA, linesB); }
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 selectAndRunAlgorithm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left linesA AST#identifier#Right AS...
private static selectAndRunAlgorithm(linesA: string[], linesB: string[]): LcsResult { const m = linesA.length; const n = linesB.length; if (m <= LCS_MAX_LINES && n <= LCS_MAX_LINES) { return LcsEngine.compute(linesA, linesB); } return MyersEngine.compute(linesA, linesB); }
https://github.com/XJTUWYD/ArkDiff
8de6e2beaee8a72d8f3fb599c5a4b25669a2c091
github
openharmony/applications_contacts
entry/src/main/ets/presenter/dialer/DialerPresenter.ets
arkts
pressVibrate
Key vibration
pressVibrate() { }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pressVibrate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
pressVibrate() { }
https://gitee.com/openharmony/applications_contacts.git
31dfd631a6db2ab6cf8d293f572b3e0d4a97e03b
gitee
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/events/EventsProcessor.ets
arkts
updateEventWithInstance
更新 Event,并同步更新 Instance @param rdbStore rdb数据库 @param uri DataShare的uri @param values 更新的数据 @param predicates 更新条件 @param callback 回调方法
async updateEventWithInstance(rdbStore: data_rdb.RdbStore, uri: string, values: data_rdb.ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: Function) { let needUpdatedEventIds: Array<number>; if (isNeedRefreshInstances(values)) { needUpdatedEvent...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateEventWithInstance AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#type_annotat...
async updateEventWithInstance(rdbStore: data_rdb.RdbStore, uri: string, values: data_rdb.ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: Function) { let needUpdatedEventIds: Array<number>; if (isNeedRefreshInstances(values)) { needUpdatedEvent...
https://gitee.com/openharmony/applications_calendar_data.git
88e4e90f81a02a204f1cbd956170312cc4270f85
gitee
erosTeam/NextE
shared/src/main/ets/constants/EhConstants.ets
arkts
cats
Category name → bitmask (eros_fe EHConst.cats). Lazily built once.
static cats(): Map<string, number> { if (EhConstants.catsMap === null) { const m: Map<string, number> = new Map<string, number>() m.set('Misc', 1) m.set('Doujinshi', 2) m.set('Manga', 4) m.set('Artist CG', 8) m.set('Game CG', 16) m.set('Image Set', 32) m.set('Cospla...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left cats AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Righ...
static cats(): Map<string, number> { if (EhConstants.catsMap === null) { const m: Map<string, number> = new Map<string, number>() m.set('Misc', 1) m.set('Doujinshi', 2) m.set('Manga', 4) m.set('Artist CG', 8) m.set('Game CG', 16) m.set('Image Set', 32) m.set('Cospla...
https://github.com/erosTeam/NextE
25be318102d186764ee09054f9b968d81c375322
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/CloudSyncService.ets
arkts
detectAndResolveConflict
简单冲突检测:比较 incoming.updatedAt 与 existing.updatedAt 返回 ConflictInfo(如果存在冲突)或 null(无冲突)
private static detectAndResolveConflict( dataType: string, localId: number, cloudId: number, existingTimestamp: string, incomingTimestamp: string ): ConflictInfo | null { try { if (existingTimestamp === '' || incomingTimestamp === '') { return null; } const existing...
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 detectAndResolveConflict AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataType AST#identifier#Right AST#ERROR#Le...
private static detectAndResolveConflict( dataType: string, localId: number, cloudId: number, existingTimestamp: string, incomingTimestamp: string ): ConflictInfo | null { try { if (existingTimestamp === '' || incomingTimestamp === '') { return null; } const existing...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a5070565ff9f6f8af0823b2f89714dc6868dd22f
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
handleScrollEndForBottomBar
处理滚动结束事件,自动完成底栏的显示/隐藏
private handleScrollEndForBottomBar(): void { if (!this.mainPageBottomBarAnimationEnabled) { this.resetBottomBarScrollState(); return; } if (this.useTopTabsNavigation || this.isOverlayBottomNavTab(this.currentTabIndex)) { this.resetBottomBarScrollState(); return; } this.se...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleScrollEndForBottomBar 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#Le...
private handleScrollEndForBottomBar(): void { if (!this.mainPageBottomBarAnimationEnabled) { this.resetBottomBarScrollState(); return; } if (this.useTopTabsNavigation || this.isOverlayBottomNavTab(this.currentTabIndex)) { this.resetBottomBarScrollState(); return; } this.se...
https://github.com/DaLongZhuaZi/manxia
edf6c9ff5000ce6e6da3b55d15086b43ba89f2da
github
YANGZX22/Voot
entry/src/main/ets/services/PipSubtitleManager.ets
arkts
init
Initialize PiP controller @param ctx - UIAbilityContext @param uiContext - UIContext @param contentHeight - Initial content height for PiP window in pixels (default: 200)
async init(ctx: common.UIAbilityContext, uiContext: UIContext, contentHeight: number = 200): Promise<boolean> { if (this.isInitialized) { console.info(`${TAG} Already initialized`); return true; } if (!this.isPipEnabled()) { console.error(`${TAG} PiP is disabled on this device`); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annota...
async init(ctx: common.UIAbilityContext, uiContext: UIContext, contentHeight: number = 200): Promise<boolean> { if (this.isInitialized) { console.info(`${TAG} Already initialized`); return true; } if (!this.isPipEnabled()) { console.error(`${TAG} PiP is disabled on this device`); ...
https://github.com/YANGZX22/Voot
2117dacfd44e9e2aefea12c20704d4579044496b
github
openharmony-sig/fluttertpc_qr_code_scanner
ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets
arkts
stopCamera
切换前置后置前释放相机流
stopCamera(): Promise<void> { return this.photoSession!.stop().then(() => { this.isStop = true; }); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left stopCamera 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#ide...
stopCamera(): Promise<void> { return this.photoSession!.stop().then(() => { this.isStop = true; }); }
https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git
2c7468667be5dee2f70c2efa39ae4f1b1a7c758b
gitee
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
getInstance
Get instance of treeListenerManagerV2. @return treeListenerManagerV2 instance. @static @syscap SystemCapability.ArkUI.ArkUI.Full @since 26
static getInstance(): TreeListenerManagerV2 { if (AppStorage.Get('app_key_event_bus_v2') === undefined) { AppStorage.SetOrCreate('app_key_event_bus_v2', new TreeListenerManagerV2()) } return AppStorage.Get('app_key_event_bus_v2') as TreeListenerManagerV2; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left TreeListen...
static getInstance(): TreeListenerManagerV2 { if (AppStorage.Get('app_key_event_bus_v2') === undefined) { AppStorage.SetOrCreate('app_key_event_bus_v2', new TreeListenerManagerV2()) } return AppStorage.Get('app_key_event_bus_v2') as TreeListenerManagerV2; }
https://gitcode.com/openharmony/arkui_ace_engine
0606fda34461d308364a6d0706838c0672da1e4c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/ShareExtAbility/ShareExtAbility.ets
arkts
showToast
显示Toast提示
private showToast(message: string, session: UIExtensionContentSession): void { try { logger.info(TAG, `Toast: ${message}`); // 注意:在ShareExtensionAbility中,Toast显示需要特殊处理 // 这里记录日志,实际提示会在主应用中显示 } catch (error) { logger.error(TAG, '显示Toast失败', String(error)); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
private showToast(message: string, session: UIExtensionContentSession): void { try { logger.info(TAG, `Toast: ${message}`); // 注意:在ShareExtensionAbility中,Toast显示需要特殊处理 // 这里记录日志,实际提示会在主应用中显示 } catch (error) { logger.error(TAG, '显示Toast失败', String(error)); } }
https://github.com/DaLongZhuaZi/manxia
afc9cc7976952463a7f31968154ae5cf0422caec
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
checkPreload
检查是否需要预加载
checkPreload(index: number): void { // 当滚动到当前页的第60-70个时,静默加载下一批 const threshold = (this.currentPage - 1) * PAGE_SIZE + PRELOAD_THRESHOLD; if (index >= threshold && this.hasMoreData && !this.isLoadingMore) { logger.debug(TAG, `触发预加载: index=${index}, threshold=${threshold}`); this.loadMoreSource...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkPreload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A...
checkPreload(index: number): void { // 当滚动到当前页的第60-70个时,静默加载下一批 const threshold = (this.currentPage - 1) * PAGE_SIZE + PRELOAD_THRESHOLD; if (index >= threshold && this.hasMoreData && !this.isLoadingMore) { logger.debug(TAG, `触发预加载: index=${index}, threshold=${threshold}`); this.loadMoreSource...
https://github.com/DaLongZhuaZi/manxia
2f4fae87c86d78b6df16adf03ff75d04d2ee5893
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
exec
Executes a search for a match in a specified string and returns a result array @param { String } str The string to match. @returns { RegExpExecArray | null } If match succeeds, returns an array containing match results, otherwise returns null. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public exec(str: String): RegExpExecArray | null { return this.exec(str, this.lastIndex) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left exec AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifie...
public exec(str: String): RegExpExecArray | null { return this.exec(str, this.lastIndex) }
https://gitcode.com/iop123123/arkts-static-skills
4dcc40f7dd8910081e5d2984874bf3d16784874f
gitcode
Countly/countly-sdk-hos
library/src/ohosTest/ets/test/Consent.test.ets
arkts
<arrow>
DeviceIdApi
async (): Promise<void> => { await h.instance.deviceId.setID('post_halt_id'); },
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#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_type#Left AST#type_identifier#Left Promise AST#type_identifi...
async (): Promise<void> => { await h.instance.deviceId.setID('post_halt_id'); },
https://github.com/Countly/countly-sdk-hos
ed8351d5340509437b367f74b997a18b762e6439
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createUhidCreate
============ TYPE_UHID_CREATE (12) ============ 格式: type(1) + id(2) + vendorId(2) + productId(2) + nameLen(1) + name(N) + reportDescLen(2) + reportDesc(M)
static createUhidCreate( id: number, vendorId: number, productId: number, name: string, reportDesc: Uint8Array ): ArrayBuffer { const nameBytes = buffer.from(name, 'utf-8'); const nameData = new Uint8Array(nameBytes.buffer); const nameLen = Math.min(nameData.byteLength, 127); con...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createUhidCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static createUhidCreate( id: number, vendorId: number, productId: number, name: string, reportDesc: Uint8Array ): ArrayBuffer { const nameBytes = buffer.from(name, 'utf-8'); const nameData = new Uint8Array(nameBytes.buffer); const nameLen = Math.min(nameData.byteLength, 127); con...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
81d0c8341938c6c5931bc76f351cdd369bee34cd
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardBuilder.ets
arkts
appendIms
todo 格式?
public appendIms(iContact: contact.Contact): VCardBuilder { if (iContact != null) { //todo 需要每一个循环一遍 let imAddrs = iContact.imAddresses if (imAddrs) { for (let imaddr of imAddrs) { let protocolAsObj:ESObject = imaddr.labelId ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left appendIms AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iContact AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#...
public appendIms(iContact: contact.Contact): VCardBuilder { if (iContact != null) { //todo 需要每一个循环一遍 let imAddrs = iContact.imAddresses if (imAddrs) { for (let imaddr of imAddrs) { let protocolAsObj:ESObject = imaddr.labelId ...
https://gitee.com/openharmony-tpc/VCard.git
16b371b628990ecb6e9a5ec5fe62c9ecd2d9afac
gitee
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGManager.ets
arkts
getFilePath
获取data路径 @param onSuccess 路径数据回调
public getFilePath(onSuccess: (filesDir: string) => void): void { let filesDir: string = GlobalContext.getContext().getObject("filesDir") as string onSuccess(filesDir); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left getFilePath AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left onSuccess AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#...
public getFilePath(onSuccess: (filesDir: string) => void): void { let filesDir: string = GlobalContext.getContext().getObject("filesDir") as string onSuccess(filesDir); }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
aa6bf2b77612888164759638075101644bef34d8
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
cycleNextProfile
循环切换到下一个配置,并返回切换后的配置
static async cycleNextProfile(): Promise<CustomKeyProfile | null> { await CustomKeyStore.ensureInit(); if (CustomKeyStore.profiles!.length <= 1) return null; const currentIdx = CustomKeyStore.profiles!.findIndex(p => p.name === CustomKeyStore.activeProfileName); const nextIdx = (currentIdx + 1) % Cust...
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 cycleNextProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
static async cycleNextProfile(): Promise<CustomKeyProfile | null> { await CustomKeyStore.ensureInit(); if (CustomKeyStore.profiles!.length <= 1) return null; const currentIdx = CustomKeyStore.profiles!.findIndex(p => p.name === CustomKeyStore.activeProfileName); const nextIdx = (currentIdx + 1) % Cust...
https://github.com/AlkaidLab/moonlight-harmony
2fbab65ffd8b93c56acfb3753adc033db80e6efd
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleSessionFactory.ets
arkts
buildReviewPlan
Build a focused review plan from today's stable review snapshot. Already-reviewed ids are skipped so returning to review mode only shows the remaining daily work (moved from BattlePage.buildReviewPlan).
function buildReviewPlan( dailyStateService: DailyLearningStateService, universe: WordEntry[], ): TodaySessionPlan { const plan: TodaySessionPlan = new TodaySessionPlan(); plan.regionId = 'review-daily'; plan.isFirstToday = false; const daily: DailyLearningState = dailyStateService.snapshot(); const revie...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildReviewPlan AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dailyStateService AST#identifier#Right AST#type_annotation#Left AST#:#...
function buildReviewPlan( dailyStateService: DailyLearningStateService, universe: WordEntry[], ): TodaySessionPlan { const plan: TodaySessionPlan = new TodaySessionPlan(); plan.regionId = 'review-daily'; plan.isFirstToday = false; const daily: DailyLearningState = dailyStateService.snapshot(); const revie...
https://github.com/terryma2024/happyword
3c65dba5c9145e6e03df4a6a2cb9f4646da68fb4
github
killetom/ktretrofit
entry/src/main/ets/example/RetrofitConfigExample.ets
arkts
createUserExample
Create a new user
createUserExample(userData: CreateUserRequest): User { try { const userService = this.createUserService(); const call = userService.createUser(userData); const response = call.execute(); console.log('User created successfully:', response.body); return response.getNotNullBody(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createUserExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CreateUserRequest AST#identifier#R...
createUserExample(userData: CreateUserRequest): User { try { const userService = this.createUserService(); const call = userService.createUser(userData); const response = call.execute(); console.log('User created successfully:', response.body); return response.getNotNullBody(...
https://github.com/killetom/ktretrofit
9ec164c7d25f6ae42f01f9464c6f374130a27cbc
github
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/model/User.ets
arkts
getId
========================================== Getter 和 Setter 方法 ==========================================
public getId(): number { return this.id; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getId 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...
public getId(): number { return this.id; }
https://gitcode.com/openharmony/codelabs
6cb7de65bb7ab60347fb6b2233fff5daf2a91e55
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
onScreenLocked
Handle screen lock
async onScreenLocked(): Promise<void> { if (!isSessionActive) { return; } console.info(`${TAG}: Screen locked`); sessionIsScreenLocked = true; // Start background service if not already running if (backgroundService && !RdpBackgroundService.isServiceRunning()) { await bac...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onScreenLocked AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ...
async onScreenLocked(): Promise<void> { if (!isSessionActive) { return; } console.info(`${TAG}: Screen locked`); sessionIsScreenLocked = true; // Start background service if not already running if (backgroundService && !RdpBackgroundService.isServiceRunning()) { await bac...
https://github.com/tangwengang-del/freerdp-harmonyos
ba2f3dde655f96402a8d72c5a0201168508a75b2
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/coupon/CouponCard.ets
arkts
build
构建优惠券卡片 @returns {void} 无返回值
build(): void { Column() { Card() { this.CouponMainContent(); } } .width(P100) .opacity(this.isUnavailable(this.getCouponStatus()) ? 0.6 : 1); }
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 { Column() { Card() { this.CouponMainContent(); } } .width(P100) .opacity(this.isUnavailable(this.getCouponStatus()) ? 0.6 : 1); }
https://github.com/Joker-x-dev/CoolMallArkTS
71e4f6fb8d53597492a224ccec5f5d067f4abb43
github
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
setGlobalDnsOption
为默认的网络下载设置全局的自定义Dns规则 @param dnsOption 自定义Dns配置项
setGlobalDnsOption(dnsOption: DnsOption) { nativeNode.setGlobalDnsOption(dnsOption); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setGlobalDnsOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dnsOption AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DnsOption AST#ide...
setGlobalDnsOption(dnsOption: DnsOption) { nativeNode.setGlobalDnsOption(dnsOption); }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L299-L301
54625f80096968eaf459f4180c0082592d228610
gitcode
openharmony/arkui_ace_engine
examples/EventProject/entry/src/main/ets/pages/springloading/SpringLoading.ets
arkts
build
[End springLoading_handleSpringLoading] [Start springLoading_example]
build() { Column() { //[StartExclude springLoading_example] //[StartExclude SpringLoading_start] NavDestination() { //[EndExclude SpringLoading_start] //[EndExclude springLoading_example] Column() { // 请将$r('app.string.DoubleClick_Text')替换为实际资源文件,在本示例中该资源文件的valu...
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() { Column() { //[StartExclude springLoading_example] //[StartExclude SpringLoading_start] NavDestination() { //[EndExclude SpringLoading_start] //[EndExclude springLoading_example] Column() { // 请将$r('app.string.DoubleClick_Text')替换为实际资源文件,在本示例中该资源文件的valu...
https://gitcode.com/openharmony/arkui_ace_engine
edaca99058b5148ea9ab9c2b936be94b8b5ef8a6
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/InputProcessor.ets
arkts
updateStickMappings
更新摇杆轴映射配置 @param mappings 新的摇杆映射配置
updateStickMappings(mappings: StickAxisMapping[]): void { this.stickMappings = mappings }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateStickMappings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mappings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left St...
updateStickMappings(mappings: StickAxisMapping[]): void { this.stickMappings = mappings }
https://github.com/richshaw2015/nds
4f9a961f8e4e521b58d64dd4fbd6a458850ad51c
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
set_timing
设置定时 //
set_timing(time_ms: number) { // 0 或负数 = 取消定时 if (time_ms <= 0) { this.target_timed = 0 this.send_timing() // 通知前端定时已取消 return } this.target_timed = Date.now() + time_ms }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left set_timing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left time_ms AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#L...
set_timing(time_ms: number) { // 0 或负数 = 取消定时 if (time_ms <= 0) { this.target_timed = 0 this.send_timing() // 通知前端定时已取消 return } this.target_timed = Date.now() + time_ms }
https://github.com/Nekofox-POT/LinMusic
600f4e51d74d04e225e1973ccb30a0c2f78710b5
github
LZZLHY/hlib
entry/src/main/ets/utils/SecretStore.ets
arkts
decrypt
解密:cipher 必须以 "sec1:" 开头,否则视为旧明文原样返回。
static async decrypt(input: string): Promise<string> { if (input.length === 0 || !input.startsWith(CIPHER_PREFIX)) { return input; } if (!SecretStore.usable) { // master key 不可用:旧 cipher 没办法解,回退空(避免把 sec1:xxx 直接当用户名) Logger.w(TAG, 'decrypt skipped: HUKS not usable'); return ''; ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left decrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Ri...
static async decrypt(input: string): Promise<string> { if (input.length === 0 || !input.startsWith(CIPHER_PREFIX)) { return input; } if (!SecretStore.usable) { // master key 不可用:旧 cipher 没办法解,回退空(避免把 sec1:xxx 直接当用户名) Logger.w(TAG, 'decrypt skipped: HUKS not usable'); return ''; ...
https://github.com/LZZLHY/hlib
9f7d8092429b900e63539b17a55211782ad36735
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SettingsManager.ets
arkts
setDuplicateDetectionThreshold
设置重复检测相似度阈值
async setDuplicateDetectionThreshold(threshold: number): Promise<void> { await this.setNumber(SettingKeys.DUPLICATE_DETECTION_THRESHOLD, threshold); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setDuplicateDetectionThreshold AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#ide...
async setDuplicateDetectionThreshold(threshold: number): Promise<void> { await this.setNumber(SettingKeys.DUPLICATE_DETECTION_THRESHOLD, threshold); }
https://github.com/DaLongZhuaZi/manxia
ed4da4baf804a2ca1683080f688ed5126c9ea8cc
github
dingzhilin1990/zhilinclaw
src/core/ZhiLinClawCore.ets
arkts
dispatchToSkills
分发请求到技能处理器
private async dispatchToSkills(input: string): Promise<string> { // 获取所有已注册的技能 const skills = this.skillRegistry.getAllSkills(); // 简单的意图识别(实际项目中应该使用 AI 模型) for (const skill of skills) { if (skill.match(input)) { this.log(`匹配到技能:${skill.name}`); return await skill.execute(in...
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 dispatchToSkills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Lef...
private async dispatchToSkills(input: string): Promise<string> { // 获取所有已注册的技能 const skills = this.skillRegistry.getAllSkills(); // 简单的意图识别(实际项目中应该使用 AI 模型) for (const skill of skills) { if (skill.match(input)) { this.log(`匹配到技能:${skill.name}`); return await skill.execute(in...
https://github.com/dingzhilin1990/zhilinclaw
33a46ea2b5d86dd2c55cb6587073c64519adbbe3
github
PollenWang6/HiXD
entry/src/main/ets/services/AttendanceService.ets
arkts
parseCourseInfo
===== 解析课程列表 HTML =====
private parseCourseInfo(html: string): CourseInfo[] { const results: CourseInfo[] = []; const seen: Set<string> = new Set(); // 提取学期 const yearRe: RegExp = /<select[^>]*id="yearList"[^>]*>([\s\S]*?)<\/select>/; const yearMatch= html.match(yearRe); if (yearMatch !== null) { const optRe: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseCourseInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private parseCourseInfo(html: string): CourseInfo[] { const results: CourseInfo[] = []; const seen: Set<string> = new Set(); // 提取学期 const yearRe: RegExp = /<select[^>]*id="yearList"[^>]*>([\s\S]*?)<\/select>/; const yearMatch= html.match(yearRe); if (yearMatch !== null) { const optRe: ...
https://github.com/PollenWang6/HiXD
09737fc80df5a9690c4e7b21765712f54772905c
github
the-wwyang/kids-learning-app
src/main/ets/services/ProfileService.ets
arkts
getProfileById
根据ID获取档案
public async getProfileById(profileId: string): Promise<UserProfile | null> { const profiles = await this.getAllProfiles(); return profiles.find(p => p.id === profileId) || null; }
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 getProfileById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left profileId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async getProfileById(profileId: string): Promise<UserProfile | null> { const profiles = await this.getAllProfiles(); return profiles.find(p => p.id === profileId) || null; }
https://github.com/the-wwyang/kids-learning-app
daac3644305734155544c973794e7460a700bcbc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
replaceChar
Creates a String using substitutions @param d a template @param substs strings to be substituted @returns string with respected data being substituted TODO(ivan-tyulyandin): uncomment when #12735 will be fixed public static raw(d: String, substs: ...String): String { throw new Error("String.raw: not implemented") } Rep...
public replaceChar(oldCh: char, newCh: char): String { let newChars: char[] = this.getChars(); for (let i: int = 0; i < newChars.length; i++) { if (newChars[i] == oldCh) { newChars[i] = newCh; } } return new String(newChars); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left oldCh AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier...
public replaceChar(oldCh: char, newCh: char): String { let newChars: char[] = this.getChars(); for (let i: int = 0; i < newChars.length; i++) { if (newChars[i] == oldCh) { newChars[i] = newCh; } } return new String(newChars); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3e2c96e16bcf256eb71042b380f8bb41c3145e36
gitee
HarmonyOS_Samples/guide-snippets
ArkGraphics3D/entry/src/main/ets/material/pbr_clearcoat.ets
arkts
changeClearcoatTex
Switch between available textures for the clearcoat layer [Start pbr_clearcoat_changeClearcoatTexture]
changeClearcoatTex() { if (this.textures.length > 0) { let i = ++this.textureInUse % this.textures.length; (this.material as MetallicRoughnessMaterial).clearCoat.image = this.textures[i]; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeClearcoatTex 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...
changeClearcoatTex() { if (this.textures.length > 0) { let i = ++this.textureInUse % this.textures.length; (this.material as MetallicRoughnessMaterial).clearCoat.image = this.textures[i]; } }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
8ca9c3b9d6164efc7817688a883f4f40eb280761
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
loadSingleSetting
加载单个设置值 @param key 设置键名 @param type 设置类型 @returns 设置值或 undefined
private async loadSingleSetting(key: string, type: SettingType): Promise<SettingValue | undefined> { if (!this.dataPreferences) return undefined; try { const hasKey = await this.dataPreferences.has(key); if (!hasKey) { return undefined; } switch (type) { case SettingT...
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 loadSingleSetting AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left...
private async loadSingleSetting(key: string, type: SettingType): Promise<SettingValue | undefined> { if (!this.dataPreferences) return undefined; try { const hasKey = await this.dataPreferences.has(key); if (!hasKey) { return undefined; } switch (type) { case SettingT...
https://github.com/richshaw2015/nds
a649b9f2de38844cf6249b67990003361478d76a
github
harmonyos/codelabs
HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets
arkts
play
Play music.
public async play() { Logger.info(TAG, 'AVPlayer play() isPrepared:' + this.isPrepared + ', state:' + this.state); BackgroundUtil.startContinuousTask(this.context); if (!this.isPrepared) { this.start(0); } else if (this.avPlayer) { this.avPlayer.play().then(() => { Logger.info(TAG,...
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 play AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right...
public async play() { Logger.info(TAG, 'AVPlayer play() isPrepared:' + this.isPrepared + ', state:' + this.state); BackgroundUtil.startContinuousTask(this.context); if (!this.isPrepared) { this.start(0); } else if (this.avPlayer) { this.avPlayer.play().then(() => { Logger.info(TAG,...
https://gitee.com/harmonyos/codelabs.git
2fb47f03ab28090114fee7c1e0d2738f50e7467e
gitee
openharmony-tpc/VCard
library/src/main/ets/components/VCardParserImpl_V30.ets
arkts
handleParams
vCard 3.0 allows iana-token as paramType, while vCard 2.1 does not.
protected handleParams(propertyData:VCardProperty , params:string ):void{ try { super.handleParams(propertyData, params); } catch (e) { // maybe IANA type let strArray:Array<string> = params.split("=", 2); if (strArray.length == 2) { su...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left propertyData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
protected handleParams(propertyData:VCardProperty , params:string ):void{ try { super.handleParams(propertyData, params); } catch (e) { // maybe IANA type let strArray:Array<string> = params.split("=", 2); if (strArray.length == 2) { su...
https://gitee.com/openharmony-tpc/VCard.git
d1b2529d927691711220745c079166c2dab7efb3
gitee
xblLab/HarmonyProjectTemplate
components/module_feedback/src/main/ets/common/MediaUtils.ets
arkts
selectMedia
用系统picker,拉起相册或者相机 @param params @returns
public static selectMedia(maxSelectNumber: number): Promise<string[]> { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = maxSelectNumber; let uris: string[] = []; ...
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 selectMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxSelectNumber AST#identifier#Right AST#ERROR#Left AST#:#...
public static selectMedia(maxSelectNumber: number): Promise<string[]> { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = maxSelectNumber; let uris: string[] = []; ...
https://github.com/xblLab/HarmonyProjectTemplate
83657646e67dd313a8f5382211604170afdb1943
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/AccountKitService.ets
arkts
loadFromDisk
从 Preferences 加载凭据
private async loadFromDisk(): Promise<void> { if (!this.dataPreferences) { return; } try { const raw: string = this.dataPreferences.getSync(KEY_CREDENTIAL, '') as string; if (raw !== '') { this.credential = JSON.parse(raw) as StoredCredential; } } catch (err) { hilog.error(...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadFromDisk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async loadFromDisk(): Promise<void> { if (!this.dataPreferences) { return; } try { const raw: string = this.dataPreferences.getSync(KEY_CREDENTIAL, '') as string; if (raw !== '') { this.credential = JSON.parse(raw) as StoredCredential; } } catch (err) { hilog.error(...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
e26f0fedadbb9dca0828c87a893fd5a7e75d99d0
github
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
ignoreBy
设置忽略压缩的文件大小阈值 @param sizeInKB 文件大小阈值(KB) @returns 构建器实例
ignoreBy(sizeInKB: number): LubanBuilder { this.config.ignoreBy = sizeInKB; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ignoreBy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sizeInKB AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ...
ignoreBy(sizeInKB: number): LubanBuilder { this.config.ignoreBy = sizeInKB; return this; }
https://github.com/kumaleap/ArkLuban
a7533c44f9dd7638b5d08cb33be71e691afe3470
github
LZZLHY/hlib
entry/src/main/ets/storage/AuthStore.ets
arkts
listAccountsRaw
内部:从盘读出原始(可能加密)的账号列表,不解密。
private static async listAccountsRaw(): Promise<SavedAccount[]> { return await PreferencesStore.getObject<SavedAccount[]>('auth', KEY_ACCOUNTS, []); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left listAccountsRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum...
private static async listAccountsRaw(): Promise<SavedAccount[]> { return await PreferencesStore.getObject<SavedAccount[]>('auth', KEY_ACCOUNTS, []); }
https://github.com/LZZLHY/hlib
5cafc5035e217d938a8a4a0d6a2fd3b81f188e0d
github
arkui-x/xts
distributeddatamgr/crossplatform/PasteboardXTS/entry/src/ohosTest/ets/test/systemPasteboard.test.ets
arkts
contentChanges
The callback function is used for pasteboard content changes
function contentChanges() { isChange = true; console.info('#EVENT: The content is changed in the pasteboard'); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left contentChanges AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_s...
function contentChanges() { isChange = true; console.info('#EVENT: The content is changed in the pasteboard'); }
https://gitcode.com/arkui-x/xts
863a45c2b3508d081e175ffb58a93c8de24775b0
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets
arkts
mergeCookies
合并Cookie字符串
mergeCookies(existing: string, newCookies: string): string { const cookieMap = new Map<string, string>(); // 解析现有cookie if (existing) { existing.split(';').forEach(part => { const trimmed = part.trim(); const eqIndex = trimmed.indexOf('='); if (eqIndex > 0) { c...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mergeCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left existing AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#...
mergeCookies(existing: string, newCookies: string): string { const cookieMap = new Map<string, string>(); // 解析现有cookie if (existing) { existing.split(';').forEach(part => { const trimmed = part.trim(); const eqIndex = trimmed.indexOf('='); if (eqIndex > 0) { c...
https://github.com/DaLongZhuaZi/manxia
a9fbe32ccaf1b31d9b2a81eeecbbf59ff44239ec
github
huaiminqin/TankWar-Master-with-Many-Tasks
util/src/main/ets/services/GameService.ets
arkts
updateBullet
更新子弹位置
static updateBullet(bullet: Bullet, map: number[][]): Bullet { const newBullet = { ...bullet }; switch (bullet.direction) { case Direction.UP: newBullet.position.y -= bullet.speed * 0.1; break; case Direction.DOWN: newBullet.position.y += bullet.speed * 0.1; break; case Direction.LEFT: newBu...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left updateBullet AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bullet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bullet AST#identifier#Right AST#,#Left , AST#...
static updateBullet(bullet: Bullet, map: number[][]): Bullet { const newBullet = { ...bullet }; switch (bullet.direction) { case Direction.UP: newBullet.position.y -= bullet.speed * 0.1; break; case Direction.DOWN: newBullet.position.y += bullet.speed * 0.1; break; case Direction.LEFT: newBu...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
f580d04b671606ac4e59c509e3cd35b582d05c22
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_long.ets
arkts
main
--- desc: check subtraction of two long integers ---
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a - b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a - b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
216868f66c2cdccd1f1acd046095452fd4a8a752
gitee
openharmony/arkui_ace_engine
examples/Image/entry/src/main/ets/pages/ImageFillColorExamples/fillColorDemo02.ets
arkts
applyNormalAttribute
Called when Image component updates its attributes; sets fillColor
applyNormalAttribute(instance: ImageAttribute): void { instance.fillColor(this.colorArray[this.colorIdx]) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyNormalAttribute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageAttribute AST#identifier#R...
applyNormalAttribute(instance: ImageAttribute): void { instance.fillColor(this.colorArray[this.colorIdx]) }
https://gitee.com/openharmony/arkui_ace_engine.git
ed94fa1039f91544f2eda62be799a914d5ece9cf
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/deepseek/SiliconFlowClient.ets
arkts
chatWithTools
使用工具进行对话(Function Calling)
async chatWithTools( messages: ChatMessage[], tools: ToolDefinition[], options?: ConversationOptions ): Promise<ChatCompletionResponse> { const fullMessages = this.buildMessages(messages, options); const request: ChatCompletionRequest = { model: this.config.model, messages: fullMess...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left chatWithTools AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left messages AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async chatWithTools( messages: ChatMessage[], tools: ToolDefinition[], options?: ConversationOptions ): Promise<ChatCompletionResponse> { const fullMessages = this.buildMessages(messages, options); const request: ChatCompletionRequest = { model: this.config.model, messages: fullMess...
https://github.com/LJ666-ui/harmony-health-care
8b11782e5d94f029a1fafa521b2eb42397922b9c
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
getVersionControl
获取版本控制
getVersionControl(): VersionControl { return this.versionControl; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getVersionControl 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 VersionControl AST#identifier#Right AST#ERRO...
getVersionControl(): VersionControl { return this.versionControl; }
https://github.com/CLMC2025/Vignette
9161df6ff20dbdbc0524dd2d713f520ceecb360a
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/User.ets
arkts
trustLevelString
获取信任等级描述
get trustLevelString(): string { if (this.trustLevel === 0) { return 'L0 新用户'; } else if (this.trustLevel === 1) { return 'L1 基本用户'; } else if (this.trustLevel === 2) { return 'L2 成员'; } else if (this.trustLevel === 3) { return 'L3 活跃用户'; } else if (this.trustLevel === 4) {...
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left trustLevelString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
get trustLevelString(): string { if (this.trustLevel === 0) { return 'L0 新用户'; } else if (this.trustLevel === 1) { return 'L1 基本用户'; } else if (this.trustLevel === 2) { return 'L2 成员'; } else if (this.trustLevel === 3) { return 'L3 活跃用户'; } else if (this.trustLevel === 4) {...
https://github.com/Amaz1ny/HarmonyDO-public
740024d39c5cf7d926223421fc88dd51664a9cc0
github
Eklps/harmony-mall-perf
entry/src/main/ets/pages/ListIndex.ets
arkts
onTouchStart
====================== 帧率测试新增方法开始 ====================== 触摸开始:开始计时,重置计数器和时间
onTouchStart() { this.startTime = Date.now(); this.scrollCount = 0; this.isScrolling = true; this.lastMoveTime = this.startTime; console.info('[帧率测试] 开始滑动'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTouchStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
onTouchStart() { this.startTime = Date.now(); this.scrollCount = 0; this.isScrolling = true; this.lastMoveTime = this.startTime; console.info('[帧率测试] 开始滑动'); }
https://github.com/Eklps/harmony-mall-perf
238ee51bc28cb898b25aacccb6d773d53aa5c393
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/BookOfMoeScraper.ets
arkts
parseApiResponse
解析API响应
private parseApiResponse(responseText: string): BookOfMoeBook[] { try { const data: BookOfMoeApiResponse = SafeUtils.parseObj(responseText) as BookOfMoeApiResponse; // 检查是否是数组响应 if (Array.isArray(data)) { return data as BookOfMoeBook[]; } // 检查是否有data字段 if...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseApiResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left responseText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private parseApiResponse(responseText: string): BookOfMoeBook[] { try { const data: BookOfMoeApiResponse = SafeUtils.parseObj(responseText) as BookOfMoeApiResponse; // 检查是否是数组响应 if (Array.isArray(data)) { return data as BookOfMoeBook[]; } // 检查是否有data字段 if...
https://github.com/DaLongZhuaZi/manxia
ffc62ef36039f95faf57c9900ecc518a905d41d9
github
the-wwyang/kids-learning-app
src/main/ets/utils/AnimationUtils.ets
arkts
createConfig
========== 辅助方法 ========== 创建自定义动画配置 @param duration 时长(毫秒) @param curve 曲线类型 @param options 其他选项 @returns 动画配置
static createConfig( duration: number, curve: AnimationCurve = AnimationCurve.EASE_IN_OUT, options?: { delay?: number; iterations?: number; playMode?: 'normal' | 'reverse' | 'alternate'; } ): AnimationConfig { return { duration, curve, ...options }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R...
static createConfig( duration: number, curve: AnimationCurve = AnimationCurve.EASE_IN_OUT, options?: { delay?: number; iterations?: number; playMode?: 'normal' | 'reverse' | 'alternate'; } ): AnimationConfig { return { duration, curve, ...options }; }
https://github.com/the-wwyang/kids-learning-app
0787a5971d4b15a0faa186bb36e7dbe42593dde5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SeasonalityDetectionService.ets
arkts
detectSeasonality
检测季节性(主入口) @param categoryId 分类ID @param categoryName 分类名称 @param monthlyData 月度数据数组(按时间顺序) @param thresholds 检测阈值配置(可选) @returns 季节性分析结果
static detectSeasonality( categoryId: number, categoryName: string, monthlyData: number[], thresholds?: SeasonalityThresholds ): SeasonalityAnalysisResult { // 参数验证 if (!monthlyData || monthlyData.length === 0) { return SeasonalityDetectionService.createEmptyResult(categoryId, category...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectSeasonality 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#number#Left number AST#n...
static detectSeasonality( categoryId: number, categoryName: string, monthlyData: number[], thresholds?: SeasonalityThresholds ): SeasonalityAnalysisResult { // 参数验证 if (!monthlyData || monthlyData.length === 0) { return SeasonalityDetectionService.createEmptyResult(categoryId, category...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
15f36546a05f32e1dc51551d622c5dacc0836718
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheConstants.ets
arkts
deleteCache
删除缓存文件 @param originalPath 原始文件路径
static async deleteCache(originalPath: string): Promise<void> { const cachePath: string = CacheConstants.getCacheFilePath(originalPath); try { await fs.unlink(cachePath); hilog.info(DOMAIN, TAG, `Cache deleted: ${cachePath}`); } catch (error) { hilog.error(DOMAIN, TAG, `Failed to delete ...
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 deleteCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalPath AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async deleteCache(originalPath: string): Promise<void> { const cachePath: string = CacheConstants.getCacheFilePath(originalPath); try { await fs.unlink(cachePath); hilog.info(DOMAIN, TAG, `Cache deleted: ${cachePath}`); } catch (error) { hilog.error(DOMAIN, TAG, `Failed to delete ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L98-L106
b5d2fa006afcbb8ea2b982bd99bb5474c69fdfde
github
Joker-x-dev/CoolMallArkTS
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
constructor
构造函数,初始化 ORM 并确保购物车表已迁移 @returns {CartLocalDataSourceImpl} 实例
constructor() { this.ensureMigrated(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.ensureMigrated(); }
https://github.com/Joker-x-dev/CoolMallArkTS
e9e545ba58e9d0296190ac90d325588c49fe9c57
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/components/parts/ScratchingBoard/Panel.ets
arkts
build
Majorly to notify the parent level about the event, like to close the dialog or things.
build() { Stack({ alignContent: isPreferRightHand() ? Alignment.BottomEnd : Alignment.BottomStart }) { List({ space: standardSpacing * 0.75 }) { Repeat(this.myBoard.records) .each((item) => { ListItem() { ScratchingBoardCardFrame() { if (item.item....
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() { Stack({ alignContent: isPreferRightHand() ? Alignment.BottomEnd : Alignment.BottomStart }) { List({ space: standardSpacing * 0.75 }) { Repeat(this.myBoard.records) .each((item) => { ListItem() { ScratchingBoardCardFrame() { if (item.item....
https://github.com/awaLiny2333/LinysBrowser_NEXT
261bd9b5e064c2faac475191cbe62a9e0d2dd2cb
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnIconViewModel.ets
arkts
getFilteredIconNames
获取过滤后的全部图标名称列表 @returns {string[]} 图标名称数组
getFilteredIconNames(): string[] { if (this.searchKeyword.length === 0) { return TN_ICON_NAMES; } const keyword: string = this.searchKeyword.toLowerCase(); return TN_ICON_NAMES.filter((name: string) => name.indexOf(keyword) >= 0); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFilteredIconNames 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#stri...
getFilteredIconNames(): string[] { if (this.searchKeyword.length === 0) { return TN_ICON_NAMES; } const keyword: string = this.searchKeyword.toLowerCase(); return TN_ICON_NAMES.filter((name: string) => name.indexOf(keyword) >= 0); }
https://github.com/codelably/tuniao-ui
7740128ef6fddad9e5c15523217508f2f1db17b9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/DependencyContainer.ets
arkts
isErrorHandlerAvailable
检查ErrorHandler是否可用
public isErrorHandlerAvailable(): boolean { return this.errorHandler !== undefined; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isErrorHandlerAvailable 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 b...
public isErrorHandlerAvailable(): boolean { return this.errorHandler !== undefined; }
https://github.com/DaLongZhuaZi/manxia
bed76fc40d30e773a3d694e2e48ca4bb1eae9baf
github
openharmony-sig/applications_filemanager
entry/src/main/ets/pages/ImagePreview.ets
arkts
existDeleteApp
点击删除弹窗外部取消事件
existDeleteApp() { console.info('Click the callback in the blank area') }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left existDeleteApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
existDeleteApp() { console.info('Click the callback in the blank area') }
https://gitee.com/openharmony-sig/applications_filemanager.git
962798e24d45e47c5d7cc7fe5dc6f69ee07f28db
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
getBinary
执行 GET 请求并返回二进制数据
static async getBinary(url: string, config?: HttpClientConfig): Promise<ArrayBuffer> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TIMEOUT; const skipValidation = config?.skipServerValid...
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 getBinary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Ri...
static async getBinary(url: string, config?: HttpClientConfig): Promise<ArrayBuffer> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TIMEOUT; const skipValidation = config?.skipServerValid...
https://github.com/AlkaidLab/moonlight-harmony
1e41f153b8a23cd0360b1bd3f7a2a78eab879130
github
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets
arkts
getRdbStore
Obtaining rdbStore.
getRdbStore() { let getPromiseRdb = dataRdb.getRdbStore(getContext(), { name: CommonConstants.DATABASE_NAME, securityLevel: dataRdb.SecurityLevel.S1 }); getPromiseRdb.then(rdbStore => { this.rdbStore = rdbStore; this.rdbStore.executeSql(this.sqlCreateTable); }).catch((err: Error) => { Lo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
getRdbStore() { let getPromiseRdb = dataRdb.getRdbStore(getContext(), { name: CommonConstants.DATABASE_NAME, securityLevel: dataRdb.SecurityLevel.S1 }); getPromiseRdb.then(rdbStore => { this.rdbStore = rdbStore; this.rdbStore.executeSql(this.sqlCreateTable); }).catch((err: Error) => { Lo...
https://gitee.com/openharmony/codelabs.git
5d8bccc6cbf73f0e4508d38ce7d2fdea2ca003e6
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/AnnotationEngine.ets
arkts
updateAnnotationPosition
更新标注位置 @param annotation 标注 @param boundingBox 新边界框 @returns 更新后的标注
updateAnnotationPosition(annotation: ImageAnnotation, boundingBox: BoundingBox): ImageAnnotation { const updated: ImageAnnotation = { id: annotation.id, type: annotation.type, label: annotation.label, boundingBox: boundingBox, description: annotation.description, style: annotat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateAnnotationPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left annotation AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageAnnotation AST#ident...
updateAnnotationPosition(annotation: ImageAnnotation, boundingBox: BoundingBox): ImageAnnotation { const updated: ImageAnnotation = { id: annotation.id, type: annotation.type, label: annotation.label, boundingBox: boundingBox, description: annotation.description, style: annotat...
https://github.com/LJ666-ui/harmony-health-care
9da13142e15ae2b67858c200d82561095c34d58a
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/SearchFilter.ets
arkts
copyWith
复制并修改
copyWith(options: SearchFilterCopyOptions): SearchFilter { const clearCategory: boolean = options.clearCategory === true; const clearStatus: boolean = options.clearStatus === true; const clearDateRange: boolean = options.clearDateRange === true; const nextCategoryId: number | null = clearCategory ? n...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left copyWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SearchFilterCopyOptions AST#identifier#Right...
copyWith(options: SearchFilterCopyOptions): SearchFilter { const clearCategory: boolean = options.clearCategory === true; const clearStatus: boolean = options.clearStatus === true; const clearDateRange: boolean = options.clearDateRange === true; const nextCategoryId: number | null = clearCategory ? n...
https://github.com/Amaz1ny/HarmonyDO-public
ca7e14ce1430016d753381d32765995e8313d47c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets
arkts
isGuideSkipped
检查引导是否被跳过
public isGuideSkipped(): boolean { return this.guideSkipped; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isGuideSkipped 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 AS...
public isGuideSkipped(): boolean { return this.guideSkipped; }
https://github.com/DaLongZhuaZi/manxia
b7e6d76933c6ac607de11909bb5e4fb239837535
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/base/BaseViewModel.ets
arkts
getViewState
获取界面状态 return 界面状态
public getViewState(): S { if (this._viewState === null || this._viewState === undefined) { this._viewState = this.initViewState(); } return this._viewState; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getViewState 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 S AST#ide...
public getViewState(): S { if (this._viewState === null || this._viewState === undefined) { this._viewState = this.initViewState(); } return this._viewState; }
https://gitee.com/openharmony/applications_permission_manager.git
d7ea91911dde026c3266439dc58f8204d6ce463d
gitee
OHPG/FinSdk
jellyfin/src/main/ets/api/ActivityLogApi.ets
arkts
getLogEntries
@summary Gets activity log entries. @param {ActivityLogApiGetLogEntriesRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof ActivityLogApi
public getLogEntries(requestParameters: ActivityLogApiGetLogEntriesRequest = {}): Promise<ActivityLogEntryQueryResult> { return this.apiClient.get({path: "/System/ActivityLog/Entries", parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLogEntries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assig...
public getLogEntries(requestParameters: ActivityLogApiGetLogEntriesRequest = {}): Promise<ActivityLogEntryQueryResult> { return this.apiClient.get({path: "/System/ActivityLog/Entries", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
60a4c3f9f46ae4c74d5eca77ac7996ff7bc8178b
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
logExecution
记录振动方法执行日志 @param methodName 调用方法名
private static logExecution(methodName: string): void { hilog.info(DOMAIN, TAG, `${methodName} executed`); }
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 logExecution AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left methodName AST#identifier#Right AST#ERROR#Left AST#:#L...
private static logExecution(methodName: string): void { hilog.info(DOMAIN, TAG, `${methodName} executed`); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
76774532db0b7bee78c731ec73d65164d1afac5d
github
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
getPlotArea
获取绘图区域(去除padding后的区域)
protected getPlotArea(): { x: number; y: number; width: number; height: number } { const top = this.config.padding[0]; const right = this.config.padding[1]; const bottom = this.config.padding[2]; const left = this.config.padding[3]; return { x: left, y: top, width: this.config.wi...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getPlotArea 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#s...
protected getPlotArea(): { x: number; y: number; width: number; height: number } { const top = this.config.padding[0]; const right = this.config.padding[1]; const bottom = this.config.padding[2]; const left = this.config.padding[3]; return { x: left, y: top, width: this.config.wi...
https://github.com/LJ666-ui/harmony-health-care
48a178b23149caeb565210d9ce4089d0e49ace46
github
openharmony/arkui_ace_engine
examples/EventProject/entry/src/main/ets/pages/gesturejudge/GestureJudge.ets
arkts
build
[EndExclude set_gesture_judge]
build() { NavDestination() { Column({ space: 12 }) { /* 请将$r('app.string.gesture_GestureJudge_text')替换为实际资源文件,在本示例中该资源文件的value值为"以下示例中,Image和Stack两个组件 位于同一区域。长按Stack组件的上半部分可触发挂载在Stack组件上的长按手势,长按Stack组件的下半部分则会响应Image组件的拖拽操作。" */ Text($r('app.string.gesture_GestureJudge_text')) ...
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() { NavDestination() { Column({ space: 12 }) { /* 请将$r('app.string.gesture_GestureJudge_text')替换为实际资源文件,在本示例中该资源文件的value值为"以下示例中,Image和Stack两个组件 位于同一区域。长按Stack组件的上半部分可触发挂载在Stack组件上的长按手势,长按Stack组件的下半部分则会响应Image组件的拖拽操作。" */ Text($r('app.string.gesture_GestureJudge_text')) ...
https://gitcode.com/openharmony/arkui_ace_engine
29e8a49378289ee42315ca3a5a4a5e8dba285436
gitcode
1ilI/WebViewJavascriptBridge_harmony
webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets
arkts
jsonToMap
/ json 转 字典 Map<string, Object>
public static jsonToMap(obj: Object | undefined | null): Map<string, Object> { let result: Map<string, Object> = new Map<string, Object>(); // 传入的 obj 为空 if (obj === undefined || obj === null) { return result; } // 传入的是 字符串 if (typeof obj === 'string') { // 尝试用 json 对象接收 try...
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 jsonToMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#R...
public static jsonToMap(obj: Object | undefined | null): Map<string, Object> { let result: Map<string, Object> = new Map<string, Object>(); // 传入的 obj 为空 if (obj === undefined || obj === null) { return result; } // 传入的是 字符串 if (typeof obj === 'string') { // 尝试用 json 对象接收 try...
https://github.com/1ilI/WebViewJavascriptBridge_harmony
c1573b7f2ee97f609a35bd3959f8642d7bd935e8
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
importData
导入词汇数据
importData(json: string): boolean { try { const data = JSON.parse(json) as string[]; const records = data.map((item: string): VocabularyRecord => VocabularyRecord.fromJSON(item) ); for (const record of records) { this.addOrUpdateRecord(record); } return true;...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
importData(json: string): boolean { try { const data = JSON.parse(json) as string[]; const records = data.map((item: string): VocabularyRecord => VocabularyRecord.fromJSON(item) ); for (const record of records) { this.addOrUpdateRecord(record); } return true;...
https://github.com/CLMC2025/Vignette
9e8cc125b96e383904c3ee6ec99c7265450a984f
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/pages/SettingPage/SettingPage.ets
arkts
aboutToAppear
页面初始化生命周期 优化后的逻辑: 1. 先初始化断点系统 2. 类型安全地解析参数 3. 使用策略模式决定初始页面 4. 加载应用信息
aboutToAppear() { // 步骤1:初始化断点系统(优先执行) BreakpointSystem.getInstance().attach(this.currentBreakpoint) BreakpointSystem.getInstance().start() // 步骤2:解析路由参数(类型安全) const routerParams = router.getParams() as Params const paramType: string = (routerParams && routerParams.type) ? routerParams.ty...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { // 步骤1:初始化断点系统(优先执行) BreakpointSystem.getInstance().attach(this.currentBreakpoint) BreakpointSystem.getInstance().start() // 步骤2:解析路由参数(类型安全) const routerParams = router.getParams() as Params const paramType: string = (routerParams && routerParams.type) ? routerParams.ty...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
5a32df91236b3e0c8f832dacfb230ccd4ac83d21
github
OSpark-Team/Free-PCM
entry/src/main/ets/pages/components/FftSpectrum.ets
arkts
computeAnalyserBins
WebAudio AnalyserNode-like bins: 0..255, length = analyserFftSize/2
public computeAnalyserBins(): void { if (this.ringFilled < this.analyserFftSize) return; const ringLen = this.ring.length; let start = this.ringWrite - this.analyserFftSize; if (start < 0) start += ringLen; for (let i = 0; i < this.analyserFftSize; i++) { const srcIdx = (start + i) % ringL...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left computeAnalyserBins 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...
public computeAnalyserBins(): void { if (this.ringFilled < this.analyserFftSize) return; const ringLen = this.ring.length; let start = this.ringWrite - this.analyserFftSize; if (start < 0) start += ringLen; for (let i = 0; i < this.analyserFftSize; i++) { const srcIdx = (start + i) % ringL...
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/entry/src/main/ets/pages/components/FftSpectrum.ets#L308-L349
5c904f6c69729ae7e626909bd249afb0fe3bbb8b
github
openharmony-tpc/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
getCacheImage
从内存或文件缓存中获取图片数据 @param url 图片地址url @param cacheType 缓存策略 @returns 图片数据 @param signature key自定义信息
getCacheImage(loadSrc: string, cacheType: CacheStrategy = CacheStrategy.Default, signature?: string): Promise<ImageKnifeData | undefined> { let option: ImageKnifeOption = { loadSrc: loadSrc, signature:signature } let engineKeyImpl: IEngineKey = this.getEngineKeyImpl(); ret...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCacheImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left loadSrc AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#st...
getCacheImage(loadSrc: string, cacheType: CacheStrategy = CacheStrategy.Default, signature?: string): Promise<ImageKnifeData | undefined> { let option: ImageKnifeOption = { loadSrc: loadSrc, signature:signature } let engineKeyImpl: IEngineKey = this.getEngineKeyImpl(); ret...
https://gitee.com/openharmony-tpc/ImageKnife.git
d891dadb60823fe87e383b8dfc6d61a00936fbe3
gitee
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioRendererPlayer.ets
arkts
setTimeUpdateEnabled
启用或禁用时间更新事件 @param enabled - 是否启用时间更新 @param intervalMs - 更新间隔(毫秒),默认 250ms @remarks - 默认启用,播放时自动触发 - intervalMs 建议:200ms~500ms(华为文档建议 > 200ms 以免影响系统性能) - 设置为 false 会停止时间更新
public setTimeUpdateEnabled(enabled: boolean, intervalMs: number = 250): void { if (enabled && this.isPlaying_) { this.startTimeUpdate(intervalMs); } else { this.stopTimeUpdate(); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTimeUpdateEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
public setTimeUpdateEnabled(enabled: boolean, intervalMs: number = 250): void { if (enabled && this.isPlaying_) { this.startTimeUpdate(intervalMs); } else { this.stopTimeUpdate(); } }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L359-L365
6e895c29991bc2c38e1f7a1b1d88c4a19fa024f6
github
wgli-collab/arkts-lodash
library/src/main/ets/lang_compare.ets
arkts
isObjLike
---- Internal Helpers ----
function isObjLike(value: Object | null): boolean { return typeof value === 'object' && value !== null }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isObjLike AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function isObjLike(value: Object | null): boolean { return typeof value === 'object' && value !== null }
https://github.com/wgli-collab/arkts-lodash
8d8fa57a17636d085fc6eccee0193ec491c50421
github