nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/xts_acts
5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686
arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/AlphabetIndexerView.ets
arkts
AlphabetIndexerView
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Component export struct AlphabetIndexerView { @Link _position: Position; private componentKey: string = ''; private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] build() { AlphabetIndexe...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct AlphabetIndexerView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _position : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#...
@Component export struct AlphabetIndexerView { @Link _position: Position; private componentKey: string = ''; private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] build() { AlphabetIndexe...
https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/AlphabetIndexerView.ets#L16-L39
a2a48e7e5bf77d4bd1a643b050fd9368dce9d207
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/chatwithexpression/src/main/ets/constants/ChatConstants.ets
arkts
表情对话框参数配置
export class FaceGridConstants { static readonly EMOJI_IMAGE_SIZE: number = 28; // 表情图片大小 static readonly GRID_MAX_COUNT: number = 6; // 一行最大item数量 static readonly ROWS_GAP: number = 20; // 行距 static readonly GRID_HEIGHT: number = 288; // 高度 s...
AST#export_declaration#Left export AST#class_declaration#Left class FaceGridConstants AST#class_body#Left { AST#property_declaration#Left static readonly EMOJI_IMAGE_SIZE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 28 AST#expression#Righ...
export class FaceGridConstants { static readonly EMOJI_IMAGE_SIZE: number = 28; static readonly GRID_MAX_COUNT: number = 6; static readonly ROWS_GAP: number = 20; static readonly GRID_HEIGHT: number = 288; static readonly EMOJI_MARGIN: num...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/constants/ChatConstants.ets#L27-L33
06eebe9809b0881ba2b8326ec3f453af798f5bfb
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/TransformerHorizontalBarChart.ets
arkts
prepareMatrixOffset
Prepares the matrix that contains all offsets. @param inverted
public prepareMatrixOffset(inverted: boolean): void { this.mMatrixOffset.reset(); // offset.postTranslate(mOffsetLeft, getHeight() - mOffsetBottom); if (!inverted) this.mMatrixOffset.postTranslate(this.mViewPortHandler.offsetLeft(), this.mViewPortHandler.getChartHeight() - this.mViewPortHan...
AST#method_declaration#Left public prepareMatrixOffset AST#parameter_list#Left ( AST#parameter#Left inverted : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#...
public prepareMatrixOffset(inverted: boolean): void { this.mMatrixOffset.reset(); if (!inverted) this.mMatrixOffset.postTranslate(this.mViewPortHandler.offsetLeft(), this.mViewPortHandler.getChartHeight() - this.mViewPortHandler.offsetBottom()); else { this.mMatrixOffset ...
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/TransformerHorizontalBarChart.ets#L29-L51
d7f8316e17f0281ca8b89359125a8751e4fd939b
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/community/PostDetailPage.ets
arkts
submitComment
提交评论
async submitComment(): Promise<void> { if (!this.commentText.trim()) { promptAction.showToast({ message: '评论内容不能为空', duration: 2000 }); return; } // 检查用户是否已登录 if (!this.userSession.isLoggedIn()) { promptAction.showToast({ message: '请先登录后再发表评论', ...
AST#method_declaration#Left async submitComment AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_ar...
async submitComment(): Promise<void> { if (!this.commentText.trim()) { promptAction.showToast({ message: '评论内容不能为空', duration: 2000 }); return; } if (!this.userSession.isLoggedIn()) { promptAction.showToast({ message: '请先登录后再发表评论', duration: ...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostDetailPage.ets#L180-L291
b3c0b7be5ab12bebaec3253f201223e9040a6dc2
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogHub.ets
arkts
getTextInput
显示单行文本输入弹框 @returns
static getTextInput(uiContext?: UIContext): TextInputBuilderProxy { return new TextInputBuilderProxy(uiContext) }
AST#method_declaration#Left static getTextInput AST#parameter_list#Left ( AST#parameter#Left uiContext ? : AST#type_annotation#Left AST#primary_type#Left UIContext AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left TextInputBu...
static getTextInput(uiContext?: UIContext): TextInputBuilderProxy { return new TextInputBuilderProxy(uiContext) }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L114-L116
9e06df242cf7cb5042af18146715e2baa3efa82f
github
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/utils/PreferencesUtil.ets
arkts
delAllData
删除数据 @param preferencesName @param key
static async delAllData(preferencesName: string, key: string) { const pre = preferences.getPreferencesSync(getContext(), { name: preferencesName }) pre.deleteSync(key) await pre.flush() }
AST#method_declaration#Left static async delAllData AST#parameter_list#Left ( AST#parameter#Left preferencesName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string A...
static async delAllData(preferencesName: string, key: string) { const pre = preferences.getPreferencesSync(getContext(), { name: preferencesName }) pre.deleteSync(key) await pre.flush() }
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/utils/PreferencesUtil.ets#L35-L39
3c132d75d23091006aee821c5c326e93f68196d3
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/AgvMovementService.ets
arkts
getAgvStatus
获取AGV当前状态(模拟数据) 注:由于接口文档中没有直接的状态获取接口,这里提供模拟数据 @returns AGV状态信息
static async getAgvStatus(): Promise<AgvStatusVO> { try { console.info('[AgvMovementService] 📊 获取AGV当前状态'); // 先检查心跳状态 const heartbeatResult = await AgvMovementService.heartbeat(); // 模拟AGV状态数据 const mockStatus: AgvStatusVO = { sysTime: new Date().toLocaleString(...
AST#method_declaration#Left static async getAgvStatus AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AgvStatusVO AST#primary_type#Right AST#type_annotation#Right ...
static async getAgvStatus(): Promise<AgvStatusVO> { try { console.info('[AgvMovementService] 📊 获取AGV当前状态'); const heartbeatResult = await AgvMovementService.heartbeat(); const mockStatus: AgvStatusVO = { sysTime: new Date().toLocaleString('zh-CN'), isRu...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/AgvMovementService.ets#L109-L134
b73ca2d5c7419efa404bfa1488965998d25a3094
github
wenfujing/honms-super-market.git
0858abecd8be5db7b8dcf88dcd77b7c66d37517a
entry/src/main/ets/constants/PageConstants.ets
arkts
Copyright (c) 2023 Huawei Device Co., Ltd. Licensed under the Apache License,Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw...
export class PageConstants { /** * Delay time to router MainPage. */ static readonly DELAY_TIME: number = 2000; /** * The value of letter space: 16vp. */ static readonly LETTER_SPACE: string = '16vp'; /** * The value of tab bar button space: 6vp. */ static readonly BUTTON_SPACE: string =...
AST#export_declaration#Left export AST#class_declaration#Left class PageConstants AST#class_body#Left { /** * Delay time to router MainPage. */ AST#property_declaration#Left static readonly DELAY_TIME : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#ex...
export class PageConstants { static readonly DELAY_TIME: number = 2000; static readonly LETTER_SPACE: string = '16vp'; static readonly BUTTON_SPACE: string = '6vp'; static readonly MAIN_PAGE_URL: string = 'pages/MainPage'; static readonly COMMODITY_DETAIL_PAGE_URL: string = 'pages/Commodi...
https://github.com/wenfujing/honms-super-market.git/blob/0858abecd8be5db7b8dcf88dcd77b7c66d37517a/entry/src/main/ets/constants/PageConstants.ets#L16-L91
0fc74fa8bf7256315fa5fce0b4b0c41174e8525f
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/DESSync.ets
arkts
@Author csx @DateTime 2024/3/18 10:07:03 @TODO DESSync 3DES同步操作类
export class DESSync { /** * 生成3DES的对称密钥 * @param resultCoding 生成3DES秘钥的字符串格式(hex/base64)-默认不传为base64格式 * @returns 3DES密钥 */ static generate3DESKey(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { // 获取对称密钥的二进制数据 return CryptoSyncUtil.generateSymKey('3DES192', resultCoding); }...
AST#export_declaration#Left export AST#class_declaration#Left class DESSync AST#class_body#Left { /** * 生成3DES的对称密钥 * @param resultCoding 生成3DES秘钥的字符串格式(hex/base64)-默认不传为base64格式 * @returns 3DES密钥 */ AST#method_declaration#Left static generate3DESKey AST#parameter_list#Left ( AST#parameter#Left resultCoding...
export class DESSync { static generate3DESKey(resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { return CryptoSyncUtil.generateSymKey('3DES192', resultCoding); } static encodeECB(str: string, desKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding =...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/DESSync.ets#L27-L91
f4fc6894c569b93a5a7a9c2331b5600326b08337
gitee
wangjinyuan/JS-TS-ArkTS-database.git
a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26
npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildEmojisUpdate.ets
arkts
应用约束61: 使用export代替module.exports
export default GuildEmojisUpdate;
AST#export_declaration#Left export default AST#expression#Left GuildEmojisUpdate AST#expression#Right ; AST#export_declaration#Right
export default GuildEmojisUpdate;
https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/GuildEmojisUpdate.ets#L13-L13
98c74707614491bbd53b478b2fc5a7e83a1fed6a
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
onDetachedFromWindow
@Override
protected onDetachedFromWindow(): void { // releases the bitmap in the renderer to avoid oom error if (this.mRenderer != null && this.mRenderer instanceof PieChartRenderer) { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).releaseBitmap(); } // super.onDetachedFromWindow(); ...
AST#method_declaration#Left protected onDetachedFromWindow AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // releases the bitmap in the renderer to avoid oom error AST#ui_control...
protected onDetachedFromWindow(): void { if (this.mRenderer != null && this.mRenderer instanceof PieChartRenderer) { ( this.mRenderer as PieChartRenderer).releaseBitmap(); } }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L851-L858
5f84412e759c88f677f980f923fa2bc713924058
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/plan/plancurve/Plan.ets
arkts
get
/ 当前(今天)是第几天
get numOfToday(): number | null { if (this.startDate !== null) { let now = new Date(); return this.daysTo(this.startDate, now); } return null; }
AST#method_declaration#Left get AST#ERROR#Left numOfToday AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#R...
get numOfToday(): number | null { if (this.startDate !== null) { let now = new Date(); return this.daysTo(this.startDate, now); } return null; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L110-L116
7fd029fd21b3cd9cf04c321f9dbb6c1932e5243a
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets
arkts
@Author csx @DateTime 2024/3/20 20:05 @TODO ECDSASync 同步操作类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_crypto
export class ECDSASync { /** * 生成ECDSA的非对称密钥 * @param resultCoding 生成ECDSA秘钥的字符串格式-默认不传为base64格式 * @returns ECDSA密钥{publicKey:公钥,privateKey:私钥} */ static generateECDSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('ECC256', resultCoding); }...
AST#export_declaration#Left export AST#class_declaration#Left class ECDSASync AST#class_body#Left { /** * 生成ECDSA的非对称密钥 * @param resultCoding 生成ECDSA秘钥的字符串格式-默认不传为base64格式 * @returns ECDSA密钥{publicKey:公钥,privateKey:私钥} */ AST#method_declaration#Left static generateECDSAKey AST#parameter_list#Left ( AST#para...
export class ECDSASync { static generateECDSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('ECC256', resultCoding); } static sign(str: string, priKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets#L26-L63
3bd945d3104d1c13cd9bc00dd2f09cb13db1dd36
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/components/goods/VHGoodsComponent.ets
arkts
checkCouponAfterQuantityChange
新增:数量变化后重新校验优惠券可用性
private checkCouponAfterQuantityChange() { if (this.Index === -1 || this.CouponsAvailable.length === 0) { return; } // 若当前选中的优惠券已不可用,重新查找可用优惠券 if (!this.isCouponUsable()) { const currentPrice = this.GoodsData.discount_price ?? this.GoodsData.price; for (let i = 0; i < this.CouponsAvail...
AST#method_declaration#Left private checkCouponAfterQuantityChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_ex...
private checkCouponAfterQuantityChange() { if (this.Index === -1 || this.CouponsAvailable.length === 0) { return; } if (!this.isCouponUsable()) { const currentPrice = this.GoodsData.discount_price ?? this.GoodsData.price; for (let i = 0; i < this.CouponsAvailable.length; i++) { ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/goods/VHGoodsComponent.ets#L1249-L1266
0c50ad9dafbed85cee8d4dff1999146d256304c7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/transitionanimation/src/main/ets/components/pages/SubDetailPage.ets
arkts
SubDetailPageBuilder
Copyright (c) 2024 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
@Builder export function SubDetailPageBuilder() { SubDetailPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SubDetailPageBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left SubDetailPage ( ) ; AST#ui_custom_component_statement#Right } AST#build...
@Builder export function SubDetailPageBuilder() { SubDetailPage(); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/transitionanimation/src/main/ets/components/pages/SubDetailPage.ets#L16-L19
d22d2696c95e04f13fcfdb33de790eb236a0c0e6
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets
arkts
getData
根据下标获取数据
public getData(index: number): T { return this.originDataArray[index]; }
AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right ...
public getData(index: number): T { return this.originDataArray[index]; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L15-L17
82d9f2b815fadbe4982038fe0072518bfea75ddc
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/LinkText.ets
arkts
LinkText
==================== 组件实现 ====================
@ComponentV2 export struct LinkText { // ---------- 输入参数 ---------- @Param content: string = ''; // 原始文本内容 @Param linkTexts: string[] = []; // 需要作为链接的文本数组 @Param linkColor: ResourceColor = $r('app.color.color_link'); // 链接颜色(默认蓝色) @Param normalColor: ResourceColor = $r('app.c...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct LinkText AST#component_body#Left { // ---------- 输入参数 ---------- AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
@ComponentV2 export struct LinkText { @Param content: string = ''; @Param linkTexts: string[] = []; @Param linkColor: ResourceColor = $r('app.color.color_link'); @Param normalColor: ResourceColor = $r('app.color.color_text'); @Param isLinkUnderline: boolean = true; ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkText.ets#L33-L128
11ed454efd24e78e6cab380e8d9f4f7db3b5e2e8
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/feedback/FeedbackNavigator.ets
arkts
@file 反馈模块导航封装 @author Joker.X
export class FeedbackNavigator { /** * 跳转到反馈列表 * @returns {void} 无返回值 */ static toList(): void { navigateTo(FeedbackRoutes.List); } /** * 跳转到提交反馈 * @returns {void} 无返回值 */ static toSubmit(): void { navigateTo(FeedbackRoutes.Submit); } }
AST#export_declaration#Left export AST#class_declaration#Left class FeedbackNavigator AST#class_body#Left { /** * 跳转到反馈列表 * @returns {void} 无返回值 */ AST#method_declaration#Left static toList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_ty...
export class FeedbackNavigator { static toList(): void { navigateTo(FeedbackRoutes.List); } static toSubmit(): void { navigateTo(FeedbackRoutes.Submit); } }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/feedback/FeedbackNavigator.ets#L8-L24
bf21f9996d0ef347f8d6e601db636fd633078085
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets
arkts
类型声明:处理参数为string[]的回调
export interface StringArrayCbWrapper { call: (data: string[]) => void; }
AST#export_declaration#Left export AST#interface_declaration#Left interface StringArrayCbWrapper AST#object_type#Left { AST#type_member#Left call : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left strin...
export interface StringArrayCbWrapper { call: (data: string[]) => void; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/etswrapper/src/main/ets/wrapper/wrapper.ets#L27-L29
343c035dce50422c0acbbedf15c812790de71da7
gitee
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFMpegUtils.ets
arkts
FFmpeg 工具类 提供视频处理、格式转换等功能
export class FFMpegUtils { /** * 执行 FFmpeg 命令 * * @param options 命令执行选项 * @returns Promise,resolve 返回执行结果码(0表示成功),reject 返回错误信息 * * @example * ```typescript * // 示例1:视频格式转换 * FFMpegUtils.executeFFmpegCommand({ * cmds: ['-i', 'input.flv', '-c:v', 'libx264', '-c:a', 'aac', 'output.mp4'...
AST#export_declaration#Left export AST#class_declaration#Left class FFMpegUtils AST#class_body#Left { /** * 执行 FFmpeg 命令 * * @param options 命令执行选项 * @returns Promise,resolve 返回执行结果码(0表示成功),reject 返回错误信息 * * @example * ```typescript * // 示例1:视频格式转换 * FFMpegUtils.executeFFmpegCommand({ * ...
export class FFMpegUtils { static executeFFmpegCommand(options: FFmpegCommandOptions): Promise<number> { let uuid = FFMpegUtils.generateUUID32(); libAddon.JSBind.bindFunction(uuid + "_onFFmpegProgress", options.onFFmpegProgress); libAddon.JSBind.bindFunction(uuid + "_onFFmpegFail", optio...
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFMpegUtils.ets#L41-L191
42244e36bb670d5d34ef438f5d9e63a09ea0fd69
github
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/DialogBuilder.ets
arkts
LoadingBuilder
Loading加载中弹窗view
@Builder export function LoadingBuilder(options: ILoadingOptions) { //, observedData: LoadingObserved LoadingView({ options: options }); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function LoadingBuilder AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left ILoadingOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter...
@Builder export function LoadingBuilder(options: ILoadingOptions) { LoadingView({ options: options }); }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogBuilder.ets#L277-L280
d7454effa826c84e755c4da947c97e5fd67fc0a7
github
jjjjjjava/ffmpeg_tools.git
6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
duration
设置持续时长
public duration(time: string): FFmpegCommandBuilder { this.durationValue = time; return this; }
AST#method_declaration#Left public duration AST#parameter_list#Left ( AST#parameter#Left time : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left FFmpegCommandBuilder AST#...
public duration(time: string): FFmpegCommandBuilder { this.durationValue = time; return this; }
https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegCommandBuilder.ets#L129-L132
19104398aaf1000e5211d54df8ddc436011c8896
github
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/SearchRule.ets
arkts
搜索结果处理规则
export class SearchRule { /**校验关键字**/ checkKeyWord?: string bookList?: string name?: string author?: string intro?: string kind?: string lastChapter?: string updateTime?: string bookUrl?: string coverUrl?: string wordCount?: string }
AST#export_declaration#Left export AST#class_declaration#Left class SearchRule AST#class_body#Left { /**校验关键字**/ AST#property_declaration#Left checkKeyWord AST#ERROR#Left ? : AST#ERROR#Left string book List ? : string name ? : string author ? : AST#ERROR#Right AST#type_annotation#Left AST#primary_type#Left string AST#p...
export class SearchRule { checkKeyWord?: string bookList?: string name?: string author?: string intro?: string kind?: string lastChapter?: string updateTime?: string bookUrl?: string coverUrl?: string wordCount?: string }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/database/entities/rule/SearchRule.ets#L4-L17
95b966e5857f9ffaf867f2223b95279be7cbd75e
github
pangpang20/wavecast.git
d3da8a0009eb44a576a2b9d9d9fe6195a2577e32
entry/src/main/ets/pages/SearchPage.ets
arkts
loadMore
加载更多
async loadMore() { if (this.isLoadingMore || !this.hasMore || this.searchKeyword.trim().length === 0) { return; } this.isLoadingMore = true; try { console.info(`[SearchPage] Loading more from offset ${this.currentOffset}`); const results = await PodcastService.getInstance().searc...
AST#method_declaration#Left async loadMore AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expressi...
async loadMore() { if (this.isLoadingMore || !this.hasMore || this.searchKeyword.trim().length === 0) { return; } this.isLoadingMore = true; try { console.info(`[SearchPage] Loading more from offset ${this.currentOffset}`); const results = await PodcastService.getInstance().searc...
https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/SearchPage.ets#L322-L363
1f515ea4368c7ba547d1eae89843f60d1c19b7c7
github
zl3624/harmonyos_network_samples
b8664f8bf6ef5c5a60830fe616c6807e83c21f96
code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets
arkts
复制文件到沙箱并读取二进制内容
export function copy2SandboxAndReadArrayBuffer(context: Context,filePath: string): ArrayBuffer { let fileName = getFileNameFromPath(filePath) let sandboxPath = copy2SandboxCacheDir(context,filePath,fileName) return readArrayBufferContentFromFile(sandboxPath) }
AST#export_declaration#Left export AST#function_declaration#Left function copy2SandboxAndReadArrayBuffer AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left Context AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left filePath : AST#...
export function copy2SandboxAndReadArrayBuffer(context: Context,filePath: string): ArrayBuffer { let fileName = getFileNameFromPath(filePath) let sandboxPath = copy2SandboxCacheDir(context,filePath,fileName) return readArrayBufferContentFromFile(sandboxPath) }
https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/BreakpointTransmission/entry/src/main/ets/pages/FileProcessHelper.ets#L72-L76
360e814c57b23d0b0a456f66c69f35098ee8fa29
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets
arkts
generateECDSAKey
生成ECDSA的非对称密钥 @param resultCoding 生成ECDSA秘钥的字符串格式-默认不传为base64格式 @returns ECDSA密钥{publicKey:公钥,privateKey:私钥}
static generateECDSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('ECC256', resultCoding); }
AST#method_declaration#Left static generateECDSAKey AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expr...
static generateECDSAKey(resultCoding: buffer.BufferEncoding = 'base64'): CryptoKey { return CryptoSyncUtil.generateCryptoKey('ECC256', resultCoding); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/ECDSASync.ets#L32-L34
ba7e7dc3a34a4e56b9c3438b315338c083fbb065
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The main ability tag. */ static readonly ENTRY_ABILITY_TAG: string = 'EntryAbility'; /** * The launcher page tag. */ static readonly LAUNCHER_PAGE_TAG: string = 'LauncherPage'; /** * The Advertising page tag. */ static readonly ADVERTISING_PAG...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The main ability tag. */ AST#property_declaration#Left static readonly ENTRY_ABILITY_TAG : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ...
export default class CommonConstants { static readonly ENTRY_ABILITY_TAG: string = 'EntryAbility'; static readonly LAUNCHER_PAGE_TAG: string = 'LauncherPage'; static readonly ADVERTISING_PAGE_TAG: string = 'AdvertisingPage'; static readonly CUSTOM_DIALOG_TAG: string = 'CustomDialogComponent'; ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/constants/CommonConstants.ets#L21-L282
5aa1470922a7a0f16aba42f97238a3c952953f77
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
arkts/@arkts.collections.d.ets
arkts
pop
Retrieves and removes the bit element to the end of this bit vector. @returns { number } The boolean type, if the bit push successfully, return true, else return false. @throws { BusinessError } 10200011 - The pop method cannot be bound. @throws { BusinessError } 10200201 - Concurrent modification error. @syscap Syste...
pop(): number;
AST#method_declaration#Left pop AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#method_declaration#Right
pop(): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/arkts/@arkts.collections.d.ets#L12159-L12159
03fddcde095228b7c61fb23670f6f711e0b47735
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets
arkts
close
取消订阅所有事件
close() { EventBus.getInstance().unregistById(WanEventId.EVENT_UPDATE_USER_INFO); EventBus.getInstance().unregistById(WanEventId.EVENT_LOGIN_OUT); EventBus.getInstance().unregistById(WanEventId.EVENT_LOGIN); }
AST#method_declaration#Left close AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_ex...
close() { EventBus.getInstance().unregistById(WanEventId.EVENT_UPDATE_USER_INFO); EventBus.getInstance().unregistById(WanEventId.EVENT_LOGIN_OUT); EventBus.getInstance().unregistById(WanEventId.EVENT_LOGIN); }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L28-L32
0b5fca734050f80012407e84d4f76a1891e5f3c8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/pages/game/GameCenterPage.ets
arkts
buildExpProgressBar
构建经验进度条
@Builder buildExpProgressBar() { if (!this.gameData) return; const currentExp = this.gameData.experience - this.gameData.level.requiredExp; const nextLevelExp = this.gameData.level.nextLevelExp; const progress = nextLevelExp > 0 ? (currentExp / (nextLevelExp - this.gameData.level.requiredExp)) : 1; ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildExpProgressBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AS...
@Builder buildExpProgressBar() { if (!this.gameData) return; const currentExp = this.gameData.experience - this.gameData.level.requiredExp; const nextLevelExp = this.gameData.level.nextLevelExp; const progress = nextLevelExp > 0 ? (currentExp / (nextLevelExp - this.gameData.level.requiredExp)) : 1; ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/game/GameCenterPage.ets#L188-L225
2562742af5e85603e81c16af4496cbee3f35900f
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
resize
扩容
private resize(): void { const oldTable = this.table; this.capacity *= 2; this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null); this.size = 0; for (let i = 0; i < oldTable.length; i++) { let current = oldTable[i]; while (current) { this.put(current.key, curren...
AST#method_declaration#Left private resize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left oldTable =...
private resize(): void { const oldTable = this.table; this.capacity *= 2; this.table = new Array<HashNode<K, V> | null>(this.capacity).fill(null); this.size = 0; for (let i = 0; i < oldTable.length; i++) { let current = oldTable[i]; while (current) { this.put(current.key, curren...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L139-L152
4bf1cfb74b6bd8ccd10df90fc09400acc1d8c183
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/ApplicationModels/Launcher/base/index.ets
arkts
AppItemInfo
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { AppItemInfo } from './src/main/ets/default/bean/AppItemInfo'
AST#export_declaration#Left export { AppItemInfo } from './src/main/ets/default/bean/AppItemInfo' AST#export_declaration#Right
export { AppItemInfo } from './src/main/ets/default/bean/AppItemInfo'
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/ApplicationModels/Launcher/base/index.ets#L16-L16
aaddb47cafc2ce347ed4bfff33aae4e2c3b96317
gitee
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
RouterApi/src/main/ets/api/Router.ets
arkts
setGlobalInterceptor
设置全局拦截器,每个路由栈只能设置一次 @param interceptor @param stackName
public static setGlobalInterceptor(interceptor: IGlobalNavigateInterceptor, stackName: string = DEFAULT_STACK_NAME) { ZRouter.getRouterMgr().setGlobalInterceptor(interceptor, stackName) }
AST#method_declaration#Left public static setGlobalInterceptor AST#parameter_list#Left ( AST#parameter#Left interceptor : AST#type_annotation#Left AST#primary_type#Left IGlobalNavigateInterceptor AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stackName : AST#type_annotation#Le...
public static setGlobalInterceptor(interceptor: IGlobalNavigateInterceptor, stackName: string = DEFAULT_STACK_NAME) { ZRouter.getRouterMgr().setGlobalInterceptor(interceptor, stackName) }
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L279-L281
a7293689fb5a053f60a5abe0073e328d3b2e1738
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
getLastDayOfMonth
获取给定年份和月份的最后一天是几号 @param year 年 @param month 月 @returns
static getLastDayOfMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
AST#method_declaration#Left static getLastDayOfMonth AST#parameter_list#Left ( AST#parameter#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#prima...
static getLastDayOfMonth(year: number, month: number): number { return new Date(year, month, 0).getDate(); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L343-L345
9efce8967e36a51778f64ff5ed78acc5b047d828
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/goods/src/main/ets/component/CommentItem.ets
arkts
CommentItem
@file 商品评价 Item 组件 @author Joker.X
@ComponentV2 export struct CommentItem { /** * 评论信息 */ @Param comment: Comment = new Comment(); /** * 点击回调 */ @Param onTap: (() => void) | undefined = undefined; /** * 构建评论 Item * @returns {void} 无返回值 */ build(): void { RowStartTop({ widthValue: P100, paddingValue: ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct CommentItem AST#component_body#Left { /** * 评论信息 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right comment : AST#type_annotation#Left AST#primary_type#Left Comment AST#primary_typ...
@ComponentV2 export struct CommentItem { @Param comment: Comment = new Comment(); @Param onTap: (() => void) | undefined = undefined; build(): void { RowStartTop({ widthValue: P100, paddingValue: $r("app.float.space_padding_medium"), onTap: this.onTap ? (_: ClickEvent): void =>...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/CommentItem.ets#L10-L119
1a0abfefecc74ff79e876ae221adc0d396354496
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets
arkts
RSA解密 @param encryptedData 经过加密的数据 @param privateKey 私钥 @returns 解密后的数据
export async function rsaDecryption(encryptedData: string, privateKey: string): Promise<string> { try { // 创建非对称密钥生成器实例 let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024'); // 将RSA密钥字符串转换为密钥类型 let priKeyBlob: cryptoFramework.DataBlob = { data: fromHe...
AST#export_declaration#Left export AST#function_declaration#Left async function rsaDecryption AST#parameter_list#Left ( AST#parameter#Left encryptedData : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left privateKey : AST#type...
export async function rsaDecryption(encryptedData: string, privateKey: string): Promise<string> { try { let rsaKeyGenerator: cryptoFramework.AsyKeyGenerator = cryptoFramework.createAsyKeyGenerator('RSA1024'); let priKeyBlob: cryptoFramework.DataBlob = { data: fromHexString(privateKey) }; let key...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Security/KeyManager/entry/src/main/ets/utils/RsaUtils.ets#L94-L116
797d289b987fd68df261f9b1fcd72b1651b5104a
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets
arkts
getNetworkStatus
获取网络状态,查询手机卡注册网络的运营商名称、是否处于漫游状态、设备的网络注册状态等信息
getNetworkStatus() { radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { if (err) { logger.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); } // regState字段表示设备的网络注册状态 // (REG_STATE_POWER_OFF,值为3)蜂窝无线电已关闭,modem下电,无法和网侧进行通信 logger.info...
AST#method_declaration#Left getNetworkStatus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left radio AST#expression#Right . getNetworkState AS...
getNetworkStatus() { radio.getNetworkState((err: BusinessError, data: radio.NetworkState) => { if (err) { logger.error(`getNetworkState failed, callback: err->${JSON.stringify(err)}`); } logger.info("Success getNetworkStatus:" + JSON.stringify(data)); }); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/networkstatusobserver/src/main/ets/utils/NetUtils.ets#L187-L196
8942c3676d4ed9e5601350b620ed223b62bba6c4
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/util/src/main/ets/validation/ValidationUtil.ets
arkts
isValidSmsCode
验证短信验证码是否有效(4位数字) @param {string} code - 验证码 @returns {boolean} 是否有效
static isValidSmsCode(code: string): boolean { if (code.length !== 4) { return false; } for (let i = 0; i < code.length; i += 1) { const current: string = code[i]; if (current < "0" || current > "9") { return false; } } return true; }
AST#method_declaration#Left static isValidSmsCode AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary...
static isValidSmsCode(code: string): boolean { if (code.length !== 4) { return false; } for (let i = 0; i < code.length; i += 1) { const current: string = code[i]; if (current < "0" || current > "9") { return false; } } return true; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/validation/ValidationUtil.ets#L30-L41
e4f0ecafe96f33249cce4ad0cac3d02a2d3c5435
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/CountDownTimer.ets
arkts
onFinish
设置倒计时结束回调 @param callback 回调函数
onFinish(callback: () => void): CountDownTimer { this.onFinishCallback = callback; return this; }
AST#method_declaration#Left onFinish AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#function_type#Righ...
onFinish(callback: () => void): CountDownTimer { this.onFinishCallback = callback; return this; }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L58-L61
1ebcf7072b4e7c22087ce31e934695244987be28
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/marquee/src/main/ets/model/MockData.ets
arkts
模拟行程数据
export const TRIP_DATA: Array<TripDataType> = [ { id: 0, trainNumber: "K101", wholeCourse: $r('app.string.marquee_whole_course_data_1'), startingTime: "8:46", endingTime: "9:36", timeDifference: $r('app.string.marquee_time_difference_data_1'), origin: $r('app.string.marquee_origin_data'), ...
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left TRIP_DATA : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left TripDataType AST#primary_type#Right AST#type_annotation#Righ...
export const TRIP_DATA: Array<TripDataType> = [ { id: 0, trainNumber: "K101", wholeCourse: $r('app.string.marquee_whole_course_data_1'), startingTime: "8:46", endingTime: "9:36", timeDifference: $r('app.string.marquee_time_difference_data_1'), origin: $r('app.string.marquee_origin_data'), ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/marquee/src/main/ets/model/MockData.ets#L19-L45
37d53ef2a2951e38de4745262fbcba9a8b371f5e
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onSliderAngleChange
* Change rotate angle.
onSliderAngleChange(angle: number): void { Logger.debug(TAG, `onSliderAngleChange: angle[${angle}]`); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); this.refresh(); } this.sliderAngle = angle; this.cropShow.syncHorizontalAngle(this.sliderAng...
AST#method_declaration#Left onSliderAngleChange AST#parameter_list#Left ( AST#parameter#Left angle : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_typ...
onSliderAngleChange(angle: number): void { Logger.debug(TAG, `onSliderAngleChange: angle[${angle}]`); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); this.refresh(); } this.sliderAngle = angle; this.cropShow.syncHorizontalAngle(this.sliderAng...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L179-L189
08b35f0b74936db1adaed02d6c0fc478cb0213c4
gitee
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
libs/core/src/main/ets/utils/DeviceUtils.ets
arkts
getVoltage
获取当前设备电池的电压,单位微伏。 @returns
static getVoltage(): number { return batteryInfo.voltage; }
AST#method_declaration#Left static getVoltage AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres...
static getVoltage(): number { return batteryInfo.voltage; }
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DeviceUtils.ets#L208-L210
4662516d0b6bd800172fea058b1712fcad67aec3
gitee
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
common/src/main/ets/utils/FileUtil.ets
arkts
* 功能:删除文件 参数 1:要删除的文件的路径
export async function unlink(path: string): Promise<boolean> { let success: boolean = true; try { await fs.unlink(path); Logger.info('[FileUtils.unlink]', `remove file succeed, filePath: ${path}`); return success; } catch (err) { Logger.error('[FileUtils.unlink]', `remove file failed with er...
AST#export_declaration#Left export AST#function_declaration#Left async function unlink AST#parameter_list#Left ( AST#parameter#Left path : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#...
export async function unlink(path: string): Promise<boolean> { let success: boolean = true; try { await fs.unlink(path); Logger.info('[FileUtils.unlink]', `remove file succeed, filePath: ${path}`); return success; } catch (err) { Logger.error('[FileUtils.unlink]', `remove file failed with er...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/utils/FileUtil.ets#L150-L161
2f599dd659c705de98dd8b700af18bee2277c716
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/tabs_actions.ets
arkts
UI Sets the key 'search_input' in AppStorage with text if is not typing in search box. @param text The new content.
export function set_search_box_text(text: string, storage: LocalStorage) { let is_search_input_typing = storage.get('is_search_input_typing') as boolean; if (!is_search_input_typing && text) { storage.set('search_input', url_resource_to_meow(text)) // Update Input Search Box } }
AST#export_declaration#Left export AST#function_declaration#Left function set_search_box_text AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left storage : AST#type_annotation#...
export function set_search_box_text(text: string, storage: LocalStorage) { let is_search_input_typing = storage.get('is_search_input_typing') as boolean; if (!is_search_input_typing && text) { storage.set('search_input', url_resource_to_meow(text)) } }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/tabs_actions.ets#L90-L96
89a0cd56c391f1dbacec649a93458bf8bde5a382
gitee
euler1129/Cloud-flash-payment.git
dfb70c1c67b3b69447f4384661e16b60f40495de
entry/src/main/ets/pages/myAccount/components/CustomDialog1.ets
arkts
CustomDialog1
自定义弹窗组件
@CustomDialog export struct CustomDialog1 { @Link textValue: string @Link textIndex: string // @Link inputValue: string controller: CustomDialogController // 若尝试在CustomDialog中传入多个其他的Controller, // 以实现在CustomDialog中打开另一个或另一些CustomDialog, // 那么此处需要将指向自己的controller放在最后 cancel: () => void confirm: () => v...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct CustomDialog1 AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right textValue : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_...
@CustomDialog export struct CustomDialog1 { @Link textValue: string @Link textIndex: string controller: CustomDialogController cancel: () => void confirm: () => void build() { Column() { Text(this.textValue).fontSize(16).margin({ top: 30, bottom: 20 }) Flex({ justifyContent: Fle...
https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/myAccount/components/CustomDialog1.ets#L4-L35
fbf7e4dc0d49cfe09ba0452c69b097d82a86b0ba
github
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/models/UserModel.ets
arkts
操作结果接口
export interface OperationResult { success: boolean; message: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface OperationResult AST#object_type#Left { AST#type_member#Left success : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left message : AST#type_annota...
export interface OperationResult { success: boolean; message: string; }
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/models/UserModel.ets#L17-L20
8790b48cfa21d0879d91403974a3814dcb1c0456
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Menu/entry/src/main/ets/customBuilder/MenuBuilder.ets
arkts
图标资源
export let startIcon: Resource = $r('app.media.app_icon')
AST#export_declaration#Left export AST#variable_declaration#Left let AST#variable_declarator#Left startIcon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.app_icon' AST#expr...
export let startIcon: Resource = $r('app.media.app_icon')
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Menu/entry/src/main/ets/customBuilder/MenuBuilder.ets#L30-L30
046ec49c03997a0a5a5c964a4e3c8b3ef2d1067c
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/BaseDataSet.ets
arkts
setColorByAlpha
Sets a color with a specific alpha value. @param color @param alpha from 0-255
public setColorByAlpha(color: number, alpha: number): void { let mColor: number = ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)); this.setColorsByVariable([mColor]) }
AST#method_declaration#Left public setColorByAlpha AST#parameter_list#Left ( AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left alpha : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
public setColorByAlpha(color: number, alpha: number): void { let mColor: number = ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)); this.setColorsByVariable([mColor]) }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/BaseDataSet.ets#L214-L217
dd3a97077fbfeb1d60a210781bfd5b0547407253
gitee
IceTeacher/DrawingBook.git
c101a1b904388fcfa72de1ff402307bb9036b68b
entry/src/main/ets/components/BookItemCard.ets
arkts
BookItemLabel
书籍分类标签子组件
@Builder BookItemLabel(labelList: Array<ESObject>) { Flex({ wrap: FlexWrap.Wrap, space: { main: LengthMetrics.vp(10), cross: LengthMetrics.vp(10) } }) { ForEach(labelList, (item: ESObject, index) => { if (index <= 2) { Text(item.label_name) .fontSize(12) .fontColor(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right BookItemLabel AST#parameter_list#Left ( AST#parameter#Left labelList : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_typ...
@Builder BookItemLabel(labelList: Array<ESObject>) { Flex({ wrap: FlexWrap.Wrap, space: { main: LengthMetrics.vp(10), cross: LengthMetrics.vp(10) } }) { ForEach(labelList, (item: ESObject, index) => { if (index <= 2) { Text(item.label_name) .fontSize(12) .fontColor(...
https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/components/BookItemCard.ets#L47-L60
5c2433c102f6463768569a105b89047b2ed00ff9
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/EditingEXIF.ets
arkts
读取图片的EXIF信息,并将IMAGE_WIDTH设置为120。 @param fd - 文件描述符。
export async function readAndEditEXIF(fd: number) { Logger.info('readAndEditEXIF Start'); // [Start pixelmap_create_image_source_by_fd_in_edit] // 获取沙箱路径创建ImageSource const imageSourceApi: image.ImageSource = image.createImageSource(fd); // [End pixelmap_create_image_source_by_fd_in_edit] if (imageSourceApi...
AST#export_declaration#Left export AST#function_declaration#Left async function readAndEditEXIF AST#parameter_list#Left ( AST#parameter#Left fd : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left...
export async function readAndEditEXIF(fd: number) { Logger.info('readAndEditEXIF Start'); const imageSourceApi: image.ImageSource = image.createImageSource(fd); if (imageSourceApi == null) { Logger.error('fd undefined'); } let options: image.ImagePropertyOptions = { index: 0, defaultValue: ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/common/EditingEXIF.ets#L26-L57
8a312b8420d87c57397473adc1bad4c15d901a00
gitee
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinI.ets
arkts
SpinI
TODO SpinKit动画组件 author: 桃花镇童长老 since: 2024/05/01 仓库主页:https://ohpm.openharmony.cn/#/cn/detail/@pura%2Fspinkit github: https://github.com/787107497 gitee: https://gitee.com/tongyuyan/spinkit QQ交流群: 569512366
@ComponentV2 export struct SpinI { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local scaleSize: number = this.spinSize * 0.75; @Local tran1: number = 0; private oldSize: number = this.spinSize; aboutToAppear(): void { this.oldSize = this.spinSize; this.scaleSiz...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinI AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left...
@ComponentV2 export struct SpinI { @Require @Param spinSize: number = 36; @Require @Param spinColor: ResourceColor; @Local scaleSize: number = this.spinSize * 0.75; @Local tran1: number = 0; private oldSize: number = this.spinSize; aboutToAppear(): void { this.oldSize = this.spinSize; this.scaleSiz...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+spinkit@1.0.5/oh_modules/@pura/spinkit/src/main/ets/components/SpinI.ets#L26-L115
91fd157495a6375eb8a078d8ea984df2adf0a6a8
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/DataImportExportService.ets
arkts
readFileContent
读取文件内容
private async readFileContent(filePath: string): Promise<string> { try { const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); // 1MB buffer const readLen = fs.readSync(file.fd, buffer); fs.closeSync(file); const uint8Array = new Uint8...
AST#method_declaration#Left private async readFileContent AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gen...
private async readFileContent(filePath: string): Promise<string> { try { const file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); const readLen = fs.readSync(file.fd, buffer); fs.closeSync(file); const uint8Array = new Uint8Array(buffer,...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/DataImportExportService.ets#L604-L618
ed59c15348588db0fcf2e2c489affcb486790fa6
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/ai/ChatbotEngine.ets
arkts
智能回复模板接口
export interface ResponseTemplate { id: string; category: string; intent: string; templates: string[]; variables?: string[]; conditions?: ResponseCondition[]; }
AST#export_declaration#Left export AST#interface_declaration#Left interface ResponseTemplate AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left category : AST#type_annotation...
export interface ResponseTemplate { id: string; category: string; intent: string; templates: string[]; variables?: string[]; conditions?: ResponseCondition[]; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/ChatbotEngine.ets#L105-L112
5e0cef2657348d778a2f8969c3fc1a0d7f2402c4
github
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets
arkts
popNavigator
仅仅回退过程中当前navigator stack 为空被调用
popNavigator(): DMPNavigatorDelegate | undefined { let navigatorDelegate = this._navigatorDelegateStack.pop() if (navigatorDelegate) { DMPLogger.i(Tags.DMP_PAGE, `hideStack stackId->${navigatorDelegate?.id}`) this.app?.hideStack(navigatorDelegate?.id) } return navigatorDelegate; }
AST#method_declaration#Left popNavigator AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left DMPNavigatorDelegate AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block...
popNavigator(): DMPNavigatorDelegate | undefined { let navigatorDelegate = this._navigatorDelegateStack.pop() if (navigatorDelegate) { DMPLogger.i(Tags.DMP_PAGE, `hideStack stackId->${navigatorDelegate?.id}`) this.app?.hideStack(navigatorDelegate?.id) } return navigatorDelegate; }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Navigator/DMPNavigatorManager.ets#L80-L88
28c6870df756bf24aca0b0a0bdf765f9701ab943
github
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/EmitterUtil.ets
arkts
send
发送Emitter消息 @param msgData 消息数据
public static send(msgData: EmitterMsgData): void { if (!msgData || !msgData.type) { console.error('EmitterUtil: 发送消息缺少必要参数(type必填)'); return; } try { // 发送事件 emitter.emit(msgData.type, { data: msgData }); console.log(`EmitterUtil: 成功发送消息,类型:${msgData.type},数据:${...
AST#method_declaration#Left public static send AST#parameter_list#Left ( AST#parameter#Left msgData : AST#type_annotation#Left AST#primary_type#Left EmitterMsgData AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#pr...
public static send(msgData: EmitterMsgData): void { if (!msgData || !msgData.type) { console.error('EmitterUtil: 发送消息缺少必要参数(type必填)'); return; } try { emitter.emit(msgData.type, { data: msgData }); console.log(`EmitterUtil: 成功发送消息,类型:${msgData.type},数据:${JSON.st...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/EmitterUtil.ets#L46-L61
c5feb8775451e0c5926dce5289bd50a7d47d700d
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets
arkts
checkAllSelected
检查是否全选
checkAllSelected() { let totalSpecs = 0; let selectedSpecs = 0; this.cartItems.forEach(cart => { totalSpecs += cart.spec.length; const specs = this.selectedItems.get(cart.goodsId); if (specs) { selectedSpecs += specs.size; } }); this.isAllSelected = totalSpecs > 0 && ...
AST#method_declaration#Left checkAllSelected AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left totalSpecs = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#...
checkAllSelected() { let totalSpecs = 0; let selectedSpecs = 0; this.cartItems.forEach(cart => { totalSpecs += cart.spec.length; const specs = this.selectedItems.get(cart.goodsId); if (specs) { selectedSpecs += specs.size; } }); this.isAllSelected = totalSpecs > 0 && ...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/pages/CartPage.ets#L308-L319
a029449c92bba0e26ee392dab2068973612ae7c6
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
ETSUI/TransitionAnimation/animation/index.ets
arkts
TransitionsAnimation
Copyright (c) 2022 Huawei Device Co., Ltd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, soft...
export { TransitionsAnimation } from './src/main/ets/components/MainPage/MainPage'
AST#export_declaration#Left export { TransitionsAnimation } from './src/main/ets/components/MainPage/MainPage' AST#export_declaration#Right
export { TransitionsAnimation } from './src/main/ets/components/MainPage/MainPage'
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/TransitionAnimation/animation/index.ets#L16-L16
c871613f3e5a2392bd004d46cf273ce898852ac1
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/pages/NavPathManager.ets
arkts
get
=== 访问器 ===
get navPath(): NavPathStack { return this._navPath }
AST#method_declaration#Left get AST#ERROR#Left navPath AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left NavPathStack AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#ex...
get navPath(): NavPathStack { return this._navPath }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/pages/NavPathManager.ets#L19-L21
52e0df1f083b5802bd935ae214cdde507264bdd8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ArrayUtil.ets
arkts
max
获取数组最大值(数值、字符串、日期)。 @param array @returns
static max<T extends number | string | Date>(array: T[]): T | null { if (array.length === 0) { return null; } let maxValue = array[0]; for (let i = 1; i < array.length; i++) { if (array[i] > maxValue) { maxValue = array[i]; } } return maxValue; }
AST#method_declaration#Left static max AST#type_parameters#Left < AST#type_parameter#Left T extends AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Ri...
static max<T extends number | string | Date>(array: T[]): T | null { if (array.length === 0) { return null; } let maxValue = array[0]; for (let i = 1; i < array.length; i++) { if (array[i] > maxValue) { maxValue = array[i]; } } return maxValue; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ArrayUtil.ets#L138-L149
b3e2b7731bba691450bc34b0a9c7a51543462e13
gitee
openharmony/applications_launcher
f75dfb6bf7276e942793b75e7a9081bbcd015843
common/src/main/ets/default/uicomponents/FormManagerDialog.ets
arkts
getCurrentFormInfo
Get current form information by bundle name.
private async getCurrentFormInfo() { this.mFormModel.getFormsInfoByBundleName(this.bundleName); }
AST#method_declaration#Left private async getCurrentFormInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#...
private async getCurrentFormInfo() { this.mFormModel.getFormsInfoByBundleName(this.bundleName); }
https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/common/src/main/ets/default/uicomponents/FormManagerDialog.ets#L71-L73
bc41c49adfd9a849bd0fec805fa06a5851e98e7d
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets
arkts
deleteAssetAccount
删除资产账户
public async deleteAssetAccount(assetId: number) { const condition: TablePredicateParams = { field: AssetTableFields.ASSET_ID, value: assetId, operator: DBOperator.EQUAL, }; try { await this.delete(AccountingDBConstants.ASSET_TABLE_NAME, [condition]); promptAction.showToast({ m...
AST#method_declaration#Left public async deleteAssetAccount AST#parameter_list#Left ( AST#parameter#Left assetId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#varia...
public async deleteAssetAccount(assetId: number) { const condition: TablePredicateParams = { field: AssetTableFields.ASSET_ID, value: assetId, operator: DBOperator.EQUAL, }; try { await this.delete(AccountingDBConstants.ASSET_TABLE_NAME, [condition]); promptAction.showToast({ m...
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_data_processing/src/main/ets/utils/accountingdb/AccountingDB.ets#L302-L319
ecf86eb255dea66d5882dfe361b2c822a5023bf7
github
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/common/url.ets
arkts
get
==================== 公共API ====================
get href(): string { return this._url; }
AST#method_declaration#Left get AST#ERROR#Left href AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#...
get href(): string { return this._url; }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/url.ets#L587-L589
a61e3c21f340fa38443f92b5bd1a1f5b64eee98e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
picker_utils/src/main/ets/PhotoHelper.ets
arkts
showAssetsCreationDialogEasy
弹窗授权保存。调用接口拉起保存确认弹窗,并保存。 @param srcFileUris 需保存到媒体库中的图片/视频文件对应的媒体库uri。注意: 仅支持处理图片、视频uri。 @param photoCreationConfigs 保存图片/视频到媒体库的配置,包括保存的文件名等,与srcFileUris保持一一对应。 @returns 图片/视频文件是否保存成功。
static async showAssetsCreationDialogEasy(srcFileUris: Array<string>, photoCreationConfigs?: Array<photoAccessHelper.PhotoCreationConfig>): Promise<Array<string>> { let desFileUris: Array<string> = await PhotoHelper.showAssetsCreationDialog(srcFileUris, photoCreationConfigs); for (let index = 0; index < desFile...
AST#method_declaration#Left static async showAssetsCreationDialogEasy AST#parameter_list#Left ( AST#parameter#Left srcFileUris : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_anno...
static async showAssetsCreationDialogEasy(srcFileUris: Array<string>, photoCreationConfigs?: Array<photoAccessHelper.PhotoCreationConfig>): Promise<Array<string>> { let desFileUris: Array<string> = await PhotoHelper.showAssetsCreationDialog(srcFileUris, photoCreationConfigs); for (let index = 0; index < desFile...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/picker_utils/src/main/ets/PhotoHelper.ets#L142-L153
ffa65b5804f920139eea23af3368f5fab29f4967
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/iab/huawei/HwSubscriber.ets
arkts
createPurchase
创建购买
async createPurchase(productId: string): Promise<boolean> { const param: iap.PurchaseParameter = { productId : productId, productType : iap.ProductType.AUTORENEWABLE }; try { const result = await iap.createPurchase(this.context, param); DebugLog.i('Succeeded in creating purchase.'...
AST#method_declaration#Left async createPurchase AST#parameter_list#Left ( AST#parameter#Left productId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ...
async createPurchase(productId: string): Promise<boolean> { const param: iap.PurchaseParameter = { productId : productId, productType : iap.ProductType.AUTORENEWABLE }; try { const result = await iap.createPurchase(this.context, param); DebugLog.i('Succeeded in creating purchase.'...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/huawei/HwSubscriber.ets#L75-L101
1bd7db93387fe6e3ea2f92363ccdabf52b8da954
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Recorder/RecordingView.ets
arkts
构建UI布局
build() { Stack({ alignContent: Alignment.Center }) { // 波纹动画容器 Column() { Blank().layoutWeight(1) // 顶部留白 // 波纹动画视图(绑定动态参数) WaveView({ waveSpeed : this.waveSpeed, waveAmplitude: this.waveAmplitude, waveHeight : this.waveHeight }) ...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( AST#component_parameters#Left { AST#component_parameter#Left alignContent : AST#expression#Left AST#member_expression#Left AST#expression#Left Alignment AST#expression#Right ....
build() { Stack({ alignContent: Alignment.Center }) { Column() { Blank().layoutWeight(1) WaveView({ waveSpeed : this.waveSpeed, waveAmplitude: this.waveAmplitude, waveHeight : this.waveHeight }) } Column({ space:...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/RecordingView.ets#L37-L73
c5c59fbcf9ced562639dacd9d526692615f42ee1
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets
arkts
str2Uint8Array
字符串转uint8Array @param str 待转换字符串 @param coding 转换结果编码 @returns
static str2Uint8Array(str: string, coding: buffer.BufferEncoding) { return new Uint8Array(buffer.from(str, coding).buffer); }
AST#method_declaration#Left static str2Uint8Array AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#...
static str2Uint8Array(str: string, coding: buffer.BufferEncoding) { return new Uint8Array(buffer.from(str, coding).buffer); }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/StrAndUintUtil.ets#L33-L35
63ad69a8c32818f1580a865a68f4514ffd6dfb86
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareMixed
分享混合内容(增强版) @param params - 分享参数对象 优先级:文件 > 图片 > 链接 > 文本 > 标题 > 描述
static shareMixed(params: ShareParams): void { // 确定主分享内容(优先级:图片 > 链接 > 文本 > 标题 > 描述) const primaryContent = ShareUtils.determinePrimaryContent(params); if (!primaryContent) { console.error('ShareUtils: 至少需要提供一个分享内容参数'); return; } // 使用主内容初始化SharedData const data = new systemShare....
AST#method_declaration#Left static shareMixed AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left ShareParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary...
static shareMixed(params: ShareParams): void { const primaryContent = ShareUtils.determinePrimaryContent(params); if (!primaryContent) { console.error('ShareUtils: 至少需要提供一个分享内容参数'); return; } const data = new systemShare.SharedData(primaryContent); ShareUtils.addSeconda...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ShareUtils.ets#L222-L239
2e3f841714f56901d6b9c35fc578cff40b1e0f48
github
openharmony/multimedia_camera_framework
9873dd191f59efda885bc06897acf9b0660de8f2
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
updateSliderValue
更新滑动条数据
updateSliderValue(): void { let zoomRatioRange = this.getZoomRatioRange(); if (zoomRatioRange.length !== 0) { let zoomRatioMin = zoomRatioRange[0]; let zoomRatioMax = zoomRatioRange[1] > Constants.ZOOM_RADIO_MAX ? Constants.ZOOM_RADIO_MAX : zoomRatioRange[1]; let sliderStep = zoomRatio...
AST#method_declaration#Left updateSliderValue AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left zoomRatio...
updateSliderValue(): void { let zoomRatioRange = this.getZoomRatioRange(); if (zoomRatioRange.length !== 0) { let zoomRatioMin = zoomRatioRange[0]; let zoomRatioMax = zoomRatioRange[1] > Constants.ZOOM_RADIO_MAX ? Constants.ZOOM_RADIO_MAX : zoomRatioRange[1]; let sliderStep = zoomRatio...
https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets#L563-L576
81317c1aeb400c2e07f78997efd86f9058f3c1a1
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/data/src/main/ets/repository/UserInfoRepository.ets
arkts
getPersonInfo
获取用户个人信息 @returns {Promise<NetworkResponse<User>>} 用户信息响应
async getPersonInfo(): Promise<NetworkResponse<User>> { return this.networkDataSource.getPersonInfo(); }
AST#method_declaration#Left async getPersonInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < AST...
async getPersonInfo(): Promise<NetworkResponse<User>> { return this.networkDataSource.getPersonInfo(); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/data/src/main/ets/repository/UserInfoRepository.ets#L26-L28
5be13ac265ad9446506d76bfe20f83cd3573a647
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/ui/src/main/ets/component/goods/OrderGoodsItem.ets
arkts
OrderGoodsItem
@file 订单商品条目组件 @author Joker.X
@ComponentV2 export struct OrderGoodsItem { /** * 规格数据 */ @Param data: CartGoodsSpec = new CartGoodsSpec(); /** * 商品 id */ @Param goodsId: number = 0; /** * 商品名称 */ @Param goodsName: string = ""; /** * 商品主图 */ @Param goodsMainPic: string = ""; /** * 规格点击回调 */ @P...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderGoodsItem AST#component_body#Left { /** * 规格数据 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right data : AST#type_annotation#Left AST#primary_type#Left CartGoodsSpec AST#prima...
@ComponentV2 export struct OrderGoodsItem { @Param data: CartGoodsSpec = new CartGoodsSpec(); @Param goodsId: number = 0; @Param goodsName: string = ""; @Param goodsMainPic: string = ""; @Param onSpecClick: (specId: number) => void = () => { }; @Param onQuantityChanged: (coun...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/goods/OrderGoodsItem.ets#L17-L159
df8f761f183701ca22bd9138615256f8ab0f0d39
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/launch/src/main/ets/viewmodel/GuideViewModel.ets
arkts
@file 引导页 ViewModel @author Joker.X
@ObservedV2 export default class GuideViewModel extends BaseViewModel { }
AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class GuideViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { } AST#class_body#Right AST#...
@ObservedV2 export default class GuideViewModel extends BaseViewModel { }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/launch/src/main/ets/viewmodel/GuideViewModel.ets#L7-L9
c5fbf46e1060cefdb29eb816350c6cd711e6c5e2
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/banner/BannerNetworkDataSourceImpl.ets
arkts
getBannerList
查询轮播图列表 @param params 请求参数 @returns 轮播图列表响应
async getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("info/banner/list", params); return resp.data; }
AST#method_declaration#Left async getBannerList AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_an...
async getBannerList(params: Record<string, Unknown>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("info/banner/list", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/banner/BannerNetworkDataSourceImpl.ets#L16-L20
3330b8cd0de306f779e15692e0aa6bc2adaf82d2
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
fillZero
Padding zeros for insufficient digits @param val number @return content string
public fillZero(val: number): string{ return (val > MainConstant.DEFAULT_SINGLE_DIGIT_MAX ? val.toString() : (MainConstant.DEFAULT_ZEROING + val)); }
AST#method_declaration#Left public fillZero AST#parameter_list#Left ( AST#parameter#Left val : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Ri...
public fillZero(val: number): string{ return (val > MainConstant.DEFAULT_SINGLE_DIGIT_MAX ? val.toString() : (MainConstant.DEFAULT_ZEROING + val)); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets#L86-L90
cde103f71b09d556920e56f20102833dca65e835
gitee
tomorrowKreswell/Ledger.git
1f2783ae70b8540d677af8a27f29db1b4089ea69
ledger/entry/src/main/ets/common/database/Rdb.ets
arkts
deleteData
删除数据 @param predicates - 删除数据的条件 @param callback - 删除成功后的回调函数
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => { }): void { // 如果回调函数未提供,记录警告信息 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!'); return; } let resFlag: boo...
AST#method_declaration#Left deleteData AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left relationalStore . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callb...
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => { }): void { if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!'); return; } let resFlag: boolean = false; ...
https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/database/Rdb.ets#L115-L137
8aa46b80194e9d0925f4ab2d2bafe116fe4e7fa2
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
Weather/common/src/main/ets/mock/RequestData.ets
arkts
getSideBg
根据天气类型 获取背景图片
function getSideBg(weatherType: string) { if (weatherType === '晴' || weatherType === 'Sunny') { return $r('app.media.weather_fine'); } else if (weatherType === '阴' || weatherType === '多云' || weatherType === 'Cloudy') { return $r('app.media.weather_yin'); } else { return $r('app.media.weather_rain'); ...
AST#function_declaration#Left function getSideBg AST#parameter_list#Left ( AST#parameter#Left weatherType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement...
function getSideBg(weatherType: string) { if (weatherType === '晴' || weatherType === 'Sunny') { return $r('app.media.weather_fine'); } else if (weatherType === '阴' || weatherType === '多云' || weatherType === 'Cloudy') { return $r('app.media.weather_yin'); } else { return $r('app.media.weather_rain'); ...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/mock/RequestData.ets#L215-L223
43b6cdc151c69a25bfa440ed301c70e4cfceff51
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets
arkts
ComposeListItem
Declare ComposeListItem @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Declare ComposeListItem @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 11
@Component export declare struct ComposeListItem { /** * The ContentItem. * @type { ?ContentItem } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** * The ContentItem. * @type { ?ContentItem } * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct ComposeListItem AST#component_body#Left { /** * The ContentItem. * @type { ?ContentItem } * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 10 */ /** ...
@Component export declare struct ComposeListItem { @Prop contentItem?: ContentItem; @Prop operateItem?: OperateItem; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets#L472-L504
c64d3cb2c9cd146084addc7faeaf0a4fd78101c3
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
products/entry/src/main/ets/pages/lifecycle/LifecycleCaseView.ets
arkts
LifecycleCaseView
@author: HZWei @date: 2024/11/7 @desc: 生命周期管理案例 1、日志过滤:LifecycleMgr 2、ui组件的名称要具有唯一性
@Route({ name: RouterConstants.LIFECYCLE_CASE_VIEW }) @Component export struct LifecycleCaseView { aboutToAppear(): void { } build() { NavDestination() { Column({ space: 15 }) { Text('日志过滤:LifecycleMgr \n ui组件的名称要具有唯一性') Button('Lifecycle1View - addObserver').onClick((event: ClickEvent...
AST#decorated_export_declaration#Left AST#decorator#Left @ Route ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left AST#member_expression#Left AST#expression#Left RouterConstants AST#expression#Right . LIFECYCLE_CASE_VIE...
@Route({ name: RouterConstants.LIFECYCLE_CASE_VIEW }) @Component export struct LifecycleCaseView { aboutToAppear(): void { } build() { NavDestination() { Column({ space: 15 }) { Text('日志过滤:LifecycleMgr \n ui组件的名称要具有唯一性') Button('Lifecycle1View - addObserver').onClick((event: ClickEvent...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/products/entry/src/main/ets/pages/lifecycle/LifecycleCaseView.ets#L12-L51
68d20e3ac929a986c80b87c2d8a35c0fdb58d50b
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/builder/QuestionnaireBuilder.ets
arkts
SurveyQuestionnaire
获取到问卷地址
SurveyQuestionnaire(id: string) { this.questionnaireUrl = VHSurveyInternal.getSurveyUrl(this.webinar!, id) as string return this.questionnaireUrl }
AST#method_declaration#Left SurveyQuestionnaire AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#L...
SurveyQuestionnaire(id: string) { this.questionnaireUrl = VHSurveyInternal.getSurveyUrl(this.webinar!, id) as string return this.questionnaireUrl }
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/builder/QuestionnaireBuilder.ets#L38-L42
522b6986325921f0cc22769e2bd5b4b800a8f5fe
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_tabs.ets
arkts
get_current_main_url
Gets the current url of the main tab. @returns The url.
get_current_main_url() { return this.Tabs[this.main_tab_idx].url; }
AST#method_declaration#Left get_current_main_url AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#subscript_expression#Left AST#expression#Left AST#member_expression#...
get_current_main_url() { return this.Tabs[this.main_tab_idx].url; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L227-L229
b79a51984a0c6fd26b76880a5081fbca89e24cb1
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets
arkts
encodeGCM
加密-GCM模式 @param str 待加密的字符串 @param aesKey AES密钥 @param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式 @param resultCoding 加密后数据的编码方式(hex/base64)-不传默认为base64 @returns
static encodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { //转换key let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding); // 初始化加解密操作环境 let mode = crypto.CryptoMode.ENCRYPT_MODE; //创建...
AST#method_declaration#Left static encodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#...
static encodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding, resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> { let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding); let mode = crypto.CryptoMode.ENCRYPT_MODE; let cipher = crypto...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AESSync.ets#L91-L114
507c8a86512137a9c8a58370fc455d2a7b273e6e
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Sensor/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for all features.
export default class CommonConstants { /** * The entry ability tag. */ static readonly TAG_ABILITY: string = 'EntryAbility'; /** * The home page tag. */ static readonly TAG_HOME: string = 'HomePage'; /** * The Common utils tag. */ static readonly MY_TAG: string = 'wzh'; /** * The C...
AST#export_declaration#Left export default AST#class_declaration#Left class CommonConstants AST#class_body#Left { /** * The entry ability tag. */ AST#property_declaration#Left static readonly TAG_ABILITY : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST...
export default class CommonConstants { static readonly TAG_ABILITY: string = 'EntryAbility'; static readonly TAG_HOME: string = 'HomePage'; static readonly MY_TAG: string = 'wzh'; static readonly TAG_COMMON_UTILS: string = 'CommonUtils'; static readonly TAG_CUSTOM: string = 'CustomDialogWid...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Sensor/entry/src/main/ets/common/constants/CommonConstants.ets#L20-L135
6f0f7bfe41a95817a6a70559023c2d526b720576
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/NotificationService.ets
arkts
isVoiceReminderEnabled
获取语音提醒状态
isVoiceReminderEnabled(): boolean { return this.voiceReminderEnabled; }
AST#method_declaration#Left isVoiceReminderEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_...
isVoiceReminderEnabled(): boolean { return this.voiceReminderEnabled; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/NotificationService.ets#L235-L237
a921e470487f232dfa8465b3d32b972e8304419e
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets
arkts
是否点赞
build() { Column() { Row() { Image(this.moment.user.userImage) .id('userImage') .autoResize(false) .width($r('app.integer.friendMomentsPage_user_image_width')) .height($r('app.integer.friendMomentsPage_user_image_height')) .borderRadius($r('app.integer...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_...
build() { Column() { Row() { Image(this.moment.user.userImage) .id('userImage') .autoResize(false) .width($r('app.integer.friendMomentsPage_user_image_width')) .height($r('app.integer.friendMomentsPage_user_image_height')) .borderRadius($r('app.integer...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/products/phone/entry/src/main/ets/pages/FriendsMomentsPage.ets#L142-L287
24a69c1d52c5d0605ec6327fbdef0ce23fe8de47
gitee
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.userIAM.userAuthIcon.d.ets
arkts
UserAuthIcon
Declare UserAuthIcon, use for user authentication. @syscap SystemCapability.UserIAM.UserAuth.Core @atomicservice @since 12
@Component export default struct UserAuthIcon { /** * Set user auth parameter. * * @type { userAuth.AuthParam } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice * @since 12 */ authParam: userAuth.AuthParam; /** * Set auth widget parameter. * ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct UserAuthIcon AST#component_body#Left { /** * Set user auth parameter. * * @type { userAuth.AuthParam } * @syscap SystemCapability.UserIAM.UserAuth.Core * @atomicservice * @since 1...
@Component export default struct UserAuthIcon { authParam: userAuth.AuthParam; widgetParam: userAuth.WidgetParam; iconHeight?: Dimension; iconColor?: ResourceColor; onAuthResult: (result: userAuth.UserAuthResult) => void; onIconClick?: () => void; }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.userIAM.userAuthIcon.d.ets#L27-L86
c800c3628fa1ba4da6f4134610b00b600de79c7c
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
initialize
Init and clear old content.
private initialize(): void { if (this.input !== undefined) { this.imageRatio = this.input.width / this.input.height; } this.determineMaxScaleFactor(); this.clear(); }
AST#method_declaration#Left private initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binar...
private initialize(): void { if (this.input !== undefined) { this.imageRatio = this.input.width / this.input.height; } this.determineMaxScaleFactor(); this.clear(); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L374-L380
4f060590fa03f5136a68f7e7b4d0d7e4b180ee1e
gitee
zqf-dev/WAndroidHOS.git
e2e560a7c96110c43d13eb232826707601172b6d
entry/src/main/ets/http/Request.ets
arkts
post Form 方法 @param url: 地址 @returns :返回值
export function postForm(url: string, params: HashMap<string, Object>): Promise<Response> { let httpRequest = http.createHttp(); let mIter = params.entries() let temp = mIter.next().value let extraData = '' while (temp != undefined) { extraData += `${temp[0]}=${temp[1]}&` temp = mIter.next().value }...
AST#export_declaration#Left export AST#function_declaration#Left function postForm AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#prim...
export function postForm(url: string, params: HashMap<string, Object>): Promise<Response> { let httpRequest = http.createHttp(); let mIter = params.entries() let temp = mIter.next().value let extraData = '' while (temp != undefined) { extraData += `${temp[0]}=${temp[1]}&` temp = mIter.next().value }...
https://github.com/zqf-dev/WAndroidHOS.git/blob/e2e560a7c96110c43d13eb232826707601172b6d/entry/src/main/ets/http/Request.ets#L90-L127
5ddf71054366b489bdda42fda8c61c8cbc61bffd
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/TextToSpeechService.ets
arkts
15秒超时
private constructor() {}
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { } AST#block_statement#Right AST#constructor_declaration#Right
private constructor() {}
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L51-L51
8c0ae4f57c0008bda0f1148cef068bed2e7c5657
github
JackJiang2011/harmonychat.git
bca3f3e1ce54d763720510f99acf595a49e37879
entry/src/main/ets/pages/constants/MsgSendStatus.ets
arkts
Copyright (C) 2024 即时通讯网(52im.net) & Jack Jiang. The MobileIMSDK-鸿蒙Next客户端 Project. All rights reserved. 联系邮件:jack.jiang@52im.net 联系微信:hellojackjiang 联系QQ: 413980957 技术社区:http://www.52im.net 消息的发送状态常量. 代码参考自IM产品RainbowChat:http://www.52im.net/thread-19-1-1.html @author Jack Jiang(http://www.52im.net/thread-2792-1...
export default class MsgSendStatus { /** 消息发送中 */ static readonly sending: number = 0; /** 消息已被对方收到(我方已收到QoS应答包) */ static readonly beReceived: number = 1; /** 消息发送失败(在QoS超时重传的时间内未收到应答包) */ static readonly sendFaild: number = 2; }
AST#export_declaration#Left export default AST#class_declaration#Left class MsgSendStatus AST#class_body#Left { /** 消息发送中 */ AST#property_declaration#Left static readonly sending : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expressi...
export default class MsgSendStatus { static readonly sending: number = 0; static readonly beReceived: number = 1; static readonly sendFaild: number = 2; }
https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/constants/MsgSendStatus.ets#L18-L25
99381a3aa914372ad674f85147819f12ca89fc4c
github
IceTeacher/DrawingBook.git
c101a1b904388fcfa72de1ff402307bb9036b68b
entry/src/main/ets/pages/BookListPage.ets
arkts
aboutToAppear
生命周期钩子,创建时
aboutToAppear(): void { this.getBookAudioList(0, 1) }
AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression...
aboutToAppear(): void { this.getBookAudioList(0, 1) }
https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookListPage.ets#L60-L62
3d6903324f962432501d8de5d62a02d0343fce89
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Marks the zone open state in AppStorage. Usually used to update shortcut button statuses. @param alias The alias of window / zone. @param stat The status to be put.
export function mark_zone_opened(alias: string, stat: boolean) { let zones = AppStorage.get('zones') as string[]; let idx = zones.indexOf(alias); let zones_opened = AppStorage.get('zones_opened') as boolean[]; zones_opened[idx] = stat; }
AST#export_declaration#Left export AST#function_declaration#Left function mark_zone_opened AST#parameter_list#Left ( AST#parameter#Left alias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stat : AST#type_annotation#Left ...
export function mark_zone_opened(alias: string, stat: boolean) { let zones = AppStorage.get('zones') as string[]; let idx = zones.indexOf(alias); let zones_opened = AppStorage.get('zones_opened') as boolean[]; zones_opened[idx] = stat; }
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L53-L58
781bee8ecb62f6bbde7fe30535a194e58c368171
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/ContactPage.ets
arkts
updateContactGroups
将原始数据转换为分组格式
updateContactGroups(friendList: FriendItem[]) { console.log('更新联系人分组,数量:', friendList.length); // 如果没有好友,显示空状态 if (friendList.length === 0) { this.contactGroups = []; return; } const groupsMap: Map<string, ContactItem[]> = new Map(); friendList.forEach(friend => { const name...
AST#method_declaration#Left updateContactGroups AST#parameter_list#Left ( AST#parameter#Left friendList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left FriendItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_state...
updateContactGroups(friendList: FriendItem[]) { console.log('更新联系人分组,数量:', friendList.length); if (friendList.length === 0) { this.contactGroups = []; return; } const groupsMap: Map<string, ContactItem[]> = new Map(); friendList.forEach(friend => { const name = friend.notat...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/ContactPage.ets#L126-L175
5539700b97003b452fe380f4e197fa70a053fc90
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets
arkts
IDataSource处理数据监听的基本实现
export class FileListDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private fileList: Array<FileItem> = []; public totalCount(): number { return this.fileList.length; } /** * 获取索引对应的数据 * @param index 数组索引 * @returns */ public getData(index: number): FileI...
AST#export_declaration#Left export AST#class_declaration#Left class FileListDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private listeners : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DataChangeListen...
export class FileListDataSource implements IDataSource { private listeners: DataChangeListener[] = []; private fileList: Array<FileItem> = []; public totalCount(): number { return this.fileList.length; } public getData(index: number): FileItem { return this.fileList[index]; } public addDa...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/decompressfile/src/main/ets/model/FileListDataSource.ets#L20-L131
7a5a46946ae74cd02464a512e753c16f0e352e7b
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/ObjectUtil.ets
arkts
getValue
通过key获取对象值 @param target 目标对象 @param key @returns
static getValue<T>(target: Object, key: PropertyKey): T { return Reflect.get(target,key); }
AST#method_declaration#Left static getValue AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left target : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter...
static getValue<T>(target: Object, key: PropertyKey): T { return Reflect.get(target,key); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/ObjectUtil.ets#L153-L155
d5058a70d417f1806e21c3f3fed8a60b1f0c0778
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets
arkts
size
Called when you check how much data is stored. @since 10
static size(): number { return StorageMap.shared.size }
AST#method_declaration#Left static size AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#L...
static size(): number { return StorageMap.shared.size }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L253-L255
b17d0b45aa7c72ee5d698e3fa5aed67d96264f83
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/settings/SettingsService.ets
arkts
loadSettings
加载设置 @returns 加载的设置
private async loadSettings(): Promise<AppSettings | null> { try { const settings = await this.preferencesService.getObject<AppSettings>( SettingsService.SETTINGS_KEYS.APP_SETTINGS ); return settings ?? null; } catch (error) { hilog.warn(0x0001, 'BirthdayReminder', `Failed to load...
AST#method_declaration#Left private async loadSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AppSettings AST#primary_type#Right | AST...
private async loadSettings(): Promise<AppSettings | null> { try { const settings = await this.preferencesService.getObject<AppSettings>( SettingsService.SETTINGS_KEYS.APP_SETTINGS ); return settings ?? null; } catch (error) { hilog.warn(0x0001, 'BirthdayReminder', `Failed to load...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L877-L887
1fa7cd553b613fd8c5826fce6e0db48139d3955b
github
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/theme/WanThemes.ets
arkts
深色主题实现
export class DarkWanTheme implements IWanTheme { PRIMARY_COLOR: THEME = '#000000' SEC_COLOR: THEME = '#1e1e1e' BG_COLOR: THEME = '#121212' BG_SEC_COLOR: THEME = '#1e1e1e' TEXT_COLOR: THEME = '#FFFFFF' TEXT_SEC_COLOR: THEME = '#BBBBBB' TEXT_ON_PRIMARY_COLOR: THEME = '#FFFFFF' TEXT_ON_PRIM...
AST#export_declaration#Left export AST#class_declaration#Left class DarkWanTheme AST#implements_clause#Left implements IWanTheme AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left PRIMARY_COLOR AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left THEME AST#primary_type#Right AST#...
export class DarkWanTheme implements IWanTheme { PRIMARY_COLOR: THEME = '#000000' SEC_COLOR: THEME = '#1e1e1e' BG_COLOR: THEME = '#121212' BG_SEC_COLOR: THEME = '#1e1e1e' TEXT_COLOR: THEME = '#FFFFFF' TEXT_SEC_COLOR: THEME = '#BBBBBB' TEXT_ON_PRIMARY_COLOR: THEME = '#FFFFFF' TEXT_ON_PRIM...
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/theme/WanThemes.ets#L111-L141
a9634a63431f1077618925876895b15c2baf0e6b
github
weiwei0928/Eyepetizer-harmony.git
fd5947c6f616c22d42256f36ba752093b782a910
library/src/main/ets/components/PullToRefresh/TypeAlias.ets
arkts
通用数据类型
export type CommonType = number | string | boolean | Array<number> | Array<string> | Array<boolean> | object | Object | ArrayBuffer | null
AST#export_declaration#Left export AST#type_declaration#Left type CommonType = AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left AST#generic...
export type CommonType = number | string | boolean | Array<number> | Array<string> | Array<boolean> | object | Object | ArrayBuffer | null
https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/library/src/main/ets/components/PullToRefresh/TypeAlias.ets#L2-L3
935cd72b4fc2cd238871c95b08350d0131688210
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/models/ContactModel.ets
arkts
getAvatarUrl
获取头像URL或默认头像
getAvatarUrl(): string { if (this.contact.avatar) { return this.contact.avatar; } // 根据性别返回默认头像 switch (this.contact.gender) { case Gender.MALE: return 'assets/images/default_male_avatar.png'; case Gender.FEMALE: return 'assets/images/default_female_avatar.png'; ...
AST#method_declaration#Left getAvatarUrl AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#ERROR#Left AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_ex...
getAvatarUrl(): string { if (this.contact.avatar) { return this.contact.avatar; } switch (this.contact.gender) { case Gender.MALE: return 'assets/images/default_male_avatar.png'; case Gender.FEMALE: return 'assets/images/default_female_avatar.png'; default: ...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L433-L446
fa17e8f68e169dd1e632096b7915db480539ecd1
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets
arkts
registerWindowListener
@des 注册监听函数
registerWindowListener(windowStage: window.WindowStage) { let windowClass: window.Window = windowStage.getMainWindowSync() // 3. 注册监听函数,动态获取避让区域数据 windowClass.on('avoidAreaChange', (data) => { if (data.type === window.AvoidAreaType.TYPE_SYSTEM) { let topRectHeight = data.area.topRect.height; ...
AST#method_declaration#Left registerWindowListener AST#parameter_list#Left ( AST#parameter#Left windowStage : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left window . WindowStage AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Rig...
registerWindowListener(windowStage: window.WindowStage) { let windowClass: window.Window = windowStage.getMainWindowSync() windowClass.on('avoidAreaChange', (data) => { if (data.type === window.AvoidAreaType.TYPE_SYSTEM) { let topRectHeight = data.area.topRect.height; this.setTopSafeH...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinBMI/entry/src/main/ets/utils/DxinScreenManager.ets#L53-L65
c217589ee07401009709aefb6257cce110a962d2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets
arkts
构建界面
build() { Column() { // 服务端IP和端口放在一行 Row() { Column() { Text($r('app.string.Enter_Server_Ip')) .fontSize(FONT.MEDIUM) .fontColor(Color.Gray) .textAlign(TextAlign.Start) .margin({ right: MARGIN.MEDIUM }) TextInput() ....
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 服务端IP和端口放在一行 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left...
build() { Column() { Row() { Column() { Text($r('app.string.Enter_Server_Ip')) .fontSize(FONT.MEDIUM) .fontColor(Color.Gray) .textAlign(TextAlign.Start) .margin({ right: MARGIN.MEDIUM }) TextInput() .width('100%') ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/UdpClient_Server.ets#L65-L206
a100d61647b40ebb4536913e4b4997a52817b8f3
gitee