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
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
setCurrentIndex
设置当前索引
setCurrentIndex(index: number): void { if (index >= 0 && index < this.playlist.length) { this.currentIndex = index; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCurrentIndex 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 ...
setCurrentIndex(index: number): void { if (index >= 0 && index < this.playlist.length) { this.currentIndex = index; } }
https://github.com/cpdd5201314/harmonyOS-music-app
0d33bae54cf9dc539d264d69737fe57b6516fb0e
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
refresh
Operations
refresh() { try { this.controller?.refresh(); } catch (e) { meow(`this.controller?.refresh(); failed: ${e}`, 'meowTabInfo][refresh', meowLevel.ERROR); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left refresh 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#try_statement#Left AST#try#Le...
refresh() { try { this.controller?.refresh(); } catch (e) { meow(`this.controller?.refresh(); failed: ${e}`, 'meowTabInfo][refresh', meowLevel.ERROR); } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
8ffb247a11caaf65d4a962e678df49bc0934a3e7
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets
arkts
deleteRemindersByScheduleId
删除日程的所有提醒
async deleteRemindersByScheduleId(scheduleId: string): Promise<void> { if (!this.rdbStore) { return } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_REMINDER) predicates.equalTo('scheduleId', scheduleId) await this.rdbStore.delete(predicates) L...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteRemindersByScheduleId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left scheduleId AST#id...
async deleteRemindersByScheduleId(scheduleId: string): Promise<void> { if (!this.rdbStore) { return } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_REMINDER) predicates.equalTo('scheduleId', scheduleId) await this.rdbStore.delete(predicates) L...
https://gitcode.com/openharmony/codelabs
9a740d9fe94389574f880da52333d56b37ea5bcb
gitcode
openharmony/arkui_ace_engine
examples/Image/entry/src/main/ets/pages/example/ImageExample118.ets
arkts
build
============ 构建区 ============
build() { Scroll() { Column({ space: 18 }) { this.buildHeader() this.buildMediaSwitcher() this.buildObjectFitSection() this.buildSizeSection() this.buildRadiusClipSection() this.buildFilterSection() this.buildTransformSection() this.buildShadow...
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() { Scroll() { Column({ space: 18 }) { this.buildHeader() this.buildMediaSwitcher() this.buildObjectFitSection() this.buildSizeSection() this.buildRadiusClipSection() this.buildFilterSection() this.buildTransformSection() this.buildShadow...
https://gitcode.com/openharmony/arkui_ace_engine
683928737c58d4cc825a3cc64360c40d16e3016a
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
indexOf
Returns the index of the first occurrence of a value in Int8Array. @param { int } searchElement - The value to locate in the array. @param { int } fromIndex - The array index at which to begin the search. @returns { int } - index of element if it presents, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageMod...
public indexOf(searchElement: int, fromIndex: int): int { return this.indexOfImpl(searchElement.toLong(), fromIndex) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identif...
public indexOf(searchElement: int, fromIndex: int): int { return this.indexOfImpl(searchElement.toLong(), fromIndex) }
https://gitcode.com/iop123123/arkts-static-skills
a509e9c15605bc03f4b6c5742c7cc7c5d819f80a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets
arkts
saveCookies
保存Cookie到持久化存储
private async saveCookies(): Promise<void> { if (!this.dataPreferences) return; try { const data: Record<string, Record<string, CookieItem>> = {}; this.cookies.forEach((domainCookies, domain) => { data[domain] = {}; domainCookies.forEach((cookie, name) => { da...
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 saveCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
private async saveCookies(): Promise<void> { if (!this.dataPreferences) return; try { const data: Record<string, Record<string, CookieItem>> = {}; this.cookies.forEach((domainCookies, domain) => { data[domain] = {}; domainCookies.forEach((cookie, name) => { da...
https://github.com/DaLongZhuaZi/manxia
2f40675966f0914c15e19698601770fa34bcb33e
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPDriveManager.ets
arkts
deleteFromVMShared
删除 VM 共享目录中的文件
public async deleteFromVMShared(vmName: string, fileName: string): Promise<boolean> { try { const filePath = `${this.getVMSharedPath(vmName)}/${fileName}`; fs.unlinkSync(filePath); console.info(`[RDPDriveManager] Deleted ${filePath}`); return true; } catch (e) { console.error('[R...
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 deleteFromVMShared AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:#Lef...
public async deleteFromVMShared(vmName: string, fileName: string): Promise<boolean> { try { const filePath = `${this.getVMSharedPath(vmName)}/${fileName}`; fs.unlinkSync(filePath); console.info(`[RDPDriveManager] Deleted ${filePath}`); return true; } catch (e) { console.error('[R...
https://github.com/AetheriumSimulator/qemu-hmos
b873236c44475cdb5af0e232e82f8d64b6fa2db6
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
angleBetween
计算两向量夹角(度) @param v1 向量1 @param v2 向量2
private angleBetween(v1: Position3D, v2: Position3D): number { const dot = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; const mag1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y + v1.z * v1.z); const mag2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y + v2.z * v2.z); if (mag1 === 0 || mag2 === 0) return 0; const cosA...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left angleBetween AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Po...
private angleBetween(v1: Position3D, v2: Position3D): number { const dot = v1.x * v2.x + v1.y * v2.y + v1.z * v2.z; const mag1 = Math.sqrt(v1.x * v1.x + v1.y * v1.y + v1.z * v1.z); const mag2 = Math.sqrt(v2.x * v2.x + v2.y * v2.y + v2.z * v2.z); if (mag1 === 0 || mag2 === 0) return 0; const cosA...
https://github.com/LJ666-ui/harmony-health-care
6d8d970933058cf8395ee5268784a1dde5977030
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/image-preview/TnImagePreview.ets
arkts
show
显示图片预览 @param urls 图片地址列表 @param option 预览配置选项
public show(urls: ResourceStr[], option?: TnImagePreviewOption): void { if (this.contentNode !== null) { return; } this.uiContext = ContextUtil.getUICtx(); const promptAction = this.uiContext.getPromptAction(); const params: TnImagePreviewParams = new TnImagePreviewParams(urls, option); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left urls AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public show(urls: ResourceStr[], option?: TnImagePreviewOption): void { if (this.contentNode !== null) { return; } this.uiContext = ContextUtil.getUICtx(); const promptAction = this.uiContext.getPromptAction(); const params: TnImagePreviewParams = new TnImagePreviewParams(urls, option); ...
https://github.com/codelably/tuniao-ui
7a54472c5c03090fc18904e2344864624e4a4361
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/database/DatabaseManager.ets
arkts
checkDatabaseState
检查数据库状态并执行相应的初始化或升级操作
private async checkDatabaseState(): Promise<void> { if (!this.dbStore) { throw new Error('数据库存储对象未初始化'); } const currentVersion = this.dbStore.version; const targetVersion = this.dbConfig.getConfigVersion(); Clog.log(TAG,`当前数据库版本: ${currentVersion}, 目标版本: ${targetVersion}`); try {...
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 checkDatabaseState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async checkDatabaseState(): Promise<void> { if (!this.dbStore) { throw new Error('数据库存储对象未初始化'); } const currentVersion = this.dbStore.version; const targetVersion = this.dbConfig.getConfigVersion(); Clog.log(TAG,`当前数据库版本: ${currentVersion}, 目标版本: ${targetVersion}`); try {...
https://github.com/ZestBox-18/kitebook-frontend
ebe69dd29b21db1621f022020ada4c7e84c1686d
github
silence17/harmonydemo
common_lib/src/main/ets/utils/axios/HttpClient.ets
arkts
_doGet
实际发送get请求 @param param 请求参数集合
private _doGet(param: RequestParam<T>) { if (param.showLoading) { Utils.showLoading() } RequestTask.get<T, null>(param.url, null) .then(response => { this._processServiceCommon(param, response); }).catch(err => { Log.error("get请求异常", err); //TypeError: Cannot convert...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left _doGet AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : A...
private _doGet(param: RequestParam<T>) { if (param.showLoading) { Utils.showLoading() } RequestTask.get<T, null>(param.url, null) .then(response => { this._processServiceCommon(param, response); }).catch(err => { Log.error("get请求异常", err); //TypeError: Cannot convert...
https://github.com/silence17/harmonydemo
11debe12a3e0a482792059338cbdbfec8f44dd03
github
genjishare/snake-game
entry/src/main/ets/pages/WebViewPage.ets
arkts
updateGameState
添加方法用于H5主动更新游戏状态到Native
updateGameState(gameStateJson: string): void { try { // 解析游戏状态JSON const gameState = JSON.parse(gameStateJson) as GameState; // 只有在游戏进行中且未暂停未结束时才更新和打印日志 if (gameState && gameState.gameStarted && !gameState.gameOver && !gameState.gamePaused) { console.info(`H5主动更新游戏状态`); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateGameState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gameStateJson AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ...
updateGameState(gameStateJson: string): void { try { // 解析游戏状态JSON const gameState = JSON.parse(gameStateJson) as GameState; // 只有在游戏进行中且未暂停未结束时才更新和打印日志 if (gameState && gameState.gameStarted && !gameState.gameOver && !gameState.gamePaused) { console.info(`H5主动更新游戏状态`); ...
https://github.com/genjishare/snake-game
ce93da30fb0ef1e007d0c94d798f9c3bbb9cedd4
github
HarmonyOS_Samples/MusicHome
features/playlist/src/main/ets/view/MiniBarPlayer.ets
arkts
build
Composes cover, aside controls, padding, and upward pan-to-full-screen gesture.
build() { Row({ space: 8 }) { MiniBarAlbumCover({ playerViewModel: this.playerViewModel, followAppMiniBarExpanded: this.followAppMiniBarExpanded }) MiniBarPlayerAside({ playerViewModel: this.playerViewModel, showPreviousTrack: this.showPreviousTrack }) }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { Row({ space: 8 }) { MiniBarAlbumCover({ playerViewModel: this.playerViewModel, followAppMiniBarExpanded: this.followAppMiniBarExpanded }) MiniBarPlayerAside({ playerViewModel: this.playerViewModel, showPreviousTrack: this.showPreviousTrack }) }...
https://gitcode.com/HarmonyOS_Samples/MusicHome
570e82378ee8a007cf55370da0bdce6639df4dbe
gitcode
CLMC2025/Vignette
entry/src/main/ets/sync/DataExportImport.ets
arkts
compressData
壓縮數據(簡化版,實際可使用pako等庫)
compressData(data: string): string { // 簡化實現,實際應使用壓縮庫 return data; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left compressData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS...
compressData(data: string): string { // 簡化實現,實際應使用壓縮庫 return data; }
https://github.com/CLMC2025/Vignette
33899bdef83ef31fd947a70813785e71432e4cc6
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
getUserComments
获取用户的评论列表(根据用户名)
static async getUserComments(username: string, page: number = 1, pageSize: number = 50): Promise<CommentListResponse> { const response = await httpClient.get(`/comments/user/${encodeURIComponent(username)}?page=${page}&pageSize=${pageSize}`); const result = parseJsonSafe(response.data); if (result) {...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserComments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async getUserComments(username: string, page: number = 1, pageSize: number = 50): Promise<CommentListResponse> { const response = await httpClient.get(`/comments/user/${encodeURIComponent(username)}?page=${page}&pageSize=${pageSize}`); const result = parseJsonSafe(response.data); if (result) {...
https://github.com/Harrisonls2004/WaterFlow
ab1acfcabe2f0da1e5b857b7d3789a2b9837e6c3
github
Countly/countly-sdk-hos
library/src/main/ets/CountlyInstance.ets
arkts
setServerURL
-- Other Features -- Change the server URL at runtime. Basic scheme + authority validation is re-run (same policy as the CountlyConfig constructor); previously-queued requests stay in place and will be sent to the new URL on the next tick.
public setServerURL(url: string): void { if (this.config.halted) { this.config.logger.w('setServerURL called after halt, ignored'); return; } const reason: string = Utils.validateServerUrl(url); if (reason === 'empty') { this.config.logger.w('setServerURL, empty url, ignored'); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setServerURL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public setServerURL(url: string): void { if (this.config.halted) { this.config.logger.w('setServerURL called after halt, ignored'); return; } const reason: string = Utils.validateServerUrl(url); if (reason === 'empty') { this.config.logger.w('setServerURL, empty url, ignored'); ...
https://github.com/Countly/countly-sdk-hos
7ff9f97ac9ffeb651f7afe8b9aeee3240bfcdcdb
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsSubscriber.ets
arkts
subscribe
订阅公共事件
subscribe() { // 订阅的公共事件集合 // 创建订阅对象 commonEventManager.createSubscriber( { events: [CommonEventConstants.CHECK_NEXT_ALARM, CommonEventConstants.EVENT_REMINDER] }, (err, subscriber) => { if (err?.code) { Log.error(TAG, `CreateSubscriberCallBack err = ${JSON.stringify(err)}`); } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left subscribe 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 AST...
subscribe() { // 订阅的公共事件集合 // 创建订阅对象 commonEventManager.createSubscriber( { events: [CommonEventConstants.CHECK_NEXT_ALARM, CommonEventConstants.EVENT_REMINDER] }, (err, subscriber) => { if (err?.code) { Log.error(TAG, `CreateSubscriberCallBack err = ${JSON.stringify(err)}`); } ...
https://gitee.com/openharmony/applications_calendar_data.git
01ece930ffc2e18346d7c4a99967ebb08d6e8a20
gitee
huaiminqin/TankWar-Master-with-Many-Tasks
util/src/main/ets/services/GameService.ets
arkts
createEnemyTank
创建敌方坦克
static createEnemyTank(x: number, y: number): Tank { return { id: this.generateId(), type: TankType.ENEMY, position: { x, y }, direction: Direction.DOWN, health: 50, maxHealth: 50, speed: GameConfig.ENEMY_SPEED, isAlive: true }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEnemyTank AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
static createEnemyTank(x: number, y: number): Tank { return { id: this.generateId(), type: TankType.ENEMY, position: { x, y }, direction: Direction.DOWN, health: 50, maxHealth: 50, speed: GameConfig.ENEMY_SPEED, isAlive: true }; }
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
1ce8e69b4f644729faf153faf1a070fcced40ed5
github
SMAT-Lab/HapRepair
data/pairs/problem_code/hp-arkui-no-func-as-arg-for-reusable-component_233.ets
arkts
count
真实场景的函数中可能存在未知的耗时操作逻辑,此处用循环函数模拟耗时操作
count(): number { let temp: number = 0; for (let index = 0; index < 10000; index++) { temp += index; } return temp; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left count AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#...
count(): number { let temp: number = 0; for (let index = 0; index < 10000; index++) { temp += index; } return temp; }
https://github.com/SMAT-Lab/HapRepair
7c9e09cd36760162d0b0b1b34717ad1137b88cbb
github
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
executeAfterLoadBatch
批量执行 afterLoad 钩子 用于查询返回多条记录时 @param entityName 实体名称 @param dataList 实体数据数组 @throws HookExecutionError 如果钩子执行失败
async executeAfterLoadBatch(entityName: string, dataList: Array<EntityData>): Promise<void> { for (let i = 0; i < dataList.length; i++) { await this.executeAfterLoad(entityName, dataList[i]) } }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeAfterLoadBatch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left entityName AST#identifier#Right AST#type_annotat...
async executeAfterLoadBatch(entityName: string, dataList: Array<EntityData>): Promise<void> { for (let i = 0; i < dataList.length; i++) { await this.executeAfterLoad(entityName, dataList[i]) } }
https://github.com/offlinecat-dev/OCNetORM
3e077aba679eab13318d09843be5bc4e5ee6b28f
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/ColorRestorer.ets
arkts
process
处理图像颜色恢复 @param imageData 输入图像数据 @param params 颜色恢复参数 @returns 颜色恢复后的图像数据
async process(imageData: ImageData, params?: ColorRestorationParams): Promise<ImageData> { console.info('[ColorRestorer] 开始颜色恢复处理'); const startTime = Date.now(); // 模拟颜色恢复处理 const outputData = new Uint8ClampedArray(imageData.data.length); const saturationBoost = params?.saturationBoost ?? 1.2; ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left process AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageData AST#identifier#Right AST#type_annotation#Left AST#:#...
async process(imageData: ImageData, params?: ColorRestorationParams): Promise<ImageData> { console.info('[ColorRestorer] 开始颜色恢复处理'); const startTime = Date.now(); // 模拟颜色恢复处理 const outputData = new Uint8ClampedArray(imageData.data.length); const saturationBoost = params?.saturationBoost ?? 1.2; ...
https://github.com/LJ666-ui/harmony-health-care
87a2215b96a04b0098de16b71202719170ca2c83
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets
arkts
execute
执行JavaScript代码 @param code JavaScript代码 @param context 执行上下文 @returns 执行结果
async execute(code: string, context: JsContext = {}): Promise<JsExecuteResult> { if (!code || code.trim() === '') { return { success: true, result: '' }; } // 确保引擎已初始化 if (!this.isInitialized) { const initialized = await this.initialize(); if (!initialized) { return { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left execute AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_an...
async execute(code: string, context: JsContext = {}): Promise<JsExecuteResult> { if (!code || code.trim() === '') { return { success: true, result: '' }; } // 确保引擎已初始化 if (!this.isInitialized) { const initialized = await this.initialize(); if (!initialized) { return { ...
https://github.com/DaLongZhuaZi/manxia
fd6536e25b2ba1483248436d990786b848d53040
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
createBoolean
Creates a new JSON element containing a boolean value. @param {boolean} value - The boolean value to store @returns {JsonElement} A new JsonElement containing the boolean value
static createBoolean(value: boolean): JsonElement { const element = new JsonElement() element.maybeBoolValue = value return element }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createBoolean AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left b...
static createBoolean(value: boolean): JsonElement { const element = new JsonElement() element.maybeBoolValue = value return element }
https://gitcode.com/iop123123/arkts-static-skills
f03d8ff0718dc1d7134429609c845d3c6752be82
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
longToast
长时间弹窗提示
longToast(msg: any): void { logger.info(TAG, `[LongToast] ${String(msg)}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left longToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left any AST#identifier#Right AST#)#Left ) AST#)#Rig...
longToast(msg: any): void { logger.info(TAG, `[LongToast] ${String(msg)}`); }
https://github.com/DaLongZhuaZi/manxia
7f20baf9fdcd226f90e447ef2f6688a7f2d287af
github
openharmony/applications_filepicker
entry/src/main/ets/databases/model/FileAssetModel.ets
arkts
sortFileAssetList
对媒体文件进行排序 @param dataList 待排序数组 @param order 排序规则 @param isDesc 是否倒序 @return 排序后的数组
function sortFileAssetList(dataList: FileAssetModel[]): FileAssetModel[] { const language = LanguageUtil.getSystemLanguage(); return dataList.sort((a: FileAssetModel, b: FileAssetModel) => { if (b.dateModified !== a.dateModified) { return b.dateModified - a.dateModified; } else { return b.displa...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left sortFileAssetList AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left dataList AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function sortFileAssetList(dataList: FileAssetModel[]): FileAssetModel[] { const language = LanguageUtil.getSystemLanguage(); return dataList.sort((a: FileAssetModel, b: FileAssetModel) => { if (b.dateModified !== a.dateModified) { return b.dateModified - a.dateModified; } else { return b.displa...
https://gitee.com/openharmony/applications_filepicker.git
f6f9e54b722892c5b7670463b28d0317caa47cd8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
buildMangaDetailWithChaptersActions
构建漫画详情和章节列表合并获取操作序列
buildMangaDetailWithChaptersActions(config: MangaSourceConfig, mangaId: string): Action[] { const workflow = this.getWorkflow(config, 'getMangaDetailWithChapters'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少合并详情章节工作流配置' ); } retur...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildMangaDetailWithChaptersActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Man...
buildMangaDetailWithChaptersActions(config: MangaSourceConfig, mangaId: string): Action[] { const workflow = this.getWorkflow(config, 'getMangaDetailWithChapters'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少合并详情章节工作流配置' ); } retur...
https://github.com/DaLongZhuaZi/manxia
b056dca0d8794f563c6abc723565dac15e08903a
github
codelably/HCompass
core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets
arkts
disable
手动关闭所有日志输出
static disable() { Logger.option.close = true; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left disable 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#{...
static disable() { Logger.option.close = true; }
https://github.com/codelably/HCompass
824f0acd853ae8ef20a62e77b1816b07e15ba327
github
din0sauria/audio-deepfake-detection
entry/src/main/ets/Audio/AudioDB.ets
arkts
deleteData
删除数据 *
deleteData(id: number): IInterviewAudioItem[] { const pre = new relationalStore.RdbPredicates(this.tableName) pre.equalTo('id', id) const res = this.store?.deleteSync(pre) if (!res) { AlertDialog.show({ message: '数据删除失败' }) } return this.getAllData() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteData 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 number AST#identifier#Right AST#...
deleteData(id: number): IInterviewAudioItem[] { const pre = new relationalStore.RdbPredicates(this.tableName) pre.equalTo('id', id) const res = this.store?.deleteSync(pre) if (!res) { AlertDialog.show({ message: '数据删除失败' }) } return this.getAllData() }
https://github.com/din0sauria/audio-deepfake-detection
e199b9f885d646365e18c9c92052b6e401236be1
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalSettingViewModel.ets
arkts
unSubscribeAvatarChangeEvent
解绑头像更换通知事件 @param key
unSubscribeAvatarChangeEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_AVATAR_CHANGE, key) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unSubscribeAvatarChangeEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#id...
unSubscribeAvatarChangeEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_AVATAR_CHANGE, key) }
https://github.com/RedRackham-R/WanAndroidHarmoney
4aeda735fb8fdc58df9bb721aa04568fa6b5a383
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitString
访问 string 字段 JSON: string
visitString(value: string, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AS...
visitString(value: string, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
841647b9bcabb1e1d470a4883747b808f1900660
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
getDisclaimerText
获取背景图免责声明文本
getDisclaimerText(): string { return '背景壁纸功能说明\n\n' + '本应用的背景壁纸来自互联网公开资源(Pipw API),图片版权归原作者所有。\n\n' + '• 本应用仅提供技术链接,不存储、不拥有这些图片的版权\n' + '• 如有侵权,请联系原图片来源方\n' + '• 您可以在设置中随时关闭壁纸功能或切换为其他来源\n\n' + '继续使用即表示您知悉并同意上述条款。'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisclaimerText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stat...
getDisclaimerText(): string { return '背景壁纸功能说明\n\n' + '本应用的背景壁纸来自互联网公开资源(Pipw API),图片版权归原作者所有。\n\n' + '• 本应用仅提供技术链接,不存储、不拥有这些图片的版权\n' + '• 如有侵权,请联系原图片来源方\n' + '• 您可以在设置中随时关闭壁纸功能或切换为其他来源\n\n' + '继续使用即表示您知悉并同意上述条款。'; }
https://github.com/AlkaidLab/moonlight-harmony
9123cb83ee4dca0e9d527970afe4f2b03449f312
github
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getPhysicalPaths
@summary Gets a list of physical paths from virtual folders. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public getPhysicalPaths(): Promise<Array<string>> { return this.apiClient.get({path: `/Libraries/PhysicalPaths`}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPhysicalPaths 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#expre...
public getPhysicalPaths(): Promise<Array<string>> { return this.apiClient.get({path: `/Libraries/PhysicalPaths`}) }
https://github.com/OHPG/FinSdk
8a71697d60989ff4a684bc0fe25f971ac8ddaa1a
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPInputHandler.ets
arkts
handleVirtualKey
处理虚拟按键
handleVirtualKey(key: string) { const keyCode = this.getKeyCodeFromString(key) const scanCode = this.convertKeyCodeToScanCode(keyCode) if (this.onKeyPress) { // 发送按下事件 this.onKeyPress(keyCode, scanCode) // 延迟发送释放事件 setTimeout(() => { if (this.onKeyPress) { th...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleVirtualKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Rig...
handleVirtualKey(key: string) { const keyCode = this.getKeyCodeFromString(key) const scanCode = this.convertKeyCodeToScanCode(keyCode) if (this.onKeyPress) { // 发送按下事件 this.onKeyPress(keyCode, scanCode) // 延迟发送释放事件 setTimeout(() => { if (this.onKeyPress) { th...
https://github.com/AetheriumSimulator/qemu-hmos
782c0a746680aa3fbf6953bc1fd7fdba3eceea99
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/data/RegionData.ets
arkts
findByText
根据名称查找节点 @param {IBestCascaderOption[]} options - 选项列表 @param {string} text - 名称 @returns {IBestCascaderOption | undefined} 匹配节点
private static findByText(options: IBestCascaderOption[], text: string): IBestCascaderOption | undefined { return options.find((item: IBestCascaderOption): boolean => item.text === text); }
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 findByText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left :...
private static findByText(options: IBestCascaderOption[], text: string): IBestCascaderOption | undefined { return options.find((item: IBestCascaderOption): boolean => item.text === text); }
https://github.com/Joker-x-dev/CoolMallArkTS
17964b47964ede57ccf21a019de1a1c771d15bb3
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/BookmarkBase.ets
arkts
validate
Validate bookmark settings
validate(): string[] { const errors: string[] = []; if (!this.hostname || this.hostname.trim() === '') { errors.push('主机名不能为空'); } if (this.port < 1 || this.port > 65535) { errors.push('端口号必须在1-65535之间'); } if (this.screenSettings.width < 640 || this.screenSettings.width > 8192)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left validate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST...
validate(): string[] { const errors: string[] = []; if (!this.hostname || this.hostname.trim() === '') { errors.push('主机名不能为空'); } if (this.port < 1 || this.port > 65535) { errors.push('端口号必须在1-65535之间'); } if (this.screenSettings.width < 640 || this.screenSettings.width > 8192)...
https://github.com/tangwengang-del/freerdp-harmonyos
d8eb3561b676931a0eecc29fcb67cf71fcff09b9
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/model/CardComponentDetailDataModel.ets
arkts
getInstance
获取CardComponentDetailDataModel实例 @returns CardComponentDetailDataModel
public static getInstance(): CardComponentDetailDataModel { if (!CardComponentDetailDataModel.instance) { CardComponentDetailDataModel.instance = new CardComponentDetailDataModel() } return CardComponentDetailDataModel.instance }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): CardComponentDetailDataModel { if (!CardComponentDetailDataModel.instance) { CardComponentDetailDataModel.instance = new CardComponentDetailDataModel() } return CardComponentDetailDataModel.instance }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
066ea4ddbde919d6e9f35b365ce6c48f3e54da25
gitcode
offlinecat-dev/OCNetORM
src/main/ets/core/ScopeRegistry.ets
arkts
hasScope
检查实体是否有指定作用域 @param entityName 实体名称 @param scopeName 作用域名称 @returns 是否存在
hasScope(entityName: string, scopeName: string): boolean { return this.getScope(entityName, scopeName) !== null }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Ri...
hasScope(entityName: string, scopeName: string): boolean { return this.getScope(entityName, scopeName) !== null }
https://github.com/offlinecat-dev/OCNetORM
c6c6815b6d734a021805c94ac318a0705cf0075a
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
hmos-account-kit-quicklogin-client/assets/QuickLoginPage.ets
arkts
getPhoneNumber
客户端请求接口示例代码
getPhoneNumber(authCode: string) { // 定义请求头 const headers: rcp.RequestHeaders = { 'accept': 'application/json' }; // 定义要传递的参数 const postMessage: Record<string, string> = { 'code': authCode }; const securityConfig: rcp.SecurityConfiguration = { tlsOptions: { tlsVer...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getPhoneNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left authCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS...
getPhoneNumber(authCode: string) { // 定义请求头 const headers: rcp.RequestHeaders = { 'accept': 'application/json' }; // 定义要传递的参数 const postMessage: Record<string, string> = { 'code': authCode }; const securityConfig: rcp.SecurityConfiguration = { tlsOptions: { tlsVer...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
4805c744199aaf88c45ef2797962c2572bdbae09
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
getConfigSummary
获取配置摘要
getConfigSummary(): ConfigSummaryResult | undefined { return this.config ? this.configParser.getConfigSummary(this.config) : undefined; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConfigSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifier#Left ConfigSummaryResul...
getConfigSummary(): ConfigSummaryResult | undefined { return this.config ? this.configParser.getConfigSummary(this.config) : undefined; }
https://github.com/DaLongZhuaZi/manxia
f20c1a8365dce6375adc34b8a21c0c332d4f2035
github
RoooyHe/toona-ohos
toona/src/main/ets/services/DeviceManager.ets
arkts
deleteDevice
修复单删方法
async deleteDevice(deviceId: string, authData?: DeviceAuthData): Promise<void> { try { await this.ensureHttpClient().deleteDevice(deviceId, authData); } catch (error) { // ✅ 修复:显式断言为 Error 类型 throw error as Error; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteDevice AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async deleteDevice(deviceId: string, authData?: DeviceAuthData): Promise<void> { try { await this.ensureHttpClient().deleteDevice(deviceId, authData); } catch (error) { // ✅ 修复:显式断言为 Error 类型 throw error as Error; } }
https://github.com/RoooyHe/toona-ohos
61b0c86ee91d86d6d43a0d75d573d266c87c4418
github
HarmonyOS_Samples/guide-snippets
Ability/StartAbility/entry/src/main/ets/entryability/ExpressAbility.ets
arkts
onCreate
[Start express_ability_on_create]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, TAG, `onCreate, want=${JSON.stringify(want)}`); super.onCreate(want, launchParam); this.parseWant(want); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { hilog.info(DOMAIN, TAG, `onCreate, want=${JSON.stringify(want)}`); super.onCreate(want, launchParam); this.parseWant(want); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
3ab9e83e8c15eb7da924be069a6afbb46e4a75b1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets
arkts
has
Checks if a value is in the ConcurrentSet. @param { T } val the value to find in the ConcurrentSet. @returns { boolean } true if the value is in the ConcurrentSet.
public override has(val: T): boolean { return this.elements.has(val); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right ...
public override has(val: T): boolean { return this.elements.has(val); }
https://gitcode.com/iop123123/arkts-static-skills
43f4664de5d975dba9475ca141f386666dea5376
gitcode
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/ui/widget/DanmakuView.ets
arkts
prepare
------------- 播放控制 -------------------
prepare(parser: BaseDanmakuParser, config: DanmakuContext): void{ this.delegate.prepare(parser, config) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left prepare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left parser AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BaseDanmakuParser AST#identifier#Right AST#,#L...
prepare(parser: BaseDanmakuParser, config: DanmakuContext): void{ this.delegate.prepare(parser, config) }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
ccbfd6cb2bab43d06e9074a7e1941f12165ab888
gitee
CarGuo/GSYGithubAppOH
entry/src/main/ets/service/RepositoryService.ets
arkts
getBranches
拉分支列表 —— 对齐 RN [repository.getBranches](https://github.com/CarGuo/GSYGithubApp/blob/master/app/store/actions/repository.js)。
async getBranches(fullName: string): Promise<RepositoryServiceResult<string[]>> { const owner: RepoOwnerName = RepoOwnerName.parse(fullName); if (owner.owner.length === 0 || owner.name.length === 0) { return new RepositoryServiceResult<string[]>(false, 0, [], false, 'invalid fullName'); } const ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBranches AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fullName AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async getBranches(fullName: string): Promise<RepositoryServiceResult<string[]>> { const owner: RepoOwnerName = RepoOwnerName.parse(fullName); if (owner.owner.length === 0 || owner.name.length === 0) { return new RepositoryServiceResult<string[]>(false, 0, [], false, 'invalid fullName'); } const ...
https://github.com/CarGuo/GSYGithubAppOH
b07985bc4c03ee85034601bc9581a9e8ac77ac43
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
findElementsById
按id查找元素 增强版:支持更多id属性格式,添加诊断日志 添加性能保护:限制元素数量和内容大小以避免ANR
private findElementsById(content: string, idName: string, maxElementsHint: number = 0): string[] { const results: string[] = []; const seenStartIndexes: Set<number> = new Set(); // 性能保护:使用统一配置(ID查找使用较小限制) let maxElements = this.getMaxElements(PerformanceConfig.MAX_ID_ELEMENTS); if (maxElement...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findElementsById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
private findElementsById(content: string, idName: string, maxElementsHint: number = 0): string[] { const results: string[] = []; const seenStartIndexes: Set<number> = new Set(); // 性能保护:使用统一配置(ID查找使用较小限制) let maxElements = this.getMaxElements(PerformanceConfig.MAX_ID_ELEMENTS); if (maxElement...
https://github.com/DaLongZhuaZi/manxia
ad0d8ccf44487c066a699f7a2ea37907e42fc582
github
zmuxuny/ai-guardian-star
entry/src/main/ets/common/ThemeManager.ets
arkts
loadThemeMode
加载主题模式
private async loadThemeMode() { try { if (!this.context) return; const dataPreferences = await preferences.getPreferences(this.context, 'theme_preferences'); const savedMode = await dataPreferences.get('themeMode', ThemeMode.FOLLOW_SYSTEM); this.themeMode = savedMode as ThemeMode; ...
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 loadThemeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
private async loadThemeMode() { try { if (!this.context) return; const dataPreferences = await preferences.getPreferences(this.context, 'theme_preferences'); const savedMode = await dataPreferences.get('themeMode', ThemeMode.FOLLOW_SYSTEM); this.themeMode = savedMode as ThemeMode; ...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/ThemeManager.ets#L186-L198
4f7e69c0ebe0bd3ac3314b0df898c0905c03ff7a
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets
arkts
set_eq
设置 10 段 GEQ 增益(-12 ~ 12 dB)
set_eq(gains: number[]): void { nativeModule.set_eq(gains) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set_eq AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gains AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left number AST#identif...
set_eq(gains: number[]): void { nativeModule.set_eq(gains) }
https://github.com/Nekofox-POT/LinMusic
f98eb826e56461cc548684cd313a899256e817bf
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Guard/Outdoor/GuardNightPage.ets
arkts
onLocationChange
-------------- 位置服务 -------------- 开启订阅位置信息(实时定位)
onLocationChange() { // 订阅位置变化 geoLocationManager.on('locationChange', { scenario: geoLocationManager.LocationRequestScenario.NAVIGATION, // 导航场景,卫星定位,高精度 interval: 3, // 上报时间间隔,单位:秒 }, async (location) => { // 通过 ws 共享行程,把位置信息以文本方式上传服务器 this.ws?.send(JSON.str...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onLocationChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
onLocationChange() { // 订阅位置变化 geoLocationManager.on('locationChange', { scenario: geoLocationManager.LocationRequestScenario.NAVIGATION, // 导航场景,卫星定位,高精度 interval: 3, // 上报时间间隔,单位:秒 }, async (location) => { // 通过 ws 共享行程,把位置信息以文本方式上传服务器 this.ws?.send(JSON.str...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
c5808a2c7e5e591597600ced07144661e157c562
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/RouterUtils.ets
arkts
getParamByName
获取路由参数 @param name @returns
public static getParamByName<T>(name: RouterMap, stackName: string = StackEnum.Main): T | null { const params = RouterUtils.getStack(stackName).getParamByName(name) as T[]; if (params.length && params[params.length - 1]) { return params[params.length - 1]; } return null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left getParamByName AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Ri...
public static getParamByName<T>(name: RouterMap, stackName: string = StackEnum.Main): T | null { const params = RouterUtils.getStack(stackName).getParamByName(name) as T[]; if (params.length && params[params.length - 1]) { return params[params.length - 1]; } return null; }
https://github.com/xblLab/HarmonyProjectTemplate
3842a2fac8973501946585b0123b6e18137967a2
github
aimilin6688/KeePassHO
entry/src/main/ets/services/TypeDefined.ets
arkts
useKeyAuth
判断认证方式是否使用密钥文件 @param authType 认证方式 @returns 是否使用密钥文件
public static useKeyAuth(authType: AuthTypeInfo): boolean { if (!authType) { return false; } return authType.type === AuthType.PASSWORD_KEYFILE.type || authType.type === AuthType.KEYFILE.type || authType.type === AuthType.PASSWORD_KEYFILE_CHALLENGE_RESPONSE_XC.type; }
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 useKeyAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left authType AST#identifier#Right AST#:#Left : A...
public static useKeyAuth(authType: AuthTypeInfo): boolean { if (!authType) { return false; } return authType.type === AuthType.PASSWORD_KEYFILE.type || authType.type === AuthType.KEYFILE.type || authType.type === AuthType.PASSWORD_KEYFILE_CHALLENGE_RESPONSE_XC.type; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TypeDefined.ets#L280-L287
f0c2dc189c0a5cbc7fb6ccb440b19f83c2f3b9e7
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imageWatermark
图片添加水印 @param input 输入图片路径 @param watermark 水印图片路径 @param output 输出图片路径 @param position 位置:'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'
public static imageWatermark( input: string, watermark: string, output: string, position: string = 'bottom-right' ): string[] { let overlay = ''; switch (position) { case 'top-left': overlay = '10:10'; break; case 'top-right': overlay = 'main_w-overlay_w-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 imageWatermark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : ...
public static imageWatermark( input: string, watermark: string, output: string, position: string = 'bottom-right' ): string[] { let overlay = ''; switch (position) { case 'top-left': overlay = '10:10'; break; case 'top-right': overlay = 'main_w-overlay_w-1...
https://github.com/jjjjjjava/ffmpeg_tools
94931f55b32ad9154eb600191786020856b3b685
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/StepDao.ets
arkts
getStepRecordsByDateRange
获取指定日期范围内的步数记录
async getStepRecordsByDateRange(startDate: string, endDate: string): Promise<StepRecord[]> { const rdbStore = await this.initDatabase(); const records: StepRecord[] = []; try { const predicates = new relationalStore.RdbPredicates('step_records'); predicates.greaterThanOrEqualTo('date', startD...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStepRecordsByDateRange AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left startDate AST#identifier#Right AST#type_annotation#Le...
async getStepRecordsByDateRange(startDate: string, endDate: string): Promise<StepRecord[]> { const rdbStore = await this.initDatabase(); const records: StepRecord[] = []; try { const predicates = new relationalStore.RdbPredicates('step_records'); predicates.greaterThanOrEqualTo('date', startD...
https://gitcode.com/openharmony/codelabs
0b1dee5ccfec593e363c2e7bfa3e1cf91804b319
gitcode
apap6628114/nga_oh
entry/src/main/ets/common/datasource/BaseLazyDataSource.ets
arkts
length
返回当前元素数量,与 `totalCount` 等价。
length(): number { return this.dataList.length }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block...
length(): number { return this.dataList.length }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L113-L115
5d5f7d6fbb42913dfbd826b1025d1c38678f2932
github
OHPG/FinVideo
entry/src/main/ets/data/Repository.ets
arkts
getNextUp
获取接下来播放的媒体列表 注:主页和剧集中用 @param seriesId @returns
public getNextUp(): Promise<Array<FinItem>> { return this.requireApi().getNextUp() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNextUp 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_s...
public getNextUp(): Promise<Array<FinItem>> { return this.requireApi().getNextUp() }
https://github.com/OHPG/FinVideo
90a68f2deef68503e0fe1b171023908be0acc12a
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
stopVM
停止虚拟机
async stopVM(vmId: string): Promise<StopVMResult> { try { // Worker 不可用时直接调用 NAPI(否则 sendCommand 会把 stop_vm 忽略掉,表现为“点停止关不了机”) if (!this.workerAvailable) { const native = await this.ensureNative() try { const ok = native.stopVm ? Boolean(native.stopVm(vmId)) : false ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stopVM AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async stopVM(vmId: string): Promise<StopVMResult> { try { // Worker 不可用时直接调用 NAPI(否则 sendCommand 会把 stop_vm 忽略掉,表现为“点停止关不了机”) if (!this.workerAvailable) { const native = await this.ensureNative() try { const ok = native.stopVm ? Boolean(native.stopVm(vmId)) : false ...
https://github.com/AetheriumSimulator/qemu-hmos
34c73073c0d9371d10fe4c663ca54cb9e54a6513
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
getEbookLineHeight
获取电子书行高
public static getEbookLineHeight(): number { return FontAwareHelper.globalState.ebookLineHeight; }
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 getEbookLineHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public static getEbookLineHeight(): number { return FontAwareHelper.globalState.ebookLineHeight; }
https://github.com/DaLongZhuaZi/manxia
05591a5908cfdd95c95d344851b1a58665bb8830
github
erosTeam/NextE
shared/src/main/ets/components/GalleryCard.ets
arkts
chipText
Chip text: the user's own (EH-chosen readable) text color for this tag, else inline-style, else grey.
chipText(t: SimpleTag): ResourceColor { const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(t.namespace, t.text) if (u !== undefined && u.textColor.length > 0) { return u.textColor } if (t.color.length > 0) { return t.color } return $r('sys.color.font_secondary') }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left chipText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SimpleTag AST#identifier#Right AST#)#Left ) AST#)#...
chipText(t: SimpleTag): ResourceColor { const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(t.namespace, t.text) if (u !== undefined && u.textColor.length > 0) { return u.textColor } if (t.color.length > 0) { return t.color } return $r('sys.color.font_secondary') }
https://github.com/erosTeam/NextE
aa044d70337d651208fc25e3a5137026803caaff
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/OmniFilterComponentRegistry.ets
arkts
registerDropSlideComponent
注册下拉类型的组件
registerDropSlideComponent(type: string, builder: WrappedBuilder<[OmniFilterItemBean, OnConfirmAction, OnCloseAction]>) { this.dropSlideTypeBuilderPool.set(type, builder); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerDropSlideComponent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#ide...
registerDropSlideComponent(type: string, builder: WrappedBuilder<[OmniFilterItemBean, OnConfirmAction, OnCloseAction]>) { this.dropSlideTypeBuilderPool.set(type, builder); }
https://github.com/wuba/omni-ui
4d3d55da6b2a65d178c51127425185ac30f7555c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
exportNovelReplaceRules
导出小说替换规则
private async exportNovelReplaceRules(): Promise<NovelReplaceRuleBackup[]> { try { const sql = 'SELECT * FROM novel_replace_rule ORDER BY ruleOrder ASC'; const results = await this.dbManager.querySql(sql); const items: NovelReplaceRuleBackup[] = []; for (const record of results) { ...
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 exportNovelReplaceRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async exportNovelReplaceRules(): Promise<NovelReplaceRuleBackup[]> { try { const sql = 'SELECT * FROM novel_replace_rule ORDER BY ruleOrder ASC'; const results = await this.dbManager.querySql(sql); const items: NovelReplaceRuleBackup[] = []; for (const record of results) { ...
https://github.com/DaLongZhuaZi/manxia
7fea84360a707887d8ab5fbe386528003a8d1d18
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_increment/postfix_increment_ubyte.ets
arkts
main
--- desc: check postfix increment for unsigned byte operand ---
function main(): void { let value: ubyte = {{v.value}} let result: ubyte = value++ assert value == {{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 { let value: ubyte = {{v.value}} let result: ubyte = value++ assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
cde2d5da06341777585926c8a881ec370abff06b
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarEntry.ets
arkts
isStacked
Returns true if this BarEntry is stacked (has a values array), false if not. @return
public isStacked(): boolean { return !!this.mYVals; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isStacked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boo...
public isStacked(): boolean { return !!this.mYVals; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
ab064136c34cd1265062899b19fa47dc9e44c3a3
gitee
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
cut
视频裁剪(零拷贝)
public static cut(input: string, output: string, startTime: string, duration: string): string[] { return ['ffmpeg', '-ss', startTime, '-i', input, '-t', duration, '-c:v', 'copy', '-c:a', 'copy', '-avoid_negative_ts', 'make_zero', '-y', output]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left cut AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#id...
public static cut(input: string, output: string, startTime: string, duration: string): string[] { return ['ffmpeg', '-ss', startTime, '-i', input, '-t', duration, '-c:v', 'copy', '-c:a', 'copy', '-avoid_negative_ts', 'make_zero', '-y', output]; }
https://github.com/jjjjjjava/ffmpeg_tools
3ee975e2009c7c6c7896058ccaaec7b02677986f
github
CLMC2025/Vignette
entry/src/main/ets/pages/learning/controllers/WordInteractionController.ets
arkts
addToNotebookSafe
Add word to notebook (for new words)
public async addToNotebookSafe( getState: () => DialogState, notebookWords: Set<string> ): Promise<void> { const currentState = getState(); const word = this.normalizeNotebookWord(currentState.word); if (word.length === 0) return; if (currentState.notebookBusy || currentState.inNotebook) ret...
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 addToNotebookSafe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left g...
public async addToNotebookSafe( getState: () => DialogState, notebookWords: Set<string> ): Promise<void> { const currentState = getState(); const word = this.normalizeNotebookWord(currentState.word); if (word.length === 0) return; if (currentState.notebookBusy || currentState.inNotebook) ret...
https://github.com/CLMC2025/Vignette
e6919cfdf61e378e734b21786a2e48f6da1c9f4b
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/pages/ProtocolWebView.ets
arkts
getWebviewWidth
Adjust the width of the web component based on the screen width.
getWebviewWidth() { // Original margin of the agreement page. const WEB_PAGE_MARGIN = 32; // Margin required by the web component. const UI_PAGE_MARGIN = this.isLandScape && this.isPhone ? 40 : getWhiteSpaceWidthByDisplayWidth(this.displayWidth); return ((this.displayWidth + (WEB_PAGE_MARGIN...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWebviewWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
getWebviewWidth() { // Original margin of the agreement page. const WEB_PAGE_MARGIN = 32; // Margin required by the web component. const UI_PAGE_MARGIN = this.isLandScape && this.isPhone ? 40 : getWhiteSpaceWidthByDisplayWidth(this.displayWidth); return ((this.displayWidth + (WEB_PAGE_MARGIN...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
ec4dbd1196b942792a22e6367eddeb59fa1394ea
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/AppDataViewModel.ets
arkts
cleanAndFixJson
清理和修复JSON字符串的方法
private static cleanAndFixJson(jsonStr: string): string { // 去除响应式属性 let cleanedStr = jsonStr .replace(/"__ob_/g, '"') // 移除 "__ob_" 前缀 .replace(/"___watch__obj_":\{[^}]*\},?/g, ''); // 移除 "___watch__obj_{...}" 键值对 // 修复多余的逗号 cleanedStr = cleanedStr.replace(/,(\s*[}\]])/g, '$1'); ret...
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 cleanAndFixJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonStr AST#identifier#Right AST#ERROR#Left AST#:#L...
private static cleanAndFixJson(jsonStr: string): string { // 去除响应式属性 let cleanedStr = jsonStr .replace(/"__ob_/g, '"') // 移除 "__ob_" 前缀 .replace(/"___watch__obj_":\{[^}]*\},?/g, ''); // 移除 "___watch__obj_{...}" 键值对 // 修复多余的逗号 cleanedStr = cleanedStr.replace(/,(\s*[}\]])/g, '$1'); ret...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/AppDataViewModel.ets#L344-L353
dddf20736f528728be651ab6c082dec45e758ce0
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
submitAnswer
提交答案 @param answer 用户答案 @returns 是否正确
async submitAnswer(answer: string): Promise<boolean> { const current: GameRecord | null = this.getCurrentQuestion(); if (!current || current.isAnswered) { return false; } current.userAnswer = answer.trim(); const isCorrect = isAnswerCorrect(current.userAnswer, current.currentChengy...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitAnswer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left answer AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async submitAnswer(answer: string): Promise<boolean> { const current: GameRecord | null = this.getCurrentQuestion(); if (!current || current.isAnswered) { return false; } current.userAnswer = answer.trim(); const isCorrect = isAnswerCorrect(current.userAnswer, current.currentChengy...
https://github.com/zcg741/chengyu-game
62055988823a8f002df39016907a30a81f7aa037
github
erosTeam/NextE
shared/src/main/ets/settings/ActionAlignmentSettings.ets
arkts
apply
Seed the runtime state mirror (used by restore); does NOT persist.
static apply(mode: string): void { connectActionAlignment().alignmentMode = ActionAlignmentSettings.normalizeMode(mode) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left apply AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
static apply(mode: string): void { connectActionAlignment().alignmentMode = ActionAlignmentSettings.normalizeMode(mode) }
https://github.com/erosTeam/NextE
c403664ce2566fbd871f3f483a58eb2e827eb32d
github
HarmonyOS_Samples/MusicHome
products/pc/src/main/ets/pcability/PcAbility.ets
arkts
onCreate
Logs ability creation (PC runtime may defer context until window stage). @param want Launch want. @param launchParam Launch parameters.
onCreate(): void { Logger.info('PcAbility: Ability onCreate'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef...
onCreate(): void { Logger.info('PcAbility: Ability onCreate'); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
73e96d2dcfad275db6cc7cd532810256df2728a2
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/CityDataService.ets
arkts
getAllProvinces
获取所有省份
static getAllProvinces(): string[] { CityDataService.initCities(); const provinces = new Set<string>(); CityDataService.cities.forEach((c: CityModel) => provinces.add(c.province)); return Array.from(provinces).sort(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllProvinces 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 string...
static getAllProvinces(): string[] { CityDataService.initCities(); const provinces = new Set<string>(); CityDataService.cities.forEach((c: CityModel) => provinces.add(c.province)); return Array.from(provinces).sort(); }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
acbb04f4ddc1b2898efe807bfe181e34384e736d
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
extractOptionalNumberFromObject
从对象中提取可选数字值 @param obj 对象 @param key 键 @returns 数字值或undefined
private extractOptionalNumberFromObject(obj: Record<string, Object>, key: string): number | undefined { const value = obj[key]; if (value !== undefined && value !== null && typeof value === 'number') { return value; } return undefined; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractOptionalNumberFromObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private extractOptionalNumberFromObject(obj: Record<string, Object>, key: string): number | undefined { const value = obj[key]; if (value !== undefined && value !== null && typeof value === 'number') { return value; } return undefined; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L338-L344
34a80e0c569152ec5df925439e3dd5e59bea7be4
github
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/file/LruDiskUsage.ets
arkts
calculateTotalSize
并发函数,用于在taskpool中计算文件总大小
@Concurrent function calculateTotalSize(files: string[]): FileSizeResult { let totalSize = 0; let totalCount = files.length; let fileSizes: number[] = []; try { for (let i = 0; i < files.length; i++) { let singleFile = files[i]; try { if (fs.accessSync(singleFile)) { let fileS...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left calculateTotalSize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right...
@Concurrent function calculateTotalSize(files: string[]): FileSizeResult { let totalSize = 0; let totalCount = files.length; let fileSizes: number[] = []; try { for (let i = 0; i < files.length; i++) { let singleFile = files[i]; try { if (fs.accessSync(singleFile)) { let fileS...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
964f9baf318cebd9e1e5e2ad9f08e3428b6a6213
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
paginate
设置分页参数 自动计算 offset 值:offset = (page - 1) * size @param page 页码(从 1 开始) @param size 每页数量 @returns 当前实例(支持链式调用)
paginate(page: number, size: number): QueryBuilder { // 确保页码至少为 1 this.pageNumber = page >= 1 ? page : 1 // 确保每页数量至少为 1 this.pageSizeValue = size >= 1 ? size : 20 // 自动计算并设置 offset 和 limit this.offsetValue = (this.pageNumber - 1) * this.pageSizeValue this.limitValue = this.pageSizeValue ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left paginate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#...
paginate(page: number, size: number): QueryBuilder { // 确保页码至少为 1 this.pageNumber = page >= 1 ? page : 1 // 确保每页数量至少为 1 this.pageSizeValue = size >= 1 ? size : 20 // 自动计算并设置 offset 和 limit this.offsetValue = (this.pageNumber - 1) * this.pageSizeValue this.limitValue = this.pageSizeValue ...
https://github.com/offlinecat-dev/OCNetORM
c69852945de86a6dfd8b2c04dae41097691ad2bb
github
OHPG/FinSdk
jellyfin/src/main/ets/api/SessionApi.ets
arkts
getAuthProviders
getAuthProviders @summary Get all auth providers. @throws {RequiredError} @memberof SessionApi
public async getAuthProviders(): Promise<Array<NameIdPair>> { return this.apiClient.get({path: "/Auth/Providers"}) }
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 getAuthProviders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async getAuthProviders(): Promise<Array<NameIdPair>> { return this.apiClient.get({path: "/Auth/Providers"}) }
https://github.com/OHPG/FinSdk
96a151835d3b5adb9c49b7b91e1c09e2ecfbd3f0
github
tdcare/tdwebrtc
example/MediaStreamAdvancedExample.ets
arkts
requestKeyFrame
请求关键帧
public async requestKeyFrame(): Promise<void> { if (!this.mediaStream) { return; } await this.mediaStream.requestKeyFrame(); console.log('[MediaStreamExample] 已请求关键帧'); }
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 requestKeyFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public async requestKeyFrame(): Promise<void> { if (!this.mediaStream) { return; } await this.mediaStream.requestKeyFrame(); console.log('[MediaStreamExample] 已请求关键帧'); }
https://github.com/tdcare/tdwebrtc
5015f044702d038049aeaea70de9ef377aee1305
github
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/pages/LibretroGamePage.ets
arkts
getAvailableRoms
获取当前核心可用的 ROM(缓存结果,避免重复 filter)
getAvailableRoms(): RuntimeRomConfig[] { if (this.selectedCoreIndex === this.availableRomsCacheCoreIndex && this.roms === this.availableRomsCacheRef) { return this.availableRomsCache; } this.availableRomsCacheCoreIndex = this.selectedCoreIndex; this.availableRomsCacheRef = this.roms; const c...
AST#program#Left AST#expression_statement#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left getAvailableRoms 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#i...
getAvailableRoms(): RuntimeRomConfig[] { if (this.selectedCoreIndex === this.availableRomsCacheCoreIndex && this.roms === this.availableRomsCacheRef) { return this.availableRomsCache; } this.availableRomsCacheCoreIndex = this.selectedCoreIndex; this.availableRomsCacheRef = this.roms; const c...
https://github.com/daugf2527/harmonyos-libretro-emulator
ccfbd507c1da3bc04d6c51c274abbfe5d8d079c3
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
calcAngle
calculates the needed angle for a given value @param value @param yValueSum @return
private calcAngle(value: number, yValueSum: number): number { return value / yValueSum * this.mMaxAngle; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calcAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
private calcAngle(value: number, yValueSum: number): number { return value / yValueSum * this.mMaxAngle; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c26358310cc9fab96dbef84ed6a265d928e4f020
gitee
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
convertToWordItem
转换为WordItem
private convertToWordItem(exportedWord: ExportedWord): WordItem { let definition: WordDefinition = new WordDefinition(); if (exportedWord.definition && exportedWord.definition.length > 0 && (exportedWord.definitionSource === 'ai' || exportedWord.definitionSource === 'local')) { try { de...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertToWordItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left exportedWord AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private convertToWordItem(exportedWord: ExportedWord): WordItem { let definition: WordDefinition = new WordDefinition(); if (exportedWord.definition && exportedWord.definition.length > 0 && (exportedWord.definitionSource === 'ai' || exportedWord.definitionSource === 'local')) { try { de...
https://github.com/CLMC2025/Vignette
222e048b55de678a826af03a8fce6221a595f9fa
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/local/LocalFileStorage.ets
arkts
write
写入文件内容, 写入前根据授权内容判断是否授权或激活授权 @param path 文件路径 @param content 文件内容 @throws 如果写入失败则抛出异常
public async write(path: string, content: ArrayBuffer): Promise<void> { return this.checkFilePermission(path, fileShare.OperationMode.WRITE_MODE).then((result) => { return this.doWrite(path, content); }); }
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 write AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right...
public async write(path: string, content: ArrayBuffer): Promise<void> { return this.checkFilePermission(path, fileShare.OperationMode.WRITE_MODE).then((result) => { return this.doWrite(path, content); }); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L101-L105
57e4409f44575d8fba113a2914bce83f61c4ee4d
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/CookieStore.ets
arkts
ingestCookieHeader
从标准 Cookie header 合并(形如:a=b; c=d)
ingestCookieHeader(cookieHeader: string, url: string = AppConstants.BASE_URL, httpOnly: boolean = false): void { const raw: string = cookieHeader.trim(); if (raw.length === 0) return; const parts: string[] = raw.split(';'); for (let i = 0; i < parts.length; i++) { const item: string = parts[i].t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ingestCookieHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cookieHeader AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Lef...
ingestCookieHeader(cookieHeader: string, url: string = AppConstants.BASE_URL, httpOnly: boolean = false): void { const raw: string = cookieHeader.trim(); if (raw.length === 0) return; const parts: string[] = raw.split(';'); for (let i = 0; i < parts.length; i++) { const item: string = parts[i].t...
https://github.com/Amaz1ny/HarmonyDO-public
9c8a7178de4fe5b7e4a05a04794ad3cc43b4f45e
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setHintFontColor
设置Loading文字颜色 @param color
setHintFontColor(color?: ResourceColor): Builder { this.popupOptions.hintFontColor = color return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHintFontColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ResourceColor...
setHintFontColor(color?: ResourceColor): Builder { this.popupOptions.hintFontColor = color return this }
https://github.com/wuba/omni-ui
eaf686fa56be4604bd6285a5d497ee81c85962e4
github
openharmony-sig/applications_clock
common/src/main/ets/utils/TimeUtil.ets
arkts
getFassDay
Get the next workdays alarm time @param Current alarmInfo @return The next alarm time
static getFassDay(alarmInfo: AlarmInfo) { let cacheHolidaysList = AppStorage.get<HolidaysType>(CACHE_HOLIDAYS_LIST); LogUtil.info(TAG, ' getFassDay cacheHolidaysList:' + JSON.stringify(cacheHolidaysList)); let nowDay: number = TimeUtil.getNumberDay() - ONE_DAY; LogUtil.info(TAG, ' getFassDay nowDay:...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFassDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
static getFassDay(alarmInfo: AlarmInfo) { let cacheHolidaysList = AppStorage.get<HolidaysType>(CACHE_HOLIDAYS_LIST); LogUtil.info(TAG, ' getFassDay cacheHolidaysList:' + JSON.stringify(cacheHolidaysList)); let nowDay: number = TimeUtil.getNumberDay() - ONE_DAY; LogUtil.info(TAG, ' getFassDay nowDay:...
https://gitee.com/openharmony-sig/applications_clock.git
d93bde71e4c946bb391e9e147835f9e833dc9849
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/pages/DiscoverPage.ets
arkts
extractSummary
文本摘要提取
extractSummary(content: string): string { let cleanedContent = content.replace(/\*\*/g, ''); cleanedContent = cleanedContent.replace(/```arkts[\s\S]*?```/g, ''); cleanedContent = cleanedContent.replace(/```[\s\S]*?```/g, ''); cleanedContent = cleanedContent.replace(/^```arkts$/gm, ''); cleanedCont...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left extractSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)...
extractSummary(content: string): string { let cleanedContent = content.replace(/\*\*/g, ''); cleanedContent = cleanedContent.replace(/```arkts[\s\S]*?```/g, ''); cleanedContent = cleanedContent.replace(/```[\s\S]*?```/g, ''); cleanedContent = cleanedContent.replace(/^```arkts$/gm, ''); cleanedCont...
https://github.com/LJ666-ui/harmony-health-care
5a388cdf868115771f1962bc163c34bf8114201b
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ObjectPool.ets
arkts
getPoolCount
Returns the number of objects remaining in the pool, for diagnostic purposes. @return The number of objects remaining in the pool.
public getPoolCount(): number { return this.objectsPointer + 1; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPoolCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
public getPoolCount(): number { return this.objectsPointer + 1; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
596fc8c70d7f7231b511f7a21b4d645c46c6d98f
gitee
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/model/Reminder.ets
arkts
fromDbObject
从数据库对象创建 Reminder 实例
static fromDbObject(obj: relationalStore.ValuesBucket): Reminder { const reminder = new Reminder() reminder.id = obj['id'] as string reminder.scheduleId = obj['scheduleId'] as string reminder.timing = obj['timing'] as ReminderTiming reminder.type = obj['type'] as ReminderType reminder.triggerT...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromDbObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Le...
static fromDbObject(obj: relationalStore.ValuesBucket): Reminder { const reminder = new Reminder() reminder.id = obj['id'] as string reminder.scheduleId = obj['scheduleId'] as string reminder.timing = obj['timing'] as ReminderTiming reminder.type = obj['type'] as ReminderType reminder.triggerT...
https://gitcode.com/openharmony/codelabs
40a339e94b0cf964ad1f56a91c6781151a79e00f
gitcode
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
checkAndStartBackgroundPenalty
检查并启动防偷懒机制(后台超过1分钟自动暂停)
private checkAndStartBackgroundPenalty(): void { this.clearBackgroundTimeout(); if (this.state === FocusState.WORKING && this.isAppInBackground) { this.sendCompletionNotification('专注进行中', '检测到您离开应用,请于1分钟内返回。') this.backgroundTimeoutId = setTimeout(() => { if (this.state === FocusState.WOR...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkAndStartBackgroundPenalty 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#ERRO...
private checkAndStartBackgroundPenalty(): void { this.clearBackgroundTimeout(); if (this.state === FocusState.WORKING && this.isAppInBackground) { this.sendCompletionNotification('专注进行中', '检测到您离开应用,请于1分钟内返回。') this.backgroundTimeoutId = setTimeout(() => { if (this.state === FocusState.WOR...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L107-L118
a0feae02aa5082bb5de96b37e475d5bdc599fb0f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
isInverted
If this returns true, the y-axis is inverted. @return
public isInverted(): boolean { return this.mInverted; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isInverted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
public isInverted(): boolean { return this.mInverted; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1d2f2e630640cc2a22efab663d6339bae2349be0
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrShareService.ets
arkts
serializeJson
将配置序列化为 v2 JSON 字符串(剪贴板用,人类可读)
static serializeJson(profileName: string, keys: CustomKeyDef[]): string { const data: CompactExportV2 = { v: 2, n: profileName, k: keys.map((k: CustomKeyDef) => toCompact(k)), }; return JSON.stringify(data); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left serializeJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left profileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
static serializeJson(profileName: string, keys: CustomKeyDef[]): string { const data: CompactExportV2 = { v: 2, n: profileName, k: keys.map((k: CustomKeyDef) => toCompact(k)), }; return JSON.stringify(data); }
https://github.com/AlkaidLab/moonlight-harmony
8a3cffbae5cd764e97361bd6eca0d43b48c7135d
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavConflictResolver.ets
arkts
checkTemplatePackDownload
Check if template pack download should proceed.
static checkTemplatePackDownload( headRes: WebDavResponse, manifest: WebDavManifest ): WebDavSyncResult | null { if (headRes.statusCode === 404) { return WebDavSyncResult.fail('云端不存在离线模板包', 'HTTP 404'); } if (headRes.statusCode < 200 || headRes.statusCode >= 400) { return WebDavSyncR...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkTemplatePackDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headRes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
static checkTemplatePackDownload( headRes: WebDavResponse, manifest: WebDavManifest ): WebDavSyncResult | null { if (headRes.statusCode === 404) { return WebDavSyncResult.fail('云端不存在离线模板包', 'HTTP 404'); } if (headRes.statusCode < 200 || headRes.statusCode >= 400) { return WebDavSyncR...
https://github.com/CLMC2025/Vignette
44f5a2de9932c7add7f3195df219e0b1ccbbebb5
github
openharmony-sig/node_pool
nodepool/src/main/ets/lib/NodePool.ets
arkts
setRecycleCallback
设置回收回调 @param recycleCallback
public setRecycleCallback(recycleCallback: RecycleCallback) { this.nodePoolConfig.recycleCallback = recycleCallback; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRecycleCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left recycleCallback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
public setRecycleCallback(recycleCallback: RecycleCallback) { this.nodePoolConfig.recycleCallback = recycleCallback; }
https://gitee.com/openharmony-sig/node_pool.git
b8548a1988be62c30e0a2ba383360d28fb825ea5
gitee
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/ContactManager.ets
arkts
getInitialsList
获取字母索引列表 - 供UI层使用
public getInitialsList(contacts: ContactsItem[]): string[] { const initials = new Set<string>(); for (const contact of contacts) { const initial = contact.initial || '#'; initials.add(initial); } return Array.from(initials).sort(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInitialsList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contacts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex...
public getInitialsList(contacts: ContactsItem[]): string[] { const initials = new Set<string>(); for (const contact of contacts) { const initial = contact.initial || '#'; initials.add(initial); } return Array.from(initials).sort(); }
https://gitcode.com/openharmony/codelabs
4c43c1f4110f81c22a38ab796a9dec6de5c39d01
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
reset
重置状态(用于测试或重启)
reset(): void { this.state = this.createInitialState(); this.completionPromise = null; this.completionResolve = null; logger.info(TAG, '初始化状态已重置'); this.notifyListeners(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.state = this.createInitialState(); this.completionPromise = null; this.completionResolve = null; logger.info(TAG, '初始化状态已重置'); this.notifyListeners(); }
https://github.com/DaLongZhuaZi/manxia
1b2589dfe750c32d8cbaf0bd4dc43b4f1a18755c
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
getHeaderParameters
Get header parameters metadata
static getHeaderParameters(target: Object, propertyKey?: string | symbol): Record<number, string> | null { return this.getMetadata('retrofit:headerParams', target, propertyKey) || null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getHeaderParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
static getHeaderParameters(target: Object, propertyKey?: string | symbol): Record<number, string> | null { return this.getMetadata('retrofit:headerParams', target, propertyKey) || null; }
https://github.com/killetom/ktretrofit
03127e4cfef3b20cdc518671df8be4994a87bada
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/RemoteKeyDispatcher.ets
arkts
sendModifiedKey
发送带修饰键的按键序列 + once 自动释放
sendModifiedKey(loader: ExtensionLoader, sessionId: number, keyCode: number, label: string, getLatch: LatchGetter, setLatch: LatchSetter, isRemoteDown: RemoteDownGetter | null): void { try { const mods: number[] = this.collectModifierCodes(getLatch); if (mods.length === 0) { this.s...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendModifiedKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loader AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ExtensionLoader AST#identifier#Right A...
sendModifiedKey(loader: ExtensionLoader, sessionId: number, keyCode: number, label: string, getLatch: LatchGetter, setLatch: LatchSetter, isRemoteDown: RemoteDownGetter | null): void { try { const mods: number[] = this.collectModifierCodes(getLatch); if (mods.length === 0) { this.s...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
2c7e65d6f692779adcf414e9e65adf85a57454fe
github
LYM15/FireflyCompanion
entry/src/main/ets/utils/UserDataUtils.ets
arkts
isAccountExist
检查账号是否已存在
static isAccountExist(account: string): boolean { const userList: UserInfo[] = UserDataUtils.getUserList(); return userList.some((user: UserInfo) => user.account === account); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isAccountExist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left account AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static isAccountExist(account: string): boolean { const userList: UserInfo[] = UserDataUtils.getUserList(); return userList.some((user: UserInfo) => user.account === account); }
https://github.com/LYM15/FireflyCompanion
b36a1245fb1c737bade7a4fc9433f6ff05cae37f
github
openharmony-sig/knowledge_demo_entainment
FA/GuoChat/entry/src/main/ets/MainAbility/common/utils/optionItem.ets
arkts
build
item的单击事件(可选)
build(){ Row(){ if(this.img != null){ Flex({direction: FlexDirection.Row , alignItems:ItemAlign.Center , justifyContent:FlexAlign.Center}){ Image(this.img) .width(30).height(30) }.width(50).height(60) } Column(){ Row(){ Text(this.context) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build(){ Row(){ if(this.img != null){ Flex({direction: FlexDirection.Row , alignItems:ItemAlign.Center , justifyContent:FlexAlign.Center}){ Image(this.img) .width(30).height(30) }.width(50).height(60) } Column(){ Row(){ Text(this.context) ...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
701f0ca9852d6baca448dfb169f01bdbd0112d0e
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
getEnabledDictRules
获取启用的字典规则列表
getEnabledDictRules(): DictRule[] { return this.dictRules.filter(r => r.enabled).sort((a, b) => a.sortNumber - b.sortNumber); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getEnabledDictRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left )...
getEnabledDictRules(): DictRule[] { return this.dictRules.filter(r => r.enabled).sort((a, b) => a.sortNumber - b.sortNumber); }
https://github.com/DaLongZhuaZi/manxia
ffd3d39b07167d3178bca6dd328d8197fc8d157f
github
openharmony/applications_print_spooler
entry/src/main/ets/pages/component/PreviewComponent.ets
arkts
onHeightLoad
界面高度调整
onHeightLoad(){ Log.info(TAG,'onHeightLoad:'+this.previewCompHeight) if (this.imageSources === undefined ){ return; } if(this.previewCompHeight){ this.handleImage(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onHeightLoad 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 ...
onHeightLoad(){ Log.info(TAG,'onHeightLoad:'+this.previewCompHeight) if (this.imageSources === undefined ){ return; } if(this.previewCompHeight){ this.handleImage(); } }
https://gitee.com/openharmony/applications_print_spooler.git
85a1c06c0bd4fdea6a738749613a8a78249a1ed8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
saveEBookInfo
保存电子书基本信息
private async saveEBookInfo(ebook: EBook): Promise<void> { const insertSql = ` INSERT INTO ebook_info ( id, format, filePath, fileSize, title, author, publisher, publishDate, isbn, language, description, coverImagePath, tags, rating, status, isFavorite, totalWordCount, contentMode, p...
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 saveEBookInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left :...
private async saveEBookInfo(ebook: EBook): Promise<void> { const insertSql = ` INSERT INTO ebook_info ( id, format, filePath, fileSize, title, author, publisher, publishDate, isbn, language, description, coverImagePath, tags, rating, status, isFavorite, totalWordCount, contentMode, p...
https://github.com/DaLongZhuaZi/manxia
df2119b4533a8855ae5106a36219b780e56ad520
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
setCacheDir
设置缓存目录
setCacheDir(dir: string): void { this.cacheDir = dir; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
setCacheDir(dir: string): void { this.cacheDir = dir; }
https://github.com/DaLongZhuaZi/manxia
7cf80de0253bc0395e1f7d1ff5e40848e543274e
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
getPresetTemplates
获取预置模板列表
getPresetTemplates(): IPresetTemplate[] { return this.presetStrategy.getTemplates(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getPresetTemplates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
getPresetTemplates(): IPresetTemplate[] { return this.presetStrategy.getTemplates(); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L86-L88
4e8e7c3d3b8998a57a764d1d89a5699f6d8725f5
github