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
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets
arkts
pinchEnd
End of map kneading gesture.
pinchEnd(screenMapWidth: number, mapWidth: number, mapHeight: number): void { let minX = screenMapWidth - mapWidth; let minY = (1 / this.mapMultiples() - 1) * mapHeight; this.leftTop = [minX, minY]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pinchEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left screenMapWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#...
pinchEnd(screenMapWidth: number, mapWidth: number, mapHeight: number): void { let minX = screenMapWidth - mapWidth; let minY = (1 / this.mapMultiples() - 1) * mapHeight; this.leftTop = [minX, minY]; }
https://gitee.com/harmonyos/codelabs.git
9516355f6dfff7c0073905a07cb25dde50d9cec3
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setDrawGridLines
Set this to true to enable drawing the grid lines for this axis. @param enabled
public setDrawGridLines(enabled: boolean): void { this.mDrawGridLines = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawGridLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setDrawGridLines(enabled: boolean): void { this.mDrawGridLines = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c1868b51c630f0b2d6fc66ca538029bedaa68b38
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/DdkUsbPoller.ets
arkts
makeDeviceId
通过 busNum/devAddress 构造 DDK deviceId 当 findDevice 返回 0 设备时使用此方法 @param busNum USB 总线号 (来自 usbManager device.busNum) @param devAddress USB 设备地址 (来自 usbManager device.devAddress) @returns 成功时包含 deviceId
static makeDeviceId(busNum: number, devAddress: number): DdkMakeDeviceIdResult { if (!ddkInitialized) { const initResult = DdkUsbPoller.init(); if (initResult.code !== 0) { return { found: false, error: `DDK init failed: ${initResult.error}` }; } } try { const result = ddk...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left makeDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left busNum AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static makeDeviceId(busNum: number, devAddress: number): DdkMakeDeviceIdResult { if (!ddkInitialized) { const initResult = DdkUsbPoller.init(); if (initResult.code !== 0) { return { found: false, error: `DDK init failed: ${initResult.error}` }; } } try { const result = ddk...
https://github.com/AlkaidLab/moonlight-harmony
04249d802b29c6ab8de38cd636383176a42fd98d
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
removeByName
@deprecated @see {ZRouter.getInstance().removeByName} @param name
public static removeByName(name: string) { ZRouter.getRouterMgr().removeByName(name) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left removeByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST...
public static removeByName(name: string) { ZRouter.getRouterMgr().removeByName(name) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L551-L553
c45a7b3628100ff0fc299d1aef18af8cff797670
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/start.ets
arkts
aboutToAppear
播放器 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////// 基础类 // ////////
aboutToAppear(): void { // 开启监听 emitter.on({ eventId: 812 }, (eventData: emitter.EventData) => {this.msg = eventData.data?.msg}) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 开启监听 emitter.on({ eventId: 812 }, (eventData: emitter.EventData) => {this.msg = eventData.data?.msg}) }
https://github.com/Nekofox-POT/LinMusic
458571c6d8bd93516ea4846656723ab718cf3cd3
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/viewmodel/CardComponentDataViewModel.ets
arkts
getInstance
获取CardComponentDataViewModel实例 @returns CardComponentDataViewModel
public static getInstance(): CardComponentDataViewModel { if (!CardComponentDataViewModel.instance) { CardComponentDataViewModel.instance = new CardComponentDataViewModel() } return CardComponentDataViewModel.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(): CardComponentDataViewModel { if (!CardComponentDataViewModel.instance) { CardComponentDataViewModel.instance = new CardComponentDataViewModel() } return CardComponentDataViewModel.instance }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
452dfbdccf0d11895ecea3f8ad1fd266697b5d24
gitcode
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/AssetOverviewCardComponent.ets
arkts
build
构建资产概览卡片外壳并注入具体内容。
build() { HomeSwiperCardShellComponent({ themeState: this.themeState, compactLayout: this.compactLayout, opacityValue: this.opacityValue, scaleValue: this.scaleValue, rotateValue: this.rotateValue, zIndexValue: this.zIndexValue, heightValue: 236, leftPadding: this.c...
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() { HomeSwiperCardShellComponent({ themeState: this.themeState, compactLayout: this.compactLayout, opacityValue: this.opacityValue, scaleValue: this.scaleValue, rotateValue: this.rotateValue, zIndexValue: this.zIndexValue, heightValue: 236, leftPadding: this.c...
https://github.com/ZestBox-18/kitebook-frontend
fd5446cd69694b027fa46b2299cbc00f37501dc0
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/component/OmniFilterSingleList.ets
arkts
configMultiLevelList
配置多级节点的选中状态
configMultiLevelList(selectedEntity: OmniFilterItemBean): void { if (selectedEntity.isUnLimit()) { // 选中【不限】,清空同级节点状态 selectedEntity.parent?.children .filter(f => f !== selectedEntity) .forEach(f => { f.clearChildSelectedStatus(); f.isSelected = false; }); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left configMultiLevelList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selectedEntity AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left OmniFilterItemBean AST#id...
configMultiLevelList(selectedEntity: OmniFilterItemBean): void { if (selectedEntity.isUnLimit()) { // 选中【不限】,清空同级节点状态 selectedEntity.parent?.children .filter(f => f !== selectedEntity) .forEach(f => { f.clearChildSelectedStatus(); f.isSelected = false; }); ...
https://github.com/wuba/omni-ui
fb30984d44576afb639f9f418a1162cd1c188975
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
deleteShelf
删除书架 同时删除BookshelfCategoryManager中的对应分类(内容移动到默认分类)
async deleteShelf(shelfId: string): Promise<boolean> { const shelf = this.shelves.find(s => s.id === shelfId); if (!shelf || shelf.isSystem) { logger.warn(TAG, `无法删除书架: ${shelfId} (不存在或为系统书架)`); return false; } this.shelves = this.shelves.filter(s => s.id !== shelfId); await this.save...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteShelf AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left shelfId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async deleteShelf(shelfId: string): Promise<boolean> { const shelf = this.shelves.find(s => s.id === shelfId); if (!shelf || shelf.isSystem) { logger.warn(TAG, `无法删除书架: ${shelfId} (不存在或为系统书架)`); return false; } this.shelves = this.shelves.filter(s => s.id !== shelfId); await this.save...
https://github.com/DaLongZhuaZi/manxia
d5edb24f7457e00648b1ed87a3042989fbbad4e7
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/DataMapper.ets
arkts
fromResultSet
从结果集转换为实体数据数组 @param rows 结果集行数组 @returns 实体数据数组
fromResultSet(rows: Array<ResultSetRow>): Array<EntityData> { const result: Array<EntityData> = [] for (let i = 0; i < rows.length; i++) { result.push(this.fromResultSetRow(rows[i])) } return result }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fromResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rows AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR...
fromResultSet(rows: Array<ResultSetRow>): Array<EntityData> { const result: Array<EntityData> = [] for (let i = 0; i < rows.length; i++) { result.push(this.fromResultSetRow(rows[i])) } return result }
https://github.com/offlinecat-dev/OCNetORM
19cd82f8f9e94e84ba851e9dd5ff93798be018d9
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/CfClearanceRefreshService.ets
arkts
callRcEndpoint
--------------------------------------------------------------------------- rc 端点调用 ---------------------------------------------------------------------------
private async callRcEndpoint(id: string, chlId: string, secondaryToken: string, sitekey: string): Promise<void> { this.callingRc = true; const httpRequest = http.createHttp(); try { await this.cookieStore.init(); const url: string = `${AppConstants.BASE_URL}/cdn-cgi/challenge-platform/h/g/rc/$...
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 callRcEndpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : A...
private async callRcEndpoint(id: string, chlId: string, secondaryToken: string, sitekey: string): Promise<void> { this.callingRc = true; const httpRequest = http.createHttp(); try { await this.cookieStore.init(); const url: string = `${AppConstants.BASE_URL}/cdn-cgi/challenge-platform/h/g/rc/$...
https://github.com/Amaz1ny/HarmonyDO-public
f2d7f8e533090136b612595f36771479815150f8
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
couldReset
Current image whether can reset. @returns true means can reset, false means not.
couldReset(): boolean { let crop = this.cropShow.getCropRect(); MathUtils.roundOutRect(crop); let image = this.cropShow.getImageRect(); MathUtils.roundOutRect(image); if ( this.isFlipHorizontal !== false || this.isFlipVertically !== false || this.rotationAngle !== 0 || this.s...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left couldReset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statemen...
couldReset(): boolean { let crop = this.cropShow.getCropRect(); MathUtils.roundOutRect(crop); let image = this.cropShow.getImageRect(); MathUtils.roundOutRect(image); if ( this.isFlipHorizontal !== false || this.isFlipVertically !== false || this.rotationAngle !== 0 || this.s...
https://gitee.com/openharmony/codelabs.git
cf92a88b7b26a35839e7d7b942678a73c9ee44cc
gitee
HarmonyOS_Samples/BestPracticeSnippets
DealStrideSolution/entry/src/main/ets/utils/CameraServiceOne.ets
arkts
releaseCamera
Release the session and related parameters
async releaseCamera(): Promise<void> { Logger.info(TAG, 'releaseCamera is called'); try { await this.receiver?.release(); } catch (err) { Logger.error(TAG, `imageReceiver release fail: error: ${JSON.stringify(err)}`); } try { await this.previewOutput?.release(); } catch (err)...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left releaseCamera 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 A...
async releaseCamera(): Promise<void> { Logger.info(TAG, 'releaseCamera is called'); try { await this.receiver?.release(); } catch (err) { Logger.error(TAG, `imageReceiver release fail: error: ${JSON.stringify(err)}`); } try { await this.previewOutput?.release(); } catch (err)...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
5746e46b9e571d8edbd1b30d42224c87aa75f97d
gitcode
XHXYT/Pixark
entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
activeTabs
获取当前激活的 Tab 列表
get activeTabs(): RankTab[] { // 根据模式选择对应的配置数组 const modes = appSettings.novel_mode ? (appSettings.novel_rank_modes || Object.keys(FunctionConstants.NOVEL_RANK_MODES)) : appSettings.rank_modes; return modes.map(key => { const tab = new RankTab(); tab.key = key; // 根据模式取对应的 la...
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left activeTabs 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 RankTab AST#identifi...
get activeTabs(): RankTab[] { // 根据模式选择对应的配置数组 const modes = appSettings.novel_mode ? (appSettings.novel_rank_modes || Object.keys(FunctionConstants.NOVEL_RANK_MODES)) : appSettings.rank_modes; return modes.map(key => { const tab = new RankTab(); tab.key = key; // 根据模式取对应的 la...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/RankViewModel.ets#L39-L53
fb38bd846c442b588f0cd33163d544e0eba3e6e0
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/MoonBridge.ets
arkts
getMicPortNumber
========================================================================== 麦克风 ==========================================================================
getMicPortNumber(): number { return nativeLib.getMicPortNumber(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMicPortNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#state...
getMicPortNumber(): number { return nativeLib.getMicPortNumber(); }
https://github.com/AlkaidLab/moonlight-harmony
63d8acc9558965b57fe7389d98efe5b29e27e734
github
Vsolon0401/MallShopping
common/src/main/ets/utils/Preferences.ets
arkts
createPreferences
创建首选项实例 @param context: 应用上下文 @param preferencesName: 数据库表名 @returns
createPreferences(context): Promise<dataPreferences.Preferences> { let preferences = dataPreferences.getPreferences(context, this.preferencesName) GlobalContext.getContext().setObject(this.keyPreferences, preferences) return }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left createPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left context AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Lef...
createPreferences(context): Promise<dataPreferences.Preferences> { let preferences = dataPreferences.getPreferences(context, this.preferencesName) GlobalContext.getContext().setObject(this.keyPreferences, preferences) return }
https://github.com/Vsolon0401/MallShopping
641e47f10725e5978e865656d0172c79f5802d77
github
HarmonyOS_Samples/MusicHome
features/playlist/src/main/ets/view/PlaylistFloatingMiniBar.ets
arkts
build
Builds the full-width mini player: non-immersive uses sheet background; immersive uses `floating_mini_bar_immersive_background`.
build() { Column() { MiniBarPlayer({ showPreviousTrack: true, followAppMiniBarExpanded: false }) } .width(StyleConstants.FULL_WIDTH) .backgroundColor( this.windowInfo.immersiveDecor === ImmersiveType.IMMERSIVE ? $r('app.color.floating_mini_bar_immersive_background') : $r('a...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { MiniBarPlayer({ showPreviousTrack: true, followAppMiniBarExpanded: false }) } .width(StyleConstants.FULL_WIDTH) .backgroundColor( this.windowInfo.immersiveDecor === ImmersiveType.IMMERSIVE ? $r('app.color.floating_mini_bar_immersive_background') : $r('a...
https://gitcode.com/HarmonyOS_Samples/MusicHome
b66a9c95ad37425090507ba901e0b961947fbf27
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/microphone/MicrophoneStream.ets
arkts
pause
暂停麦克风流
async pause(): Promise<void> { if (!this.running || this.paused) { return; } this.paused = true; this.moonBridge.nativeMicPause(); this.notifyStateChanged(MicrophoneState.PAUSED); console.info(TAG, '麦克风流已暂停'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left pause AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef...
async pause(): Promise<void> { if (!this.running || this.paused) { return; } this.paused = true; this.moonBridge.nativeMicPause(); this.notifyStateChanged(MicrophoneState.PAUSED); console.info(TAG, '麦克风流已暂停'); }
https://github.com/AlkaidLab/moonlight-harmony
747ec90b58ff34b980dd3737ee8dce338ab84eb8
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/pages/authority-management.ets
arkts
getAllGroupPermission
Get permission group information
getAllGroupPermission() { groups.forEach((item) => { if (item.isShow) { this.allGroups.push(item.name); } }) this.allUserPermissions.forEach((userPermission: Permission) => { let groupId = getGroupIdByPermission(userPermission); if (this.allGroups.indexOf(groups[groupId].na...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAllGroupPermission 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_bl...
getAllGroupPermission() { groups.forEach((item) => { if (item.isShow) { this.allGroups.push(item.name); } }) this.allUserPermissions.forEach((userPermission: Permission) => { let groupId = getGroupIdByPermission(userPermission); if (this.allGroups.indexOf(groups[groupId].na...
https://gitee.com/openharmony/applications_permission_manager.git
877e86b1e49b153a0cbd845b0238ad2ccc7f8e36
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets
arkts
formatCoverTitle
格式化封面标题(处理过长的标题)
static formatCoverTitle(title: string): string { // 移除文件扩展名 let cleanTitle = title.replace(/\.(txt|epub|pdf|mobi|azw3?)$/i, ''); // 如果标题过长,截断并添加省略号 if (cleanTitle.length > 20) { cleanTitle = cleanTitle.substring(0, 17) + '...'; } return cleanTitle; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatCoverTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static formatCoverTitle(title: string): string { // 移除文件扩展名 let cleanTitle = title.replace(/\.(txt|epub|pdf|mobi|azw3?)$/i, ''); // 如果标题过长,截断并添加省略号 if (cleanTitle.length > 20) { cleanTitle = cleanTitle.substring(0, 17) + '...'; } return cleanTitle; }
https://github.com/DaLongZhuaZi/manxia
cf73aed5ce7157e897fa8b6927a5ca9ed38b9540
github
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/data/UserRdb.ets
arkts
updateAvatar
========== 核心修复:更新头像前先初始化数据库 ==========
async updateAvatar(avatar: string): Promise<number> { // 关键:如果未初始化且有上下文,先初始化数据库 if (!this.rdbStore && !this.isMock && this.context) { await this.getRdbStore(this.context); } if (this.isMock) { this.mockData.avatar = avatar; return 1; // 更新成功返回1 } if (!this.rdbStore) { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateAvatar AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left avatar AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async updateAvatar(avatar: string): Promise<number> { // 关键:如果未初始化且有上下文,先初始化数据库 if (!this.rdbStore && !this.isMock && this.context) { await this.getRdbStore(this.context); } if (this.isMock) { this.mockData.avatar = avatar; return 1; // 更新成功返回1 } if (!this.rdbStore) { ...
https://gitcode.com/openharmony/codelabs
6684bc59630d226def03a71a3ff4f218c3c6ae85
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
reorderShelves
重新排序书架
async reorderShelves(shelves: TypeShelf[]): Promise<void> { this.shelves = shelves; this.shelves.forEach((shelf, index) => { shelf.order = index; }); await this.saveShelves(); logger.info(TAG, `重新排序书架,共 ${shelves.length} 个`); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reorderShelves AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Le...
async reorderShelves(shelves: TypeShelf[]): Promise<void> { this.shelves = shelves; this.shelves.forEach((shelf, index) => { shelf.order = index; }); await this.saveShelves(); logger.info(TAG, `重新排序书架,共 ${shelves.length} 个`); }
https://github.com/DaLongZhuaZi/manxia
8d0f81f23dd7132d47f1afa2cf26664ba7c356e7
github
who7708/harmonyos-codelabs
HmosWorld/commons/common/src/main/ets/service/datasource/network/agc/FuncNetwork.ets
arkts
getCollectResources
@param userId @returns LearningResource[]
public getCollectResources(): Promise<LearningResource[]> { const params: UserIdParams = { userId: (AppStorage.get<UserAccount>('user') as UserAccount)?.id }; return new Promise(((resolve: (value: LearningResource[] | PromiseLike<LearningResource[]>) => void, reject: (reason...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCollectResources 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#instantiation_expr...
public getCollectResources(): Promise<LearningResource[]> { const params: UserIdParams = { userId: (AppStorage.get<UserAccount>('user') as UserAccount)?.id }; return new Promise(((resolve: (value: LearningResource[] | PromiseLike<LearningResource[]>) => void, reject: (reason...
https://github.com/who7708/harmonyos-codelabs
bc9205f6ab0d195142ee6211e51073fcc902c437
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
getCoverImageRadius
获取封面图片圆角
private getCoverImageRadius(): number { return this.userThemeCoverCornerRadius; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCoverImageRadius 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 num...
private getCoverImageRadius(): number { return this.userThemeCoverCornerRadius; }
https://github.com/DaLongZhuaZi/manxia
4b301d25577b8986f0e7fefc16a35ca680856a3c
github
OHPG/FinSdk
jellyfin/src/main/ets/api/SessionApi.ets
arkts
displayContent
displayContent @summary Instructs a session to browse to an item or view. @param {SessionApiDisplayContentRequest} requestParameters Request parameters. @throws {RequiredError} @memberof SessionApi
public async displayContent(requestParameters: SessionApiDisplayContentRequest): Promise<void> { this.assertParam(requestParameters.sessionId) return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Viewing`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left displayContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AS...
public async displayContent(requestParameters: SessionApiDisplayContentRequest): Promise<void> { this.assertParam(requestParameters.sessionId) return this.apiClient.post({path: `/Sessions/${requestParameters.sessionId}/Viewing`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
32ef5fa222e503847a9ff5dbf05e483dc588771a
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FollowManager.ets
arkts
getFollowingList
Get list of users this user is following 优先从服务器获取
static async getFollowingList(username: string, userId?: number): Promise<string[]> { try { // 服务器模式下优先从服务器获取 if (SERVER_ENABLED) { try { const response = await FollowApi.getFollowing(userId); console.info(`FollowManager: getFollowingList response code=${response.code}`); ...
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 getFollowingList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Lef...
static async getFollowingList(username: string, userId?: number): Promise<string[]> { try { // 服务器模式下优先从服务器获取 if (SERVER_ENABLED) { try { const response = await FollowApi.getFollowing(userId); console.info(`FollowManager: getFollowingList response code=${response.code}`); ...
https://github.com/Harrisonls2004/WaterFlow
2e29ded0ca2eb9472fa31193347758e8a6d18892
github
openharmony/codelabs
Data/NotePadOpenHarmony/entry/src/main/ets/viewmodel/NotesInfoViewModel.ets
arkts
constructor
constructor.
constructor(noteId: string, title: string, folder: FolderType, time: string, isFavorite: boolean, imageArr: string[], content: string) { this.noteId = noteId; this.title = title; this.folder = folder; this.time = time; this.isFavorite = isFavorite; this.imageArr = imageArr; t...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left noteId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right...
constructor(noteId: string, title: string, folder: FolderType, time: string, isFavorite: boolean, imageArr: string[], content: string) { this.noteId = noteId; this.title = title; this.folder = folder; this.time = time; this.isFavorite = isFavorite; this.imageArr = imageArr; t...
https://gitee.com/openharmony/codelabs.git
f9cb6ba66ad8ab777471e444af374cc82ef21ec7
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getConstant
Returns ith constant of this enum @param {long} i Index @returns {EnumConstant} Enum constant @throws {Error} Not implemented yet @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getConstant(i: long): EnumConstant { // NOTE(shumilov-petr): not implemented throw new Error("not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getConstant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AS...
public getConstant(i: long): EnumConstant { // NOTE(shumilov-petr): not implemented throw new Error("not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
ccb1acf6e0a32c409c07d74825956ba87eea73a8
gitcode
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/viewmodel/BaseHomeViewModel.ets
arkts
handleListOffset
监听列表偏移 @param offsetParam OffsetParam
protected handleListOffset(offsetParam: OffsetParam): void { Logger.debug(TAG, `onDidScroll: ${JSON.stringify(offsetParam)}`) const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO)! const isDark: boolean = AppStorage.get(StorageKeyEnum.COLOR_MODE) === ConfigurationConsta...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleListOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offsetParam AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
protected handleListOffset(offsetParam: OffsetParam): void { Logger.debug(TAG, `onDidScroll: ${JSON.stringify(offsetParam)}`) const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO)! const isDark: boolean = AppStorage.get(StorageKeyEnum.COLOR_MODE) === ConfigurationConsta...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
421ac68678d711ad37a1f1d6ffe5c3472ac88e04
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets
arkts
getReminderContent
获取提醒内容
private getReminderContent(event: CalendarEvent): string { const startTime = new Date(event.startTime); if (event.allDay) { const dateStr = startTime.toLocaleDateString('zh-CN'); return `全天日程 · ${dateStr}${event.location ? ` · ${event.location}` : ''}`; } const timeStr = startTime.toLoca...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getReminderContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private getReminderContent(event: CalendarEvent): string { const startTime = new Date(event.startTime); if (event.allDay) { const dateStr = startTime.toLocaleDateString('zh-CN'); return `全天日程 · ${dateStr}${event.location ? ` · ${event.location}` : ''}`; } const timeStr = startTime.toLoca...
https://gitcode.com/openharmony/codelabs
19c410749823e3efed188e8cdb685b15b49f188a
gitcode
yuyu5333/Healthy_life
entry/src/main/ets/view/task/TaskDeleteComponent.ets
arkts
build
TaskDeleteDialog:CustomDialogController = new CustomDialogController({ builder: TaskDeleteDialog({}) } )
build() { List({ space: Const.LIST_ITEM_SPACE }) { ForEach(this.taskList, (item: ITaskItem) => { if(item?.isOpen) { ListItem() { Row() { Row() { Image(item?.icon) .width(Const.DEFAULT_24) .height(Const.DE...
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() { List({ space: Const.LIST_ITEM_SPACE }) { ForEach(this.taskList, (item: ITaskItem) => { if(item?.isOpen) { ListItem() { Row() { Row() { Image(item?.icon) .width(Const.DEFAULT_24) .height(Const.DE...
https://github.com/yuyu5333/Healthy_life
957678bdd0c07bb18efa862ac1cd84cbd88e8bee
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets
arkts
deleteRuleFromDb
从数据库删除规则
private async deleteRuleFromDb(id: string): Promise<void> { try { const dataManager = getNovelDataManager(); const store = dataManager.getStore(); await store.executeSql('DELETE FROM novel_dict_rule WHERE id = ?', [id]); } catch (error) { logger.error(TAG, `删除字典规则失败: ${String(error)}`)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteRuleFromDb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left :...
private async deleteRuleFromDb(id: string): Promise<void> { try { const dataManager = getNovelDataManager(); const store = dataManager.getStore(); await store.executeSql('DELETE FROM novel_dict_rule WHERE id = ?', [id]); } catch (error) { logger.error(TAG, `删除字典规则失败: ${String(error)}`)...
https://github.com/DaLongZhuaZi/manxia
f43aaf5a6e21e8c0eb7c7578cfdd310acb73a440
github
erosTeam/NextE
shared/src/main/ets/services/MotionHandStateService.ets
arkts
reportFollowOperationX
followOperation: a tap near the left/right edge slides the button toward that side (center safe-zone is ignored so normal mid-screen taps don't fight the button). Throttled to avoid thrash.
static reportFollowOperationX(x: number, width: number): void { if ( MotionHandStateService.effectiveAlignmentMode() !== ActionAlignmentSettings.MODE_FOLLOW_OPERATION ) { return } const nextEdge: MotionHandEdge | null = MotionHandStateService.edgeForFollowOperationX(x, width) if ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left reportFollowOperationX 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#L...
static reportFollowOperationX(x: number, width: number): void { if ( MotionHandStateService.effectiveAlignmentMode() !== ActionAlignmentSettings.MODE_FOLLOW_OPERATION ) { return } const nextEdge: MotionHandEdge | null = MotionHandStateService.edgeForFollowOperationX(x, width) if ...
https://github.com/erosTeam/NextE
752b7f219288c177bb4c5eb89aff43ba541d567c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartCategory.ets
arkts
isAmountInRange
检查金额是否在范围内
isAmountInRange(amount: number): boolean { return amount >= this.amountMin && amount <= this.amountMax; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAmountInRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left amount AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left...
isAmountInRange(amount: number): boolean { return amount >= this.amountMin && amount <= this.amountMax; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
0fe370b444a09ac87d177b167352cdaf5e461c97
github
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
notifyDataChange
通知数据变更
protected notifyDataChange(): void { const data = this.getData(); this.dataListeners.forEach(listener => { try { listener(data); } catch (error) { console.error('[BaseChart] 数据监听器执行失败:', error); } }); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left notifyDataChange 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 vo...
protected notifyDataChange(): void { const data = this.getData(); this.dataListeners.forEach(listener => { try { listener(data); } catch (error) { console.error('[BaseChart] 数据监听器执行失败:', error); } }); }
https://github.com/LJ666-ui/harmony-health-care
7b2fb03df6759c2b30bd40e70fd2441fb0ddd311
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
ensureCustomFontRegistered
确保指定自定义字体已注册到当前或指定 UIContext。
private async ensureCustomFontRegistered(fontId: string, scene: FontScene, uiContext?: UIContext | null): Promise<void> { const customFont = this.customFonts.find((font: CustomFont) => font.id === fontId); if (!customFont) { throw new Error(`未找到${scene}自定义字体: ${fontId}`); } await this.registerF...
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 ensureCustomFontRegistered AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fontId AST#identifier#Righ...
private async ensureCustomFontRegistered(fontId: string, scene: FontScene, uiContext?: UIContext | null): Promise<void> { const customFont = this.customFonts.find((font: CustomFont) => font.id === fontId); if (!customFont) { throw new Error(`未找到${scene}自定义字体: ${fontId}`); } await this.registerF...
https://github.com/DaLongZhuaZi/manxia
b707be63609d8e6d19b7b055b463d0353366fcc7
github
LongLiveY96/chatcube
entry/src/main/ets/services/ModelCapabilityMatcher.ets
arkts
loadPersistedLogoIndex
批量匹配并填充模型能力,返回成功匹配数量 已废弃:能力现在走 ModelInfo 派生(见 utils/ModelCapabilityDeriver.ets),不再写回 ModelInfo 本类保留 logo 相关方法供 ProviderIconUtils 使用 启动时加载持久化的模型图标索引
async loadPersistedLogoIndex(): Promise<void> { if (this.isPersistedLogoIndexLoaded) { return } const prefs = getPreferencesService() const raw = await prefs.getString(PreferenceKeys.MODEL_LOGO_INDEX_JSON, '') this.persistedLogoIndex.clear() if (raw !== '') { try { const ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadPersistedLogoIndex AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotati...
async loadPersistedLogoIndex(): Promise<void> { if (this.isPersistedLogoIndexLoaded) { return } const prefs = getPreferencesService() const raw = await prefs.getString(PreferenceKeys.MODEL_LOGO_INDEX_JSON, '') this.persistedLogoIndex.clear() if (raw !== '') { try { const ...
https://github.com/LongLiveY96/chatcube
1d4eb9036ebbf913c015a12122256ef050eff0d9
github
cpdd5201314/harmonyOS-music-app
common/mediaCommon/src/main/ets/utils/request.ets
arkts
clearTokenFromStorage
清除storage中的Token(用于token过期时)
async function clearTokenFromStorage(): Promise<void> { try { const storageInst = await storage.getStorage(STORAGE_PATH); storageInst.delete('user_token'); await storageInst.flush(); } catch (error) { const err = error as BusinessError; console.error('清除Token失败:', err.message || err.code); } }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left clearTokenFromStorage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Le...
async function clearTokenFromStorage(): Promise<void> { try { const storageInst = await storage.getStorage(STORAGE_PATH); storageInst.delete('user_token'); await storageInst.flush(); } catch (error) { const err = error as BusinessError; console.error('清除Token失败:', err.message || err.code); } }
https://github.com/cpdd5201314/harmonyOS-music-app
771f8a16277463d8055b28c539cdfb94b75fe733
github
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
getCacheDirPath
获取缓存目录下的文件夹路径或文件路径(保留用于缓存清理等功能) @param dirPath 文件路径;支持完整路径和相对路径(download/wps/doc);dirPath传空字符串表示根目录 @param fileName 文件名(test.text);fileName传空字符串表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns 缓存目录路径
static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { try { const context = LubanUtils.getContext(); let filePath = blHap ? context.cacheDir : context.getApplicationContext().cacheDir; // 根目录 if (dirPath && dirPath.trim() !== "") { if (Luba...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCacheDirPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dirPath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_ex...
static getCacheDirPath(dirPath: string = "", fileName: string = "", blHap: boolean = true): string { try { const context = LubanUtils.getContext(); let filePath = blHap ? context.cacheDir : context.getApplicationContext().cacheDir; // 根目录 if (dirPath && dirPath.trim() !== "") { if (Luba...
https://github.com/kumaleap/ArkLuban
a17cfa74f0dfc4ac83571ec82c3401663f7b372e
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/pages/ProtocolWebView.ets
arkts
showToast
Toast message.
showToast(resource: Resource) { try { this.getUIContext().getPromptAction().showToast({ message: resource, duration: 2000 }); } catch (error) { const message = error.message as string; const code = error.code as string; hilog.error(domainId, logTag, `Failed to sho...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Rig...
showToast(resource: Resource) { try { this.getUIContext().getPromptAction().showToast({ message: resource, duration: 2000 }); } catch (error) { const message = error.message as string; const code = error.code as string; hilog.error(domainId, logTag, `Failed to sho...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
90e263dd94481dc89af6e6ccf1bd938bb6bbbfd0
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
isEmpty
Checks if the LightWeightMap is empty @returns true if the LightWeightMap is empty, false otherwise
isEmpty(): boolean { return this.buckets.actualLength === 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b...
isEmpty(): boolean { return this.buckets.actualLength === 0; }
https://gitcode.com/iop123123/arkts-static-skills
165b0f1d619d77c154d66f5a56d3cb726e8839d6
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
selectRaw
设置原生 SELECT 表达式(用于聚合查询) @param expressions 表达式数组,如 ['category', 'COUNT(*) as count', 'SUM(price) as total'] @returns 当前实例(支持链式调用)
selectRaw(expressions: Array<string>): QueryBuilder { this.selectRawExpressions = validateAndNormalizeSelectRawExpressions(expressions) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left expressions AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST#identifier#...
selectRaw(expressions: Array<string>): QueryBuilder { this.selectRawExpressions = validateAndNormalizeSelectRawExpressions(expressions) return this }
https://github.com/offlinecat-dev/OCNetORM
d4498d496bd125f97f52d03b8fe5a8d24dd083b1
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
getCurrentSearchLineIndex
获取当前搜索匹配的行索引(用于滚动定位)
getCurrentSearchLineIndex(): number { if (this.searchMatches.length === 0) return -1; return this.searchMatches[this.searchCurrentIndex].lineIndex; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentSearchLineIndex 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 ...
getCurrentSearchLineIndex(): number { if (this.searchMatches.length === 0) return -1; return this.searchMatches[this.searchCurrentIndex].lineIndex; }
https://github.com/XJTUWYD/ArkDiff
7244a2e1fd1b45df89882fe24d5fcece4dd2abd8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
fontsize
The fontsize() method creates a string that embeds a string in a <font> element (<font size="...">str</font>), which causes a string to be displayed in the specified font size. @param { int } size @returns { String } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fontsize(size: int): String{ return this.CreateHTMLString('font', ' size=\"' + size + '\"') }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fontsize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Righ...
public fontsize(size: int): String{ return this.CreateHTMLString('font', ' size=\"' + size + '\"') }
https://gitcode.com/iop123123/arkts-static-skills
5ebf4fb1d5d681033879d9f5d86aa8f3634a4b71
gitcode
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/pages/aiinsight/AIInsightState.ets
arkts
backToHome
从对话流返回首页。
backToHome(): void { this.errorMessage = ''; this.viewMode = 'home'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left backToHome 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#L...
backToHome(): void { this.errorMessage = ''; this.viewMode = 'home'; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/pages/aiinsight/AIInsightState.ets#L327-L330
2d1aa66828e261a7c7de1ac9e27d8de96d8e9381
github
CLMC2025/Vignette
entry/src/main/ets/manager/SessionPlanner.ets
arkts
getTaskDistribution
获取任务类型分布统计
getTaskDistribution(tasks: TaskItem[]): Map<TaskType, number> { const distribution = new Map<TaskType, number>(); for (const task of tasks) { const count = distribution.get(task.type) ?? 0; distribution.set(task.type, count + 1); } return distribution; }
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTaskDistribution AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tasks AST#identifier#Right AST#:#Left : AST#:#Right ...
getTaskDistribution(tasks: TaskItem[]): Map<TaskType, number> { const distribution = new Map<TaskType, number>(); for (const task of tasks) { const count = distribution.get(task.type) ?? 0; distribution.set(task.type, count + 1); } return distribution; }
https://github.com/CLMC2025/Vignette
bb1cc810ddd95ca415b2ef15426f8cf47faa50ef
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
stringifyJsonElement
Converts a JsonElement to a JSON string with optional formatting. @param elem - The JsonElement to stringify @param replacer - Array of keys to include (currently not implemented) @param space - String or number of spaces for indentation @returns The JSON string representation
public static stringifyJsonElement(elem: jsonx.JsonElement, replacer?: (double | string)[], space?: int | string): string { return stringifyElementRecursively(elem, replacer, space, 0) }
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 stringifyJsonElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elem AST#identifier#Right AST#:#Le...
public static stringifyJsonElement(elem: jsonx.JsonElement, replacer?: (double | string)[], space?: int | string): string { return stringifyElementRecursively(elem, replacer, space, 0) }
https://gitcode.com/iop123123/arkts-static-skills
e37dd6ef7680a18f45286afb47b4aad92253d425
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/RouterUtils.ets
arkts
getStack
获取栈 @returns
public static getStack(name?: string): NavPathStack { if (name) { return RouterUtils.stackMap.get(name) || new NavPathStack(); } return RouterUtils.stackMap.get(StackEnum.Main) || new NavPathStack(); }
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 getStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#?#Left ? AST#?#R...
public static getStack(name?: string): NavPathStack { if (name) { return RouterUtils.stackMap.get(name) || new NavPathStack(); } return RouterUtils.stackMap.get(StackEnum.Main) || new NavPathStack(); }
https://github.com/xblLab/HarmonyProjectTemplate
3ef09384f6c101d92c1d16fceb1ee8f3ce00ca90
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/SyncService.ets
arkts
addToSyncQueue
添加同步记录
addToSyncQueue(entityType: string, entityId: string, operation: string, data: string): void { const record: SyncRecord = { id: this.generateId(), entityType: entityType, entityId: entityId, operation: operation, data: data, timestamp: Date.now(), status: 'PENDING' }; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToSyncQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AS...
addToSyncQueue(entityType: string, entityId: string, operation: string, data: string): void { const record: SyncRecord = { id: this.generateId(), entityType: entityType, entityId: entityId, operation: operation, data: data, timestamp: Date.now(), status: 'PENDING' }; ...
https://github.com/LJ666-ui/harmony-health-care
f231a074a34b4f49ba43f8341950855a20e04e2d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets
arkts
getKomgaCache
获取Komga Tab缓存
getKomgaCache(): KomgaCacheData | null { return this.komgaCache; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getKomgaCache 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 KomgaCacheData AST#id...
getKomgaCache(): KomgaCacheData | null { return this.komgaCache; }
https://github.com/DaLongZhuaZi/manxia
f42db1a80a4c5cf6da7ff63cba773b7f69428c65
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getLazyRelationNames
获取延迟加载的关联关系名称列表
getLazyRelationNames(): Array<string> { return this.lazyRelationNames.slice() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLazyRelationNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argumen...
getLazyRelationNames(): Array<string> { return this.lazyRelationNames.slice() }
https://github.com/offlinecat-dev/OCNetORM
5dff45ef9c635ecea288adc291780e78742ca010
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
constructor
The great tunnel for local window messaging! *TEMPORARY* but often NOT cleared after reception.
constructor(want: Want, windowId: string, workingDirectory: string) { this.launchWant = want; this.windowId = windowId; this.workingDir = workingDirectory; // Determine isZone const paths = workingDirectory.split('/'); paths.pop(); // Zone alias name, should be == windowId this.isZone = pa...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST...
constructor(want: Want, windowId: string, workingDirectory: string) { this.launchWant = want; this.windowId = windowId; this.workingDir = workingDirectory; // Determine isZone const paths = workingDirectory.split('/'); paths.pop(); // Zone alias name, should be == windowId this.isZone = pa...
https://github.com/awaLiny2333/LinysBrowser_NEXT
c5bb94e78ea88613bf1129a58b8a1f7f341918f4
github
youyeyejie/ZhiXing_ActHub
entry/src/test/TodoTestDataHelper.ets
arkts
printTodoStats
打印待办统计信息
async printTodoStats(): Promise<void> { try { const allTodos = await this.repository.findAll(); const unfinished = allTodos.filter(todo => todo.isDone === 0); const finished = allTodos.filter(todo => todo.isDone === 1); const testTodos = allTodos.filter(todo => todo.id.startsWith('test_tod...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left printTodoStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async printTodoStats(): Promise<void> { try { const allTodos = await this.repository.findAll(); const unfinished = allTodos.filter(todo => todo.isDone === 0); const finished = allTodos.filter(todo => todo.isDone === 1); const testTodos = allTodos.filter(todo => todo.id.startsWith('test_tod...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/test/TodoTestDataHelper.ets#L155-L180
4bcfe1e2f8ad9ee4ca30cb59c7a4f06747204346
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Float32Array with respect to length. @param { number } length - Number of elements @throws { RangeError } - If the length is outside the bounds of the buffer, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Float32Array.BYTES_PER_ELEMENT).toInt()) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLength = t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public constructor(length: number) { if (length < 0 || length > (Int.MAX_VALUE / Float32Array.BYTES_PER_ELEMENT).toInt()) { throw new RangeError("Range Error: length " + length + " is outside the bounds of the buffer") } this.lengthInt = length.toInt() this.byteLength = t...
https://gitcode.com/iop123123/arkts-static-skills
2466937bb837857562ba8c13bf0ed4077ee23c18
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
searchBooks
搜索书库中的小说
async searchBooks(keyword: string): Promise<NovelBook[]> { const store = this.getStore(); const searchPattern = `%${keyword}%`; const rs = await store.querySql( `SELECT * FROM novel_book WHERE isFavorite = 1 AND (name LIKE ? OR author LIKE ?) ORDER BY lastReadTime DESC`, [searchPattern, search...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchBooks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async searchBooks(keyword: string): Promise<NovelBook[]> { const store = this.getStore(); const searchPattern = `%${keyword}%`; const rs = await store.querySql( `SELECT * FROM novel_book WHERE isFavorite = 1 AND (name LIKE ? OR author LIKE ?) ORDER BY lastReadTime DESC`, [searchPattern, search...
https://github.com/DaLongZhuaZi/manxia
544b6fef51325752e7e3c9cba8fbf0bb6990e75e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
getPluginStats
获取插件统计信息
public getPluginStats(): PluginStats { const totalPlugins = this.pluginRegistry.size; const enabledPlugins = Array.from(this.pluginRegistry.values()).filter(p => p.isEnabled).length; const loadedPlugins = this.loadedPlugins.size; const updateAvailable = 0; // 需要实现更新检查逻辑 return { totalPl...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPluginStats 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 PluginS...
public getPluginStats(): PluginStats { const totalPlugins = this.pluginRegistry.size; const enabledPlugins = Array.from(this.pluginRegistry.values()).filter(p => p.isEnabled).length; const loadedPlugins = this.loadedPlugins.size; const updateAvailable = 0; // 需要实现更新检查逻辑 return { totalPl...
https://github.com/DaLongZhuaZi/manxia
2de145d11204418a02f79e3588476d4b1b2b884f
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
getByUserId
根据用户ID查询训练记录列表
static async getByUserId( userId: number, limit: number = 100, offset: number = 0 ): Promise<SmartCategoryTraining[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${SmartCategoryTraining.tableName} WHERE user_id = ? AND is_delet...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST...
static async getByUserId( userId: number, limit: number = 100, offset: number = 0 ): Promise<SmartCategoryTraining[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM ${SmartCategoryTraining.tableName} WHERE user_id = ? AND is_delet...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
420f71f2e10ed7a4421499602754b4f0430c8979
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets
arkts
forEach
Executes a provided function once for each array element. @param callbackfn - The function to execute on each element, taking the value, index, and ArrayList as arguments.
public forEach(callbackfn: ArrayListForEachCb<T>): void { for (let i: int = 0; i < this.length; i++) { callbackfn(this.buffer[i], i, this); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
public forEach(callbackfn: ArrayListForEachCb<T>): void { for (let i: int = 0; i < this.length; i++) { callbackfn(this.buffer[i], i, this); } }
https://gitcode.com/iop123123/arkts-static-skills
725bbc2ba299ebf23b25a3bcad930d5d865b6860
gitcode
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/RdbManager.ets
arkts
getAllPlaylists
==================== 数据查询逻辑 ==================== 获取所有歌单及其包含的歌曲 用于还原成 SongListItemType[] 格式
async getAllPlaylists(): Promise<SongListItemType[]> { if (!this.rdbStore) return []; const result: SongListItemType[] = []; // 1. 查询所有歌单 const predicates = new relationalStore.RdbPredicates(this.tableNamePlaylist); const playlistSet = await this.rdbStore.query(predicates); while (playlistS...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllPlaylists 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 : A...
async getAllPlaylists(): Promise<SongListItemType[]> { if (!this.rdbStore) return []; const result: SongListItemType[] = []; // 1. 查询所有歌单 const predicates = new relationalStore.RdbPredicates(this.tableNamePlaylist); const playlistSet = await this.rdbStore.query(predicates); while (playlistS...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L140-L194
4c165203514d864fa96b064bae7a00d93a7a186d
github
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/utils/CityClockCardUtil.ets
arkts
getCurrentFormattedDateWithWeek
getCurrentFormattedDateWithWeek @param timeZone timeZone @returns
public static getCurrentFormattedDateWithWeek(timeZone: string): string { const calendar = i18n.getCalendar(i18n.System.getSystemLocale()); calendar.setTimeZone(timeZone); let year: number = calendar.get(CalendarFiled.Year); let month: number = calendar.get(CalendarFiled.Month); let date: number =...
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 getCurrentFormattedDateWithWeek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeZone AST#identifier#Right AST#ERRO...
public static getCurrentFormattedDateWithWeek(timeZone: string): string { const calendar = i18n.getCalendar(i18n.System.getSystemLocale()); calendar.setTimeZone(timeZone); let year: number = calendar.get(CalendarFiled.Year); let month: number = calendar.get(CalendarFiled.Month); let date: number =...
https://gitee.com/openharmony-sig/applications_clock.git
8d9abce2ed076b8033fec2d3620d98a840b4ed2f
gitee
fbinba3955/Flymby
common/src/main/ets/utils/DateUtil.ets
arkts
getTodayStr
获取当前时间的格式化字符串 @param format 格式字符串,如 "HH:mm", "yyyy-MM-dd HH:mm:ss" @returns 格式化的时间字符串
static getTodayStr(format: string): string { const now = new Date(); switch (format) { case 'HH:mm': return `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`; case 'HH:mm:ss': return `${now.getHours().toString().padStart(2, '0')}:$...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTodayStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
static getTodayStr(format: string): string { const now = new Date(); switch (format) { case 'HH:mm': return `${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}`; case 'HH:mm:ss': return `${now.getHours().toString().padStart(2, '0')}:$...
https://github.com/fbinba3955/Flymby
48c0640402bebc3a09fd6ca543c0a3bdd76b7973
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test20_original_index.ets
arkts
testModuloPatterns
=== Round 20: Remainder/modulo patterns, bitwise shift assignment, compound assignment chains, nested ternary, string template in function args, default parameters, rest parameters (manual), Array.reduce, Array.sort with comparator, deep equality === === --- Remainder and modulo edge cases ---
function testModuloPatterns(): string { let a: number = 17 % 5; let b: number = -17 % 5; let c: number = 17 % -5; let d: number = -17 % -5; return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testModuloPatterns 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#predefin...
function testModuloPatterns(): string { let a: number = 17 % 5; let b: number = -17 % 5; let c: number = 17 % -5; let d: number = -17 % -5; return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d); }
https://github.com/miaochiahao/ark-ghidra
6aa31baef7b7000bb8bb942006d7674a4bebe256
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets
arkts
getNextOccurrence
获取下一次发生的时间
private getNextOccurrence(currentTime: number, repeatRule: RepeatRule): number { const currentDate = new Date(currentTime); switch (repeatRule.type) { case 'daily': currentDate.setDate(currentDate.getDate() + repeatRule.interval); break; case 'weekly': currentDate.setDate(...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNextOccurrence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
private getNextOccurrence(currentTime: number, repeatRule: RepeatRule): number { const currentDate = new Date(currentTime); switch (repeatRule.type) { case 'daily': currentDate.setDate(currentDate.getDate() + repeatRule.interval); break; case 'weekly': currentDate.setDate(...
https://gitcode.com/openharmony/codelabs
4fd93a1ac209dc032950feb269532a8e8b46ebe3
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
unshift
Adds the specified elements to the beginning of an Array and returns the new length of the Array. @param { T[] } values The elements to add to the front of the array. @returns { int } The new length of the array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public unshift(...values: T[]): int { const length: int = this.buffer.length if (length <= values.actualLength + this.actualLength) { let buffer: FixedArray<Any> = new FixedArray<Any>(length * 2 + values.actualLength) Array.unshiftInternal(this.buffer, this.actualLength, buff...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unshift AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#identifier#Left values AST#identifier#Right AST#spread_element#Right AS...
public unshift(...values: T[]): int { const length: int = this.buffer.length if (length <= values.actualLength + this.actualLength) { let buffer: FixedArray<Any> = new FixedArray<Any>(length * 2 + values.actualLength) Array.unshiftInternal(this.buffer, this.actualLength, buff...
https://gitcode.com/iop123123/arkts-static-skills
cfe1a29ba1fbed0726dc5f6149df525ce948fed0
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Short.ets
arkts
div
Performs shortegral division of this instance with provided one, returns the result as new instance @param other Right hand side of the division @returns Result of the division
public div(other: Short): Short { return Short.valueOf((this.value / other.shortValue()) as short) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left div AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public div(other: Short): Short { return Short.valueOf((this.value / other.shortValue()) as short) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3e347311bda5c07d428bc87bb1a340ce2f0e3dd7
gitee
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.Dialog.ets
arkts
isDefaultFocus
is button set default focus @param singleButton button options @param isHasDefaultFocus is button list has default focus button @param isAllFocusFalse is all button in button list default focus false @returns boolean
function isDefaultFocus(singleButton: ButtonOptions, isHasDefaultFocus: boolean, isAllFocusFalse: boolean): boolean { try { // 当前按钮为默认按钮 if (singleButton.defaultFocus) { return true; } let isDefaultFocus: boolean = false; if (isHasDefaultFocus || isAllFocusFalse) { isDefaultFocus = fal...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isDefaultFocus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left singleButton AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function isDefaultFocus(singleButton: ButtonOptions, isHasDefaultFocus: boolean, isAllFocusFalse: boolean): boolean { try { // 当前按钮为默认按钮 if (singleButton.defaultFocus) { return true; } let isDefaultFocus: boolean = false; if (isHasDefaultFocus || isAllFocusFalse) { isDefaultFocus = fal...
https://gitcode.com/openharmony/arkui_ace_engine
8cad793389d55c7048d90f18e7373520f2ae973b
gitcode
yangyongzhen/hmmovie
entry/src/main/ets/utils/EfAVPlayer.ets
arkts
release
用于释放多媒体播放器资源。
async release() { await this.avPlayer?.release(); this.avPlayer?.off("stateChange"); this.avPlayer?.off("error"); this.avPlayer?.off("timeUpdate"); this.currentTime = 0; this.duration = 0; this.avPlayer = null; this.errorCallback = undefined; this.stateChangeCallback = undefined; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left release AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right ...
async release() { await this.avPlayer?.release(); this.avPlayer?.off("stateChange"); this.avPlayer?.off("error"); this.avPlayer?.off("timeUpdate"); this.currentTime = 0; this.duration = 0; this.avPlayer = null; this.errorCallback = undefined; this.stateChangeCallback = undefined; ...
https://github.com/yangyongzhen/hmmovie
de23072a96abb9289e679f148b70a2056fe60253
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
remove
Removes the first occurrence of the specified element. @param element The element to remove. @returns True if the element was removed, otherwise false.
public remove(element: T): boolean { let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { if (currentNode!.element == element) { if (currentNode === this.head) { this.removeByIndex(0); return tru...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right...
public remove(element: T): boolean { let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { if (currentNode!.element == element) { if (currentNode === this.head) { this.removeByIndex(0); return tru...
https://gitcode.com/iop123123/arkts-static-skills
5a4bb2416a4840d254d0f27ca6c60ad6181982fd
gitcode
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets
arkts
getWritingStats
── Stats ──
async getWritingStats(): Promise<ResultEnvelope<WritingStats>> { try { const jsonStr: string = this.getNativeModule().nativeGetWritingStats() return this.parseEnvelope<WritingStats>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_error', m...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getWritingStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async getWritingStats(): Promise<ResultEnvelope<WritingStats>> { try { const jsonStr: string = this.getNativeModule().nativeGetWritingStats() return this.parseEnvelope<WritingStats>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_error', m...
https://github.com/Xiwei753/xiezuoruanjian
950a173bef8975c6c7e7559bcb8c2871d9ce54a9
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Parser.ets
arkts
skipDoctype
跳过 DOCTYPE
private skipDoctype(): void { const endIndex = this.html.indexOf('>', this.pos); this.pos = endIndex >= 0 ? endIndex + 1 : this.html.length; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left skipDoctype AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void...
private skipDoctype(): void { const endIndex = this.html.indexOf('>', this.pos); this.pos = endIndex >= 0 ? endIndex + 1 : this.html.length; }
https://github.com/DaLongZhuaZi/manxia
09e690ba4b02d9daf033c0ea36cee54693a959fb
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/TokenManager.ets
arkts
clearAllTokens
清除所有Token
static clearAllTokens() { this.clearDoctorToken(); this.clearFamilyToken(); this.clearNurseToken(); this.clearUserToken(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearAllTokens 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 ...
static clearAllTokens() { this.clearDoctorToken(); this.clearFamilyToken(); this.clearNurseToken(); this.clearUserToken(); }
https://github.com/LJ666-ui/harmony-health-care
8ed0aac14a5f5daf774dd4591d83d9e5368f8085
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/GlobalExtAbility/GlobalDialogModel.ets
arkts
statusCheck
判断弹窗申请权限的全局状态 @param context ServiceExtensionContext @param resource 弹窗申请的权限 return boolean
public statusCheck(context: Context, resource: string): boolean { switch (resource) { case 'microphone': if (this.microphoneStatus()) { return true; } else { Log.info('The microphone is not disabled on this device.'); return false; } case 'camera':...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left statusCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left C...
public statusCheck(context: Context, resource: string): boolean { switch (resource) { case 'microphone': if (this.microphoneStatus()) { return true; } else { Log.info('The microphone is not disabled on this device.'); return false; } case 'camera':...
https://gitee.com/openharmony/applications_permission_manager.git
cf67d566e60cc3d2bebf82b59d0449e65bdb0b1e
gitee
erosTeam/NextE
shared/src/main/ets/model/EhGallery.ets
arkts
title
Title to render: English primary, Japanese fallback (caller may invert per setting).
title(): string { return this.englishTitle.length > 0 ? this.englishTitle : this.japaneseTitle }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left title AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_block#...
title(): string { return this.englishTitle.length > 0 ? this.englishTitle : this.japaneseTitle }
https://github.com/erosTeam/NextE
c23c908e301b75d570410b64765e9dbbd329178c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
getTaskContext
获取任务上下文
getTaskContext(taskId: string): TaskContext | null { return this.runningTasks.get(taskId) || null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTaskContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
getTaskContext(taskId: string): TaskContext | null { return this.runningTasks.get(taskId) || null; }
https://github.com/DaLongZhuaZi/manxia
db9395ef498678f73f0fb2ae7dfd343ef574ebaa
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getStringByLegadoRule
解析Legado链式规则 支持格式: class.xxx@tag.a.0@text, id.xxx@tag.div@href 支持正则替换: rule##regex##replacement## 参考Legado原版AnalyzeByJSoup.kt的实现
private getStringByLegadoRule(rule: string): string { // 步骤1: 分离正则替换规则 (##regex##replacement##) let replaceRegex = ''; let replacement = ''; let replaceFirst = false; const regexParts = rule.split('##'); rule = regexParts[0]; // 主规则 if (regexParts.length > 1) { replaceRegex = re...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringByLegadoRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private getStringByLegadoRule(rule: string): string { // 步骤1: 分离正则替换规则 (##regex##replacement##) let replaceRegex = ''; let replacement = ''; let replaceFirst = false; const regexParts = rule.split('##'); rule = regexParts[0]; // 主规则 if (regexParts.length > 1) { replaceRegex = re...
https://github.com/DaLongZhuaZi/manxia
b54e9d63f98bdc80102f22cae475454189d22c3d
github
Vsolon0401/MallShopping
features/commoditydetail/src/main/ets/components/CommodityDetail.ets
arkts
initPromotionTipList
初始化优惠信息
initPromotionTipList(data: CommodityInfo) { const promotionType = this.info.product.promotionType; switch(promotionType) { case 0: this.promotionTip = '暂无优惠' break; case 1: this.promotionTip = '单品优惠' break; case 2: this.promotionTip = '会员优惠' br...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initPromotionTipList 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 CommodityInfo AST#id...
initPromotionTipList(data: CommodityInfo) { const promotionType = this.info.product.promotionType; switch(promotionType) { case 0: this.promotionTip = '暂无优惠' break; case 1: this.promotionTip = '单品优惠' break; case 2: this.promotionTip = '会员优惠' br...
https://github.com/Vsolon0401/MallShopping
2b66ff1a7308419ec297c7fad0ecc596b83b0027
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/components/CustomMarkdownComponent.ets
arkts
onMarkdownSizeChange
Receives raw size events from the inner Column. Stores the latest value and schedules a debounced flush so the async Markdown renderer has time to finalize its content height before we report upstream.
public onMarkdownSizeChange(newValue: SizeOptions): void { const newH: number = newValue.height as number; if (newH < 0) { return; } this.latestSize = newValue; if (this.pendingReportTimer >= 0) { clearTimeout(this.pendingReportTimer); } this.pendingReportTimer = setTimeout(():...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onMarkdownSizeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
public onMarkdownSizeChange(newValue: SizeOptions): void { const newH: number = newValue.height as number; if (newH < 0) { return; } this.latestSize = newValue; if (this.pendingReportTimer >= 0) { clearTimeout(this.pendingReportTimer); } this.pendingReportTimer = setTimeout(():...
https://github.com/AGenUI/AGenUI
c0bc44176603a614593d2eee0b701844d96e5366
github
openharmony-sig/applications_inputmethod
entry/src/main/ets/model/KeyboardController.ets
arkts
initWindow
创建窗口,用于显示键盘的
private initWindow(): void { this.inputHandle.addLog('initWindow') display.getDefaultDisplay().then(dis => { this.inputHandle.addLog("initWindow-oncall display"); //设置宽高 var dWidth = dis.width; var dHeight = dis.height; AppStorage.SetOrCreate<number>("dHeight",dHeight) /...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initWindow 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#expressi...
private initWindow(): void { this.inputHandle.addLog('initWindow') display.getDefaultDisplay().then(dis => { this.inputHandle.addLog("initWindow-oncall display"); //设置宽高 var dWidth = dis.width; var dHeight = dis.height; AppStorage.SetOrCreate<number>("dHeight",dHeight) /...
https://gitee.com/openharmony-sig/applications_inputmethod.git
0c756bd467268b515c82a88c8444b7266b6993b9
gitee
LZZLHY/hlib
entry/src/main/ets/viewmodel/DownloadVM.ets
arkts
refreshHistory
─── 已完成历史(委托 DownloadRepository) ────────────
static async refreshHistory(): Promise<DownloadHistoryItem[]> { return await DownloadRepository.refreshHistory(); }
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 refreshHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async refreshHistory(): Promise<DownloadHistoryItem[]> { return await DownloadRepository.refreshHistory(); }
https://github.com/LZZLHY/hlib
fcb98b81a362eb11cec4ede187751e7d3adbcc58
github
SMAT-Lab/HapRepair
arkts_files/152.ets
arkts
onInActive
The callback when current page is in the background
onInActive(): void { if (this.isActive) { Log.info(TAG, 'onInActive'); this.isActive = false; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onInActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left...
onInActive(): void { if (this.isActive) { Log.info(TAG, 'onInActive'); this.isActive = false; } }
https://github.com/SMAT-Lab/HapRepair
1827322352b8fbd27962166811ef5331cfb57379
github
Tlntin/home-cloud-shield
entry/src/main/ets/serviceextability/MyVpnExtAbility.ets
arkts
checkUpstreamReload
Apply an upstream DNS change live: when the UI rewrites the upstream file, switch the running filter's resolver (and flush its cache) without a full VPN restart.
private checkUpstreamReload(): void { // In full mode the embedded AdGuardHome owns the upstream; applying it to // the lightweight engine would corrupt the loopback relay. Upstream changes // take effect on the next filter restart. if (this.filterMode === FILTER_MODE_FULL) { return; } c...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkUpstreamReload 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 ...
private checkUpstreamReload(): void { // In full mode the embedded AdGuardHome owns the upstream; applying it to // the lightweight engine would corrupt the loopback relay. Upstream changes // take effect on the next filter restart. if (this.filterMode === FILTER_MODE_FULL) { return; } c...
https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1548-L1563
0abc9fac94b3480cf5cb619d59c88a6c6331ace4
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/common/utils/DateUtils.ets
arkts
formatFull
格式化为完整时间 YYYY-MM-DD HH:mm:ss @param timestamp
public static formatFull(timestamp: number): string { // ❌ Fix: this.formatDate -> DateUtils.formatDate const dateStr = DateUtils.formatDate(timestamp); const timeStr = DateUtils.formatTime(timestamp); const seconds = new Date(timestamp).getSeconds().toString().padStart(2, '0'); return `${dateStr}...
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 formatFull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public static formatFull(timestamp: number): string { // ❌ Fix: this.formatDate -> DateUtils.formatDate const dateStr = DateUtils.formatDate(timestamp); const timeStr = DateUtils.formatTime(timestamp); const seconds = new Date(timestamp).getSeconds().toString().padStart(2, '0'); return `${dateStr}...
https://gitcode.com/openharmony/codelabs
b33c641c59256c24d0a582c372d0932a76596ed1
gitcode
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
connectWithKey
Connect to the remote host with public key authentication.
async connectWithKey(host: string, port: number, user: string, privateKey: string, passphrase?: string, options?: SshConnectOptions): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); if (this.state !== SshState.DISCONNECTED) throw new Ss...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left connectWithKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left host ...
async connectWithKey(host: string, port: number, user: string, privateKey: string, passphrase?: string, options?: SshConnectOptions): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); if (this.state !== SshState.DISCONNECTED) throw new Ss...
https://github.com/UnbalancedCat/ohos-ssh-core
0b3d6543a0c5632f5013d1bda59d585fe22ccbda
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/pages/ControlPage.ets
arkts
clearAutoHideTimer
清除自动隐藏定时器
clearAutoHideTimer() { if (this.autoHideTimer !== -1) { clearTimeout(this.autoHideTimer); this.autoHideTimer = -1; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearAutoHideTimer 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...
clearAutoHideTimer() { if (this.autoHideTimer !== -1) { clearTimeout(this.autoHideTimer); this.autoHideTimer = -1; } }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
ddb296dd28df5e0532130443b844bc257e79b7c4
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectField.ets
arkts
isPublic
Checks if the field has public access permission. @returns { boolean } Returns true if the field is public; otherwise returns false.
public isPublic(): boolean { return (this.accessMod == AccessModifier.PUBLIC) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPublic 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#bool...
public isPublic(): boolean { return (this.accessMod == AccessModifier.PUBLIC) }
https://gitcode.com/iop123123/arkts-static-skills
a6468b9b3ad071518fad5853254db5cf5eb8e018
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
mergeHdsTabEffects
合并 HdsTab 特效配置(用partial覆盖base)
function mergeHdsTabEffects(base: HdsTabEffectsConfig, partial: Partial<HdsTabEffectsConfig>): HdsTabEffectsConfig { const minOpacity: number = clampHdsTabUnitValue( partial.minOpacity !== undefined ? partial.minOpacity : base.minOpacity ); const rawMaxOpacity: number = clampHdsTabUnitValue( partial.maxOp...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeHdsTabEffects AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left base AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function mergeHdsTabEffects(base: HdsTabEffectsConfig, partial: Partial<HdsTabEffectsConfig>): HdsTabEffectsConfig { const minOpacity: number = clampHdsTabUnitValue( partial.minOpacity !== undefined ? partial.minOpacity : base.minOpacity ); const rawMaxOpacity: number = clampHdsTabUnitValue( partial.maxOp...
https://github.com/DaLongZhuaZi/manxia
96e2c846c244b9357e6d2481b38e00ca7a974ea6
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test22_original_index.ets
arkts
findFirst
--- Early return patterns ---
function findFirst(arr: number[], target: number): number { for (let i: number = 0; i < arr.length; i++) { if (arr[i] === target) { return i; } } return -1; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left findFirst AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
function findFirst(arr: number[], target: number): number { for (let i: number = 0; i < arr.length; i++) { if (arr[i] === target) { return i; } } return -1; }
https://github.com/miaochiahao/ark-ghidra
30435d7ff800522f8936d1b22eec036cc5b8cb85
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
moveSourceToBottom
置底书源 @param currentIndex 当前位置索引
moveSourceToBottom(currentIndex: number): void { if (currentIndex < 0 || currentIndex >= this.filteredSources.length - 1) return; // 移除并插入到末尾 const source = this.filteredSources.splice(currentIndex, 1)[0]; this.filteredSources.push(source); // 刷新显示列表 this.loadMoreSources(true); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left moveSourceToBottom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Lef...
moveSourceToBottom(currentIndex: number): void { if (currentIndex < 0 || currentIndex >= this.filteredSources.length - 1) return; // 移除并插入到末尾 const source = this.filteredSources.splice(currentIndex, 1)[0]; this.filteredSources.push(source); // 刷新显示列表 this.loadMoreSources(true); }
https://github.com/DaLongZhuaZi/manxia
6d2da2204072b57c4013fed9633ca37d13e4d319
github
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/viewmodel/AccountLoginViewModel.ets
arkts
saveCredentials
保存账号密码 @param {string} account - 账号 @param {string} password - 密码 @returns {Promise<void>} Promise<void>
private async saveCredentials(account: string, password: string): Promise<void> { await Promise.all([ this.accountStoreRepository.saveAccount(account), this.accountStoreRepository.savePassword(password) ]); }
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 saveCredentials AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left account AST#identifier#Right AST#ERROR#Left AST#:#Le...
private async saveCredentials(account: string, password: string): Promise<void> { await Promise.all([ this.accountStoreRepository.saveAccount(account), this.accountStoreRepository.savePassword(password) ]); }
https://github.com/Joker-x-dev/CoolMallArkTS
e6963c584af73c340d73ea22db2a3ef258da3cb8
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/TokenStoreRepository.ets
arkts
constructor
构造函数 @param {TokenStoreDataSource} [dataSource] 可选自定义数据源
constructor(dataSource?: TokenStoreDataSource) { this.dataSource = dataSource ?? new TokenStoreDataSourceImpl(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSource AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
constructor(dataSource?: TokenStoreDataSource) { this.dataSource = dataSource ?? new TokenStoreDataSourceImpl(); }
https://github.com/Joker-x-dev/CoolMallArkTS
748f8c314cfbdaf78ebc635feb4960ac79cacdc4
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
getQueryValue
Searches the query string for the first value with the given key. @param { string } key - Given the first value of the key. @returns { string | null } Return decoded value.
getQueryValue(key: string): string | null { return this.uriEntry.getQueryValue(key); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getQueryValue 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 s...
getQueryValue(key: string): string | null { return this.uriEntry.getQueryValue(key); }
https://gitcode.com/iop123123/arkts-static-skills
26a5ba18d306f5442778f20014e643ebfbc70695
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/Storage.ets
arkts
shortDigest
A tiny, non-cryptographic digest of the raw appKey. Used only to disambiguate two appKeys that sanitize to the same sequence, it does NOT need to resist collisions at cryptographic strength, and keeping it short keeps filenames readable. 32-bit FNV-1a base36 → <= 7 chars.
protected static shortDigest(input: string): string { let hash: number = 0x811c9dc5; for (let i = 0; i < input.length; i++) { hash ^= input.charCodeAt(i); // Multiply by FNV prime 16777619, truncated to 32-bit via `| 0`. hash = (hash + ((hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) +...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left shortDigest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#L...
protected static shortDigest(input: string): string { let hash: number = 0x811c9dc5; for (let i = 0; i < input.length; i++) { hash ^= input.charCodeAt(i); // Multiply by FNV prime 16777619, truncated to 32-bit via `| 0`. hash = (hash + ((hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) +...
https://github.com/Countly/countly-sdk-hos
6737796929608266088b6189b19b94be20b3f72c
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
getOpenAIReasoningEffortForStrategy
获取 OpenAI 推理强度
private getOpenAIReasoningEffortForStrategy( strategy: ReasoningRequestStrategy, model: string, level: ReasoningLevel ): string | undefined { if (strategy === ReasoningRequestStrategy.OPENAI_COMPAT_REASONING_EFFORT) { return this.getOpenAICompatReasoningEffort(level) } return this.getO...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getOpenAIReasoningEffortForStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strategy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR...
private getOpenAIReasoningEffortForStrategy( strategy: ReasoningRequestStrategy, model: string, level: ReasoningLevel ): string | undefined { if (strategy === ReasoningRequestStrategy.OPENAI_COMPAT_REASONING_EFFORT) { return this.getOpenAICompatReasoningEffort(level) } return this.getO...
https://github.com/LongLiveY96/chatcube
aed21e33e11d4da81b40fade22374248b4479704
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets
arkts
toString
Converts this object to a string @returns result of the conversion by radix r
public toString(r: int): String { return Float.toString(this.value, r); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left r AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#id...
public toString(r: int): String { return Float.toString(this.value, r); }
https://gitcode.com/iop123123/arkts-static-skills
57b2bec5d22f734d829c0ce32538be030ed4459b
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
hasUsbControllers
检查是否有 USB 控制器连接
hasUsbControllers(): boolean { return this.vibrationService.hasUsbControllers(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasUsbControllers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#s...
hasUsbControllers(): boolean { return this.vibrationService.hasUsbControllers(); }
https://github.com/AlkaidLab/moonlight-harmony
9555db33cd06aadcd2e6c7b632fb78aa048edbed
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/entryability/EntryAbility.ets
arkts
hideSystemDecorAndShowCustom
隐藏系统标题栏并显示自定义标题栏
private hideSystemDecorAndShowCustom(): void { if (!this.mainWindow) { AppStorage.set<boolean>('showCustomTitleBar', true); return; } try { // 尝试隐藏系统窗口装饰(标题栏) // API: setWindowDecorVisible(false) - 同步方法 this.mainWindow.setWindowDecorVisible(false); hilog.info(0x000...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hideSystemDecorAndShowCustom 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#L...
private hideSystemDecorAndShowCustom(): void { if (!this.mainWindow) { AppStorage.set<boolean>('showCustomTitleBar', true); return; } try { // 尝试隐藏系统窗口装饰(标题栏) // API: setWindowDecorVisible(false) - 同步方法 this.mainWindow.setWindowDecorVisible(false); hilog.info(0x000...
https://github.com/AetheriumSimulator/qemu-hmos
c4514643f8b4acc2ea17bf4540bf3cef211e57f1
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/language/LanguageState.ets
arkts
isRTL
Check if current language is RTL
isRTL(): boolean { return this.currentLayoutDirection === LayoutDirection.RTL; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRTL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_blo...
isRTL(): boolean { return this.currentLayoutDirection === LayoutDirection.RTL; }
https://github.com/Tencent-RTC/TUIKit_Harmony
0cd0c4f90ea680975404dc6c52a9c09512e7d1dc
github
the-wwyang/kids-learning-app
src/main/ets/common/ThemeManager.ets
arkts
getAllThemes
获取所有主题
public getAllThemes(): ThemeConfig[] { return ThemeManager.THEMES; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllThemes 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 ThemeConf...
public getAllThemes(): ThemeConfig[] { return ThemeManager.THEMES; }
https://github.com/the-wwyang/kids-learning-app
021b5110b0d3cf446f5dcea8b8e608368915215b
github
LongLiveY96/chatcube
entry/src/main/ets/services/AccountService.ets
arkts
clearLoginState
退出登录:仅清本地登录态,不调 Account Kit 的 cancelAuthorization。 这样下次再点一键登录依然是静默体验。
async clearLoginState(): Promise<void> { try { const preferences: PreferencesService = getPreferencesService() await preferences.setBoolean(PreferenceKeys.HW_ACCOUNT_LOGGED_IN, false) await preferences.remove(PreferenceKeys.HW_ACCOUNT_OPEN_ID) await preferences.remove(PreferenceKeys.HW_ACC...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearLoginState AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async clearLoginState(): Promise<void> { try { const preferences: PreferencesService = getPreferencesService() await preferences.setBoolean(PreferenceKeys.HW_ACCOUNT_LOGGED_IN, false) await preferences.remove(PreferenceKeys.HW_ACCOUNT_OPEN_ID) await preferences.remove(PreferenceKeys.HW_ACC...
https://github.com/LongLiveY96/chatcube
360e10bb79d19eb72e391ec1e3b922bc2cb17f03
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setAxisMaxValue
Use setAxisMaximum(...) instead. @param max
public setAxisMaxValue(max: number): void { this.setAxisMaximum(max); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAxisMaxValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left max AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public setAxisMaxValue(max: number): void { this.setAxisMaximum(max); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
646fe4c0ba7181385152dcc11e8d6b2d59a80239
gitee