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
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/pages/Index.ets
arkts
isBackgroundBlur
是否开启背景模糊
private isBackgroundBlur(): uiEffect.Filter { if (this.isToolViewShow) { return uiEffect.createFilter().blur(15); } return uiEffect.createFilter().blur(0) }
AST#method_declaration#Left private isBackgroundBlur AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left uiEffect . Filter AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST...
private isBackgroundBlur(): uiEffect.Filter { if (this.isToolViewShow) { return uiEffect.createFilter().blur(15); } return uiEffect.createFilter().blur(0) }
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/pages/Index.ets#L430-L435
76645dd9aa0d8bd770f5c6f32de99d390b0f2fd1
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets
arkts
TODO DES加解密 author: 桃花镇童长老ᥫ᭡ since: 2024/07/01
export class DES { /** * 加密(ECB模式),异步 * @param data 加密或者解密的数据。data不能为null。 * @param symKey 指定加密或解密的密钥。 * @returns */ static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> { return DES.encrypt(data, symKey, null, '3DES192|ECB|PK...
AST#export_declaration#Left export AST#class_declaration#Left class DES AST#class_body#Left { /** * 加密(ECB模式),异步 * @param data 加密或者解密的数据。data不能为null。 * @param symKey 指定加密或解密的密钥。 * @returns */ AST#method_declaration#Left static async encryptECB AST#parameter_list#Left ( AST#parameter#Left data : AST#type_...
export class DES { static async encryptECB(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): Promise<cryptoFramework.DataBlob> { return DES.encrypt(data, symKey, null, '3DES192|ECB|PKCS7'); } static encryptECBSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey): cryptoFr...
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/DES.ets#L24-L187
b4d2f341dca4aa11f9054b6c7079f673ad82acab
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets
arkts
loadTaskProgress
加载任务进度
async loadTaskProgress() { if (!this.task.id) return; try { const progress = await getTaskProgress(this.task.id); if (progress && progress.length > 0) { this.taskProgress = progress; } } catch (error) { const err: Error = error as Error; console.error(`加载任务进度失败: ${...
AST#method_declaration#Left async loadTaskProgress 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#member_expression#Left AST#expression#Left AST#unary_expression#Left ! A...
async loadTaskProgress() { if (!this.task.id) return; try { const progress = await getTaskProgress(this.task.id); if (progress && progress.length > 0) { this.taskProgress = progress; } } catch (error) { const err: Error = error as Error; console.error(`加载任务进度失败: ${...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L237-L249
fcc69e64739dacf3863662cb27c2708bac77c514
github
common-apps/ZRouter
5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6
features/harA/src/main/ets/components/Page1.ets
arkts
Page1
@author: HZWei @date: 2024/7/18 @desc:
@Route({ name: "harAPage1", needLogin: true }) @Component export struct Page1 { @State message: string = 'Hello World'; build() { NavDestination(){ Column({space:12}){ Button('toHarAPage1').onClick((event: ClickEvent) => { // ZRouter.push("harAPage1") ZRouter.getInstance().pus...
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 "harAPage1" AST#expression#Right AST#property_assignment#Right , AST#property_assignment#Left AST#proper...
@Route({ name: "harAPage1", needLogin: true }) @Component export struct Page1 { @State message: string = 'Hello World'; build() { NavDestination(){ Column({space:12}){ Button('toHarAPage1').onClick((event: ClickEvent) => { ZRouter.getInstance().push("harAPage1") }) ...
https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/features/harA/src/main/ets/components/Page1.ets#L10-L45
db5673349b03c08089472e0512ec638c0b0ddc75
gitee
ashcha0/line-inspection-terminal-frontend_arkts.git
c82616097e8a3b257b7b01e75b6b83ce428b518c
entry/src/main/ets/services/CameraService.ets
arkts
getCameraInfoList
获取摄像头信息列表(设备列表 + UI信息转换的组合方法) @returns Promise<CameraInfo[]> 摄像头信息列表
static async getCameraInfoList(): Promise<CameraInfo[]> { try { console.info('[CameraService] 🎬 开始获取摄像头信息列表'); const devices = await CameraService.getCameraDevices(); const cameraInfoList = CameraService.convertToCameraInfo(devices); const logInfo: CameraListLogInfo = { ...
AST#method_declaration#Left static async getCameraInfoList 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#array_type#Left CameraInfo [ ] AST#array_type#Right ...
static async getCameraInfoList(): Promise<CameraInfo[]> { try { console.info('[CameraService] 🎬 开始获取摄像头信息列表'); const devices = await CameraService.getCameraDevices(); const cameraInfoList = CameraService.convertToCameraInfo(devices); const logInfo: CameraListLogInfo = { ...
https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/CameraService.ets#L217-L235
2706c74223b8b5631ec1dc24d6266470df66a24e
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/OneAutumn/entry/src/main/ets/model/PageRouterParam.ets
arkts
热门诗人的诗词 跳转查看详细内容时,携带参数
export class HotPoetPoemDetailParam { phrase: HotPoem poetName: string constructor
AST#export_declaration#Left export AST#ERROR#Left class HotPoetPoemDetailParam { phrase : HotPoem poetName : string AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right
export class HotPoetPoemDetailParam { phrase: HotPoem poetName: string constructor
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/OneAutumn/entry/src/main/ets/model/PageRouterParam.ets#L5-L9
f434294b2c213a06eb9bda8afae847c218663c05
gitee
waylau/harmonyos-tutorial
74e23dfa769317f8f057cc77c2d09f0b1f2e0773
samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets
arkts
deletePreferences
从内存中移除指定文件对应的Preferences单实例。 移除Preferences单实例时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。
async deletePreferences() { preferences.deletePreferences(context, options, (err: BusinessError) => { if (err) { console.error(`Failed to delete preferences. Code:${err.code}, message:${err.message}`); return; } this.dataPreferences = null; console.info('Succeeded in deleti...
AST#method_declaration#Left async deletePreferences 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 preferences AST#expression#Right . delet...
async deletePreferences() { preferences.deletePreferences(context, options, (err: BusinessError) => { if (err) { console.error(`Failed to delete preferences. Code:${err.code}, message:${err.message}`); return; } this.dataPreferences = null; console.info('Succeeded in deleti...
https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets#L60-L71
0c09710726bd3a47f45e39f6a76950fa18ca4d95
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderDetailPage.ets
arkts
PageContent
页面内容 @returns {void} 无返回值
@Builder private PageContent() { ColumnStart({ fillMaxSize: true }) { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderDetailContent() }) .layoutWeight(1); if (this.vm.uiState === BaseNetWorkU...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PageContent AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left ColumnStart ( AST#component_parameters#Left { AST#comp...
@Builder private PageContent() { ColumnStart({ fillMaxSize: true }) { BaseNetWorkView({ uiState: this.vm.uiState, onRetry: (): void => this.vm.retryRequest(), content: (): void => this.OrderDetailContent() }) .layoutWeight(1); if (this.vm.uiState === BaseNetWorkU...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderDetailPage.ets#L67-L124
31ffd2578e723631998f4de20ff325c32cb95b61
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets
arkts
FoldSplitContainer
Defines FoldSplitContainer container. @interface FoldSplitContainer @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
@Component export struct FoldSplitContainer { /** * The builder function which will be rendered in the major region of container. * * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ @BuilderParam primary: Callback<void>;...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct FoldSplitContainer AST#component_body#Left { /** * The builder function which will be rendered in the major region of container. * * @type { Callback<void> } * @syscap SystemCapability.ArkUI.ArkUI.Full ...
@Component export struct FoldSplitContainer { @BuilderParam primary: Callback<void>; @BuilderParam secondary: Callback<void>; @BuilderParam extra?: Callback<void>; @Prop @Watch('updateLayout') expandedLayoutOptions: ExpandedRegionLayoutOptions = { horizontalSplitRatio: PresetSplitRatio...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/foldsplitcontainer/source/foldsplitcontainer.ets#L343-L821
6a1638227b481fe3b203d982077d65fc379c3434
gitee
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/services/LogService.ets
arkts
isServiceInitialized
检查服务是否已初始化
isServiceInitialized(): boolean { return this.isInitialized; }
AST#method_declaration#Left isServiceInitialized 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_ex...
isServiceInitialized(): boolean { return this.isInitialized; }
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/LogService.ets#L41-L43
1d04434aaaf398483ca814f2c19fe2ab02197c1e
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/DateUtil.ets
arkts
compareDate
比较指定日期相差的毫秒数 @param date1 @param date2 @param abs 是否绝对值
static compareDate(date1: number | string | Date, date2: number | string | Date, abs: boolean = false): number { const dateTime1: number = DateUtil.getFormatDate(date1).getTime(); const dateTime2: number = DateUtil.getFormatDate(date2).getTime(); const diff = dateTime2 - dateTime1; return abs ? Math.abs...
AST#method_declaration#Left static compareDate AST#parameter_list#Left ( AST#parameter#Left date1 : 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 compareDate(date1: number | string | Date, date2: number | string | Date, abs: boolean = false): number { const dateTime1: number = DateUtil.getFormatDate(date1).getTime(); const dateTime2: number = DateUtil.getFormatDate(date2).getTime(); const diff = dateTime2 - dateTime1; return abs ? Math.abs...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L259-L264
fb978bb429e521e7c2d33095c285acf49fc38369
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets
arkts
readC1
读取C1部分 @param sm2_sequence sm2序列工具 @param data 待读取的数据 @returns C1部分
private readC1(sm2_sequence: SM2Sequence, data: string): string { let xy: string[] = []; for (let i = 0; i < 2; i++) { if (data.startsWith("0220")) { xy[i] = data.slice(4, 68); data = data.slice(68, data.length); } else if (data.startsWith("022100")) { xy[i] = data.slice(6, 7...
AST#method_declaration#Left private readC1 AST#parameter_list#Left ( AST#parameter#Left sm2_sequence : AST#type_annotation#Left AST#primary_type#Left SM2Sequence AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#pri...
private readC1(sm2_sequence: SM2Sequence, data: string): string { let xy: string[] = []; for (let i = 0; i < 2; i++) { if (data.startsWith("0220")) { xy[i] = data.slice(4, 68); data = data.slice(68, data.length); } else if (data.startsWith("022100")) { xy[i] = data.slice(6, 7...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Convert.ets#L208-L224
51b44480c7cc6bb3b4efaa19c2c5533cb23bae17
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/SM2.ets
arkts
getSM2PriKey
获取转换SM2私钥 @param key 传入的密钥数据,未序列化的原始裸数据 @returns
static getSM2PriKey(key: string): cryptoFramework.PriKey { key = StrUtil.startsWith(key, "0x") ? key : `0x${key}`; let sk: bigint = BigInt(key); let priKey: cryptoFramework.ECCPriKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), sk: sk, algName: "SM2", ...
AST#method_declaration#Left static getSM2PriKey AST#parameter_list#Left ( AST#parameter#Left key : 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#qualified_type#Lef...
static getSM2PriKey(key: string): cryptoFramework.PriKey { key = StrUtil.startsWith(key, "0x") ? key : `0x${key}`; let sk: bigint = BigInt(key); let priKey: cryptoFramework.ECCPriKeySpec = { params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'), sk: sk, algName: "SM2", ...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM2.ets#L161-L172
9eb1249b84c323369b9f020b39c11076ab291aa5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/common/CommonNavigator.ets
arkts
toContributors
跳转到贡献者列表 @returns {void} 无返回值
static toContributors(): void { navigateTo(CommonRoutes.Contributors); }
AST#method_declaration#Left static toContributors 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_custom_component_statement#Left navigateTo ( AST#expression#Left AST#membe...
static toContributors(): void { navigateTo(CommonRoutes.Contributors); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/common/CommonNavigator.ets#L46-L48
325b31b85cb5d3faf96574cb9bb0706d92efad1a
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
db config day info table
export const DAY_INFO = { tableName: 'dayInfo', sqlCreate: 'CREATE TABLE IF NOT EXISTS dayInfo(date TEXT NOT NULL PRIMARY KEY, targetTaskNum INTEGER, finTaskNum INTEGER)', columns: ['date', 'targetTaskNum', 'finTaskNum'] } /** global info table */
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DAY_INFO = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left tableName AST#property_name#Right : AST#expression#Left 'dayInfo' AST#expression#Right AST#property_assignment#...
export const DAY_INFO = { tableName: 'dayInfo', sqlCreate: 'CREATE TABLE IF NOT EXISTS dayInfo(date TEXT NOT NULL PRIMARY KEY, targetTaskNum INTEGER, finTaskNum INTEGER)', columns: ['date', 'targetTaskNum', 'finTaskNum'] }
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L19-L25
36f9edcab5ec6e5888b37900636ac6982fa86fdf
github
iichen-bycode/ArkTsWanandroid.git
ad128756a6c703d9a72cf7f6da128c27fc63bd00
entry/src/main/ets/view/ViewStateComponent.ets
arkts
convertImage
转换图片 @returns
convertImage() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.media.loading') break; case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.media.icon_net_error') break; case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: ...
AST#method_declaration#Left convertImage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left switch ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . viewSt...
convertImage() { switch (this.viewState) { case ViewStateConstant.VIEW_STATE_LOADING: return $r('app.media.loading') break; case ViewStateConstant.VIEW_STATE_ERROR: return $r('app.media.icon_net_error') break; case ViewStateConstant.VIEW_STATE_NETWORK_ERROR: ...
https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/view/ViewStateComponent.ets#L82-L100
81f985234906d132a1b3892928f5e6fdc840489a
github
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
harmonyos/src/main/ets/services/data/ContactService.ets
arkts
createContact
创建联系人 @param params 创建参数 @returns 创建的联系人
async createContact(params: CreateContactParams): Promise<Contact> { try { // 验证数据 const validationResult = ContactModel.validate(params); if (!validationResult.isValid) { throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`); } // 检查联系人数量限制 const totalCount =...
AST#method_declaration#Left async createContact AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateContactParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#ge...
async createContact(params: CreateContactParams): Promise<Contact> { try { const validationResult = ContactModel.validate(params); if (!validationResult.isValid) { throw new Error(`数据验证失败: ${validationResult.errors.join(', ')}`); } const totalCount = await this.databas...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/data/ContactService.ets#L49-L87
c31375b351179a85f0c485f85858b665db1ac825
github
dcm23333/FishManager.git
952dde4475268ac16f3480f3d55f82033aa6b467
FishManager/entry/src/main/ets/common/contants/commonContants.ets
arkts
number days of one week
export const WEEK_DAY_TIME: number = WEEK_DAY_NUM * 24 * 60 * 60 * 1000;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left WEEK_DAY_TIME : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#binary_expression#Left AST#e...
export const WEEK_DAY_TIME: number = WEEK_DAY_NUM * 24 * 60 * 60 * 1000;
https://github.com/dcm23333/FishManager.git/blob/952dde4475268ac16f3480f3d55f82033aa6b467/FishManager/entry/src/main/ets/common/contants/commonContants.ets#L188-L188
bbfafabdd29587674849d3c7aeea292f691155a9
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Select/entry/src/main/ets/pages/components/button/buttonControlSize.ets
arkts
ButtonControlSizeBuilder
Copyright (c) 2025 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 ButtonControlSizeBuilder(name: string, param: Object) { ButtonControlSizeExample() }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ButtonControlSizeBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#L...
@Builder export function ButtonControlSizeBuilder(name: string, param: Object) { ButtonControlSizeExample() }
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/button/buttonControlSize.ets#L16-L19
a25c13d673dbec821e68a9c1622d8b53364135d8
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/PathUtility.ets
arkts
isExists
检查路径是否存在 @param path 目标路径 @returns 是否存在
static isExists(path: string): boolean { try { fs.accessSync(path); return true; } catch { return false; } }
AST#method_declaration#Left static isExists 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#primary_type#Left boolean AST#primary_type#...
static isExists(path: string): boolean { try { fs.accessSync(path); return true; } catch { return false; } }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/PathUtility.ets#L144-L151
14b158e1a8a11bfc83d5079306bb80db637edef2
github
kaina404/HarmonyStock.git
99233a46fb0dfb21e02294c730fd80e2fb404f9b
entry/src/main/ets/router/RouterManager.ets
arkts
App容器页面
export const Path_Main = 'pages/main/ContentPage' /** * 搜索股票页面 */
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left Path_Main = AST#expression#Left 'pages/main/ContentPage' AST#expression#Right AST#variable_declarator#Right /** * 搜索股票页面 */ AST#variable_declaration#Right AST#export_declaration#Right
export const Path_Main = 'pages/main/ContentPage'
https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/router/RouterManager.ets#L6-L9
7208bafece0090d9f46340672dd27a70ef3d39ab
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/DateModel.ets
arkts
Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice,this list of conditions and the following...
export class DateModel { public day: number; public week: number; public month: number; public year: number; constructor(day: number, week: number, month: number, year: number) { this.day = day; this.week = week; this.month = month; this.year = year; } }
AST#export_declaration#Left export AST#class_declaration#Left class DateModel AST#class_body#Left { AST#property_declaration#Left public day : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left public week...
export class DateModel { public day: number; public week: number; public month: number; public year: number; constructor(day: number, week: number, month: number, year: number) { this.day = day; this.week = week; this.month = month; this.year = year; } }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example2/components/DateModel.ets#L29-L41
74f46f7e2802f09336c197ed7cb8e334b0c8da0b
gitee
AlbertZyc/tab-layout
4ba256eead3792c84128f8679b26ac159a2d7f06
entry/src/main/ets/BasicDataSource.ets
arkts
notifyDataReload
通知LazyForEach组件需要重载所有子组件
notifyDataReload(): void { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
AST#method_declaration#Left notifyDataReload 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#express...
notifyDataReload(): void { this.listeners.forEach(listener => { listener.onDataReloaded(); }) }
https://github.com/AlbertZyc/tab-layout/blob/4ba256eead3792c84128f8679b26ac159a2d7f06/entry/src/main/ets/BasicDataSource.ets#L38-L42
4b845101652916d488c1249244d24bcb9052e7fb
gitee
wuyuanwuhui999/harmony-arkts-chat-app-ui.git
128861bc002adae9c34c6ce8fbf12686c26e51ec
entry/src/main/ets/utils/PreferenceModel.ets
arkts
getTenantId
写入密码
async getTenantId(userId:string) { return this.getPreference(`${userId}:tenantId`); }
AST#method_declaration#Left async getTenantId AST#parameter_list#Left ( AST#parameter#Left userId : 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#return_statement#Lef...
async getTenantId(userId:string) { return this.getPreference(`${userId}:tenantId`); }
https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/utils/PreferenceModel.ets#L105-L107
49debbba45c9c58cd5cbc9844ff9353f6d46236f
github
openharmony/update_update_app
0157b7917e2f48e914b5585991e8b2f4bc25108a
feature/ota/src/main/ets/UpgradeAdapter.ets
arkts
getNotifyInstance
取提醒对象 @return 提醒对象
getNotifyInstance(): INotify { if (!this._notifyInstance) { this._notifyInstance = new NotificationHelper(); } return this._notifyInstance; }
AST#method_declaration#Left getNotifyInstance AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left INotify 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#mem...
getNotifyInstance(): INotify { if (!this._notifyInstance) { this._notifyInstance = new NotificationHelper(); } return this._notifyInstance; }
https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/UpgradeAdapter.ets#L60-L65
4a2da40d000ef9aa56d8511b3f3417a7efbad49a
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/utils/LunarUtils.ets
arkts
lunarToSolar
农历转公历 @param lunarYear 农历年份 @param lunarMonth 农历月份 @param lunarDay 农历日期 @param isLeapMonth 是否闰月 @returns 公历日期字符串(YYYY-MM-DD格式)
static lunarToSolar(lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean): string | null;
AST#method_declaration#Left static lunarToSolar AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#...
static lunarToSolar(lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean): string | null;
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarUtils.ets#L243-L243
11ec255ca7a7272c75beac0e072466f2fb98b56b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/LocationUtil.ets
arkts
onLocationChangeEasy
开启位置变化订阅,并发起定位请求。 @param callBack @returns 失败返回错误码,成功返回0。
static onLocationChangeEasy(callBack: Callback<geoLocationManager.Location>): number { try { let locationRequest: geoLocationManager.LocationRequest = { 'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, //表示快速获取位置优先,如果应用希望快速拿到一个位置,可以将优先级设置为该字段。 'scenario': geoLocationManager.Lo...
AST#method_declaration#Left static onLocationChangeEasy AST#parameter_list#Left ( AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Callback AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left geoLocationManager . Location AST...
static onLocationChangeEasy(callBack: Callback<geoLocationManager.Location>): number { try { let locationRequest: geoLocationManager.LocationRequest = { 'priority': geoLocationManager.LocationRequestPriority.FIRST_FIX, 'scenario': geoLocationManager.LocationRequestScenario.UNSET, 'ti...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/LocationUtil.ets#L91-L107
c450aa217c356d945c4d9c80057db3ed77f7aba2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
arkts
省信息类
export class Province { code: string; // 省id name: string; // 省名 children: City[]; // 存放市、区信息 constructor(code: string = '', name: string = '', children: City[]) { this.code = code; this.name = name; this.children = children; } }
AST#export_declaration#Left export AST#class_declaration#Left class Province AST#class_body#Left { AST#property_declaration#Left code : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right // 省id AST#property_declaration#Left name : AST#...
export class Province { code: string; name: string; children: City[]; constructor(code: string = '', name: string = '', children: City[]) { this.code = code; this.name = name; this.children = children; } }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets#L32-L42
241b61f5414227161ce57ea0d18558d6b7344fcd
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/hashing/HashTable.ets
arkts
哈希表类
export class HashTable<K, V> { private table: Array<HashNode<K, V> | null>; private size: number; private capacity: number; private readonly LOAD_FACTOR: number = 0.75; constructor(initialCapacity: number = 16) { this.capacity = initialCapacity; this.size = 0; this.table = new Array<HashNode<K, V...
AST#export_declaration#Left export AST#class_declaration#Left class HashTable AST#type_parameters#Left < AST#type_parameter#Left K AST#type_parameter#Right , AST#type_parameter#Left V AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#property_declaration#Left private table : AST#type_annota...
export class HashTable<K, V> { private table: Array<HashNode<K, V> | null>; private size: number; private capacity: number; private readonly LOAD_FACTOR: number = 0.75; constructor(initialCapacity: number = 16) { this.capacity = initialCapacity; this.size = 0; this.table = new Array<HashNode<K, V...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/hashing/HashTable.ets#L19-L153
1184a56021ad7d785a1c60ed69f871339d6cd111
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets
arkts
listCompressBundle
读取压缩包输出目录下压缩包 @param outDir 压缩包输出目录 @returns
listCompressBundle(outDir: string) { fs.listFile(outDir).then((fileNames: Array<string>) => { this.compressBundleName = fileNames[0]; }).catch((err: BusinessError) => { logger.error(TAG, `list file failed with error message: ${err.message}, error code: ${err.code}`) }) }
AST#method_declaration#Left listCompressBundle AST#parameter_list#Left ( AST#parameter#Left outDir : 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#builder_function_body#Left { AST#expression_statement#Left AST#ex...
listCompressBundle(outDir: string) { fs.listFile(outDir).then((fileNames: Array<string>) => { this.compressBundleName = fileNames[0]; }).catch((err: BusinessError) => { logger.error(TAG, `list file failed with error message: ${err.message}, error code: ${err.code}`) }) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFileComponent.ets#L95-L101
f565297fbe7a02134d4c6603a68d27c4e606aa6d
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets
arkts
getDistributedObject
从分布式对象中恢复迁移数据 @param want 发起方传入的want参数
async getDistributedObject(want: Want) { if (!want.parameters) { return; } // 从want中恢复sessionId this.sessionId = want?.parameters?.session as string; Logger.info(TAG, `etDistributedObject() : continuation sessionId: ${this.sessionId}, version = ${want?.parameters?.version}`); // 每次创建...
AST#method_declaration#Left async getDistributedObject AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want 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#Le...
async getDistributedObject(want: Want) { if (!want.parameters) { return; } this.sessionId = want?.parameters?.session as string; Logger.info(TAG, `etDistributedObject() : continuation sessionId: ${this.sessionId}, version = ${want?.parameters?.version}`); if (this.d_object) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedJotNote/entry/src/main/ets/entryability/EntryAbility.ets#L149-L189
2e1c000cbf690a35efe32517d040daeeb6c6f463
gitee
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Web/PageRedirection/entry/src/main/ets/common/constants/CommonConstants.ets
arkts
Common constants for common component.
export class CommonConstants { // Font family. static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi'; // 100 percent. static readonly FULL_PERCENT: string = '100%'; // 50 percent. static readonly PERCENT_50: string = '50%'; // Duration. static readonly TOAST_DURATION: number = 2000; // Space...
AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // Font family. AST#property_declaration#Left static readonly HARMONY_HEI_TI_FONT_FAMILY = AST#expression#Left 'HarmonyHeiTi' AST#expression#Right ; AST#property_declaration#Right // 100 percent. AST#property_decla...
export class CommonConstants { static readonly HARMONY_HEI_TI_FONT_FAMILY = 'HarmonyHeiTi'; static readonly FULL_PERCENT: string = '100%'; static readonly PERCENT_50: string = '50%'; static readonly TOAST_DURATION: number = 2000; static readonly NORMAL_SPACE: number = 12; }
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Web/PageRedirection/entry/src/main/ets/common/constants/CommonConstants.ets#L19-L34
55edb01710d76f5290b5085d118c46d1695bb23d
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/component/Row.ets
arkts
RowSpaceAroundCenter
横向环绕分布 + 垂直居中
@ComponentV2 export struct RowSpaceAroundCenter { /** * Row 构造参数 */ @Param options: RowOptions | RowOptionsV2 = {}; /** * 宽度 */ @Param widthValue: Length | undefined = undefined; /** * 高度 */ @Param heightValue: Length | undefined = undefined; /** * 尺寸(对应官方 size 属性) */ @Para...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct RowSpaceAroundCenter AST#component_body#Left { /** * Row 构造参数 */ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right options : AST#type_annotation#Left AST#union_type#Left AST#primary_...
@ComponentV2 export struct RowSpaceAroundCenter { @Param options: RowOptions | RowOptionsV2 = {}; @Param widthValue: Length | undefined = undefined; @Param heightValue: Length | undefined = undefined; @Param sizeValue: SizeOptions | undefined = undefined; @Param paddingValue: Padding ...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Row.ets#L465-L540
48be8246f0c0ecdef166457b6584b71c936b1342
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/utils/BuilderNodePool.ets
arkts
继承NodeController,创建可以复用的子组件
export class NodeItem extends NodeController { public builder: WrappedBuilder<ESObject> | null = null; public node: BuilderNode<ESObject> | null = null; public data: ESObject = {}; // 子组件类型,复用时会根据type查找对应的子组件使用 public type: string = ''; public id: number = 0; aboutToDisappear(): void { // 当页面销毁时回收组件到...
AST#export_declaration#Left export AST#class_declaration#Left class NodeItem extends AST#type_annotation#Left AST#primary_type#Left NodeController AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left public builder : AST#type_annotation#Left AST#union_type#Left AST#primar...
export class NodeItem extends NodeController { public builder: WrappedBuilder<ESObject> | null = null; public node: BuilderNode<ESObject> | null = null; public data: ESObject = {}; public type: string = ''; public id: number = 0; aboutToDisappear(): void { NodePool.getInstance().recycleNode(thi...
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/GlobalCustomComponentReuse/ComponentPrebuildByOnIdle/customreusablepool/src/main/ets/utils/BuilderNodePool.ets#L20-L53
e1e550cdadbfaa3cb9dba022150d29941a3826c2
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/ArkTS1.2/TabsSample/entry/src/main/ets/model/functionalScenes/WaterFlowDataSource.ets
arkts
实现IDataSource接口的对象,用于瀑布流组件加载数据
export class WaterFlowDataSource<SceneModuleInfo> implements IDataSource<SceneModuleInfo> { private dataArray: SceneModuleInfo[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: SceneModuleInfo[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i])...
AST#export_declaration#Left export AST#class_declaration#Left class WaterFlowDataSource AST#type_parameters#Left < AST#type_parameter#Left SceneModuleInfo AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements AST#generic_type#Left IDataSource AST#type_arguments#Left < AST#type_annot...
export class WaterFlowDataSource<SceneModuleInfo> implements IDataSource<SceneModuleInfo> { private dataArray: SceneModuleInfo[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: SceneModuleInfo[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i])...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/ArkTS1.2/TabsSample/entry/src/main/ets/model/functionalScenes/WaterFlowDataSource.ets#L21-L183
2fec274c8f338d3253e0031d78aa06922d92f6d4
gitee
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/strings/KMP.ets
arkts
contains
检查文本是否包含模式串 @param text 文本字符串 @param pattern 模式串 @returns 是否包含模式串
static contains(text: string, pattern: string): boolean { if (!text || !pattern || pattern.length === 0) { return false; } const lps = KMP.computeLPS(pattern); const m = pattern.length; const n = text.length; let i = 0; let j = 0; while (i < n) { if (pattern[j] === text[i])...
AST#method_declaration#Left static contains 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 pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type...
static contains(text: string, pattern: string): boolean { if (!text || !pattern || pattern.length === 0) { return false; } const lps = KMP.computeLPS(pattern); const m = pattern.length; const n = text.length; let i = 0; let j = 0; while (i < n) { if (pattern[j] === text[i])...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L153-L182
2ca6d4f7a7edab10921d8d2357d3bdc511714bb1
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFile.ets
arkts
CompressFileViewComponent
颜色渐变结束位置 功能描述:本示例主要介绍在worker子线程中使用@ohos.zlib模块提供的zlib.compressFile接口对沙箱目录中的文件进行压缩操作,压缩成功后将压缩包所在路径返回主线程,获取压缩文件列表。 推荐场景:文件管理中压缩文件时使用 核心组件: 1.CompressFileComponent: 向子线程发送信息,进行压缩 实现步骤: 1. 目录名称配置:指定压缩成功后压缩包路径 @example @State compressZipDir: string = 'bundlefile/compress_file.zip'; 2. 目录名称配置:指定待压缩文件在rawfile下和应用沙箱目录下(htt...
@Component export struct CompressFileViewComponent { @State beCompressFiles: Array<string> = []; // rawfile下所有待压缩文件 @State compressBundleName: string = ''; // 压缩成功后压缩包名字 @State compressZipDir: string = 'bundlefile/compress_file.zip'; // 压缩成功后压缩包文件路径 @State beCompressFileDir: string = 'compressfile'; // 待压缩文件所在目...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CompressFileViewComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right beCompressFiles : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left A...
@Component export struct CompressFileViewComponent { @State beCompressFiles: Array<string> = []; @State compressBundleName: string = ''; @State compressZipDir: string = 'bundlefile/compress_file.zip'; @State beCompressFileDir: string = 'compressfile'; private context: Context = getContext(this); aboutT...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/compressfile/src/main/ets/components/CompressFile.ets#L51-L147
784a8937f83d139806468937df0530b29276c012
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets
arkts
checkParam
检查输入参数合法性
checkParam() { logger.info('checkParam start'); if (!this.appInfoList.length) { this.appInfoList.push(new ListInfo($r("app.media.list_exchange_ic_public_cards_filled"), commonConstants.LIST_NAME)) } if (!this.deductionView) { this.deductionView = this.deductionView; } if (!this.listE...
AST#method_declaration#Left checkParam 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 logger AST#expression#Right . info AST#member_express...
checkParam() { logger.info('checkParam start'); if (!this.appInfoList.length) { this.appInfoList.push(new ListInfo($r("app.media.list_exchange_ic_public_cards_filled"), commonConstants.LIST_NAME)) } if (!this.deductionView) { this.deductionView = this.deductionView; } if (!this.listE...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/listexchange/src/main/ets/utils/ListExchange.ets#L155-L167
68c36c57373f053491ab939eff20d5aed5df9a81
gitee
luhenchang/ArkTS_Unit.git
40743ac7d273f5a8e40feab2b6ccd95823fc4ddf
entry/src/main/ets/component/pullrefresh/NoMoreLayout.ets
arkts
NoMoreLayout
没有更多数据组件.
@Component export struct NoMoreLayout { build() { Row() { Text('没有更多数据了') .margin({ left: Const.NoMoreLayoutConstant_NORMAL_PADDING }) .fontSize(Const.NoMoreLayoutConstant_TITLE_FONT) .textAlign(TextAlign.Center) } .width(Const.FULL_WIDTH) .justifyContent(FlexAlign.Center...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NoMoreLayout AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left {...
@Component export struct NoMoreLayout { build() { Row() { Text('没有更多数据了') .margin({ left: Const.NoMoreLayoutConstant_NORMAL_PADDING }) .fontSize(Const.NoMoreLayoutConstant_TITLE_FONT) .textAlign(TextAlign.Center) } .width(Const.FULL_WIDTH) .justifyContent(FlexAlign.Center...
https://github.com/luhenchang/ArkTS_Unit.git/blob/40743ac7d273f5a8e40feab2b6ccd95823fc4ddf/entry/src/main/ets/component/pullrefresh/NoMoreLayout.ets#L6-L19
6a4f3886326355b27ac6284b4583e49a05cb7566
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
getPx
Obtains the screen horizontal adaptation px. @return number
static getPx(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return DimensionUtil.adaptDimension(beforeVp); }
AST#method_declaration#Left static getPx AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R...
static getPx(value: Resource): number { let beforeVp = context.resourceManager.getNumber(value.id); return DimensionUtil.adaptDimension(beforeVp); }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/CommonEventAndNotification/AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets#L53-L56
f9aa65d8c9adf557fba16d252250834e4c52b232
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/demo/src/main/ets/view/DatabasePage.ets
arkts
InputSection
输入区域 @returns {void} 无返回值
@Builder private InputSection(): void { ColumnBase({ widthValue: P100 }) { IBestCellGroup({ inset: true, outerMargin: 0 }) { IBestField({ value: this.vm.titleInput, label: $r("app.string.demo_database_title_label"), placeholder: $r("app.string.demo_database_title_placeh...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private InputSection 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#arkts_ui_element#Left AST#ui_...
@Builder private InputSection(): void { ColumnBase({ widthValue: P100 }) { IBestCellGroup({ inset: true, outerMargin: 0 }) { IBestField({ value: this.vm.titleInput, label: $r("app.string.demo_database_title_label"), placeholder: $r("app.string.demo_database_title_placeh...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/DatabasePage.ets#L71-L110
26f48c67793810edd37649ce850cac3a6b4ab089
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/user/src/main/ets/view/ProfilePage.ets
arkts
ProfileBaseInfoCard
基础信息卡片 @returns {void} 无返回值
@Builder private ProfileBaseInfoCard(): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: $r("app.string.avatar"), label: $r("app.string.avatar_label"), hasBorder: tr...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ProfileBaseInfoCard 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#arkts_ui_element#Left ...
@Builder private ProfileBaseInfoCard(): void { Card() { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ title: $r("app.string.avatar"), label: $r("app.string.avatar_label"), hasBorder: tr...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/ProfilePage.ets#L97-L123
5f93e5ac03767504f392333a58e1196fa5a032ec
github
Lateautumn00/HarmonyOS_WeChat.git
88993b308d5018c11d4e6ddf7838a96c6384201c
entry/src/main/ets/pages/Wx.ets
arkts
getList
列表的每一列
@Builder getList(item:WxList){ Row(){ Row({space:10}){ Image(item.image).width(50).height(50).borderRadius(50) Column(){ Text(item.name).fontSize(18).fontWeight(FontWeight.Bold) Text(item.desc).fontSize(16) }.alignItems(HorizontalAlign.Start) } Column(){...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getList AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left WxList AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { ...
@Builder getList(item:WxList){ Row(){ Row({space:10}){ Image(item.image).width(50).height(50).borderRadius(50) Column(){ Text(item.name).fontSize(18).fontWeight(FontWeight.Bold) Text(item.desc).fontSize(16) }.alignItems(HorizontalAlign.Start) } Column(){...
https://github.com/Lateautumn00/HarmonyOS_WeChat.git/blob/88993b308d5018c11d4e6ddf7838a96c6384201c/entry/src/main/ets/pages/Wx.ets#L221-L235
f0e08ed7334f3d530d75b5cda67fd08152aabc53
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/BindServiceIp.ets
arkts
BindServiceIp
Copyright (c) 2022-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,...
@Component export default struct BindServiceIp { @Link ipAddress: string private onBind: () => void build() { Column() { Text($r('app.string.welcome')) .fontSize(25) .margin({ top: 20 }) .fontWeight(FontWeight.Bold) TextInput({ placeholder: $r('app.string.ip_placeholder') ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct BindServiceIp AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right ipAddress : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#...
@Component export default struct BindServiceIp { @Link ipAddress: string private onBind: () => void build() { Column() { Text($r('app.string.welcome')) .fontSize(25) .margin({ top: 20 }) .fontWeight(FontWeight.Bold) TextInput({ placeholder: $r('app.string.ip_placeholder') ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Connectivity/WebSocket/entry/src/main/ets/common/BindServiceIp.ets#L16-L53
d50bddb19ba804be01e23c3a79b0c32a84374b09
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets
arkts
NavDestinationTitle
[End get_route_info_and_link_address]
@Builder NavDestinationTitle() { Column() { Text($r('app.string.query_Network_connection_information')) .fontSize(20) .lineHeight(40) .fontWeight(700) .width('100%') .padding({ left: 12 }) } .width('100%') }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right NavDestinationTitle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_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...
@Builder NavDestinationTitle() { Column() { Text($r('app.string.query_Network_connection_information')) .fontSize(20) .lineHeight(40) .fontWeight(700) .width('100%') .padding({ left: 12 }) } .width('100%') }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NetworkManagement/entry/src/main/ets/pages/GetNetworkConnectionInfo.ets#L107-L118
df405193400d5050f0d494fc1488e43abbe8cff6
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/animation/ChartAnimator.ets
arkts
getPhaseX
Gets the X axis phase of the animation. @return float value of {@link #mPhaseX}
public getPhaseX(): number { return this.mPhaseX; }
AST#method_declaration#Left public getPhaseX 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_express...
public getPhaseX(): number { return this.mPhaseX; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/animation/ChartAnimator.ets#L244-L246
c049db9e77ac328ef572265cbd6a5dbd4f34c33d
gitee
LiuAnclouds/Harmony-ArkTS-App.git
2119ce333927599b81a31081bc913e1416837308
WeatherMind/entry/src/main/ets/pages/ChooseCity.ets
arkts
setCurrentCity
设置当前城市
private async setCurrentCity(cityName: string) { try { let httpRequest = http.createHttp(); await httpRequest.request(Config.API.SET_CURRENT_CITY, { method: http.RequestMethod.POST, extraData: JSON.stringify({ city_name: cityName }), header: { "Content...
AST#method_declaration#Left private async setCurrentCity AST#parameter_list#Left ( AST#parameter#Left cityName : 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#try_sta...
private async setCurrentCity(cityName: string) { try { let httpRequest = http.createHttp(); await httpRequest.request(Config.API.SET_CURRENT_CITY, { method: http.RequestMethod.POST, extraData: JSON.stringify({ city_name: cityName }), header: { "Content...
https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L263-L278
d82b508242671b44fc36de64a87a58a33a4e284c
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieData.ets
arkts
getYValueSum
Returns the sum of all values in this PieData object. @return
public getYValueSum(): number { let sum: number = 0; for (let i: number = 0; i < this.getDataSet().getEntryCount(); i++) sum += this.getDataSet().getEntryForIndex(i).getY(); return sum; }
AST#method_declaration#Left public getYValueSum 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#variable_declaration#Left let AST#variable_declarator#Left sum :...
public getYValueSum(): number { let sum: number = 0; for (let i: number = 0; i < this.getDataSet().getEntryCount(); i++) sum += this.getDataSet().getEntryForIndex(i).getY(); return sum; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieData.ets#L109-L118
783e7111f516dcaafe9fc500c8044666010104a2
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
regDisplayListener
注册屏幕状态监听 @returns {void}
regDisplayListener(): void { if (display.isFoldable()) { // 监听折叠屏状态变更,更新折叠态,修改窗口显示方向 display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => { // 无视FOLD_STATUS_UNKNOWN状态 if (curFoldStatus === display.FoldStatus.FOLD_STATUS_UNKNOWN) { return; } ...
AST#method_declaration#Left regDisplayListener 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#call_...
regDisplayListener(): void { if (display.isFoldable()) { display.on('foldStatusChange', async (curFoldStatus: display.FoldStatus) => { if (curFoldStatus === display.FoldStatus.FOLD_STATUS_UNKNOWN) { return; } if (curFoldStatus === display.FoldStatus.F...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L183-L217
4400c161354553fb7b8b8e1eee0bd2cdb7052bee
gitee
vhall/VHLive_SDK_Harmony
29c820e5301e17ae01bc6bdcc393a4437b518e7c
watchKit/src/main/ets/util/ChatTools.ets
arkts
getTimeHH24Human
获取仅包含“时间:分钟”部分的字符串,24小时制,且可以显示“上午”、“下午”、“晚上”这样的描述。 @param srcDateObj 原始日期对象 @param timeWithSegmentStr 表示在时间字符串前带上“上午”、“下午”、“晚上”这样的描述 @return 如果成功则返回结果,否则返回空字符串""(不是null)
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string { let ret: string = ''; try { let timePattern: string = 'hh:mm'; // 原始的时间分钟字符串 let timeStr: string = ChatTools.formatDate(srcDateObj, timePattern); // 时间段描述(形如:“上午”、“下午”、“晚上”这样的描述),只在中文语言下生效 let timeSeg...
AST#method_declaration#Left static getTimeHH24Human AST#parameter_list#Left ( AST#parameter#Left srcDateObj : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left timeWithSegmentStr : AST#type_annotation#Left AST#primary_type#Left ...
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string { let ret: string = ''; try { let timePattern: string = 'hh:mm'; let timeStr: string = ChatTools.formatDate(srcDateObj, timePattern); let timeSegmentStr: string = ''; if(timeWithSegmentStr) ...
https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/ChatTools.ets#L254-L273
ba1ba95b0ddbdaee22ba068813786a474346819a
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/common/DatabaseManager.ets
arkts
WrongQuestion
导出接口
export { WrongQuestion }
AST#export_declaration#Left export { WrongQuestion } AST#export_declaration#Right
export { WrongQuestion }
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/common/DatabaseManager.ets#L2315-L2315
c0b0038a147eabaf0b957da792548801c12a0fdc
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/utils/storage_tools.ets
arkts
Read an ArrayBuffer file from sandbox storage in an asynchronous way. @returns An ArrayBuffer, of the requested file's content or undefined if the file doesn't exist.
export function sandbox_read_arrayBuffer(file_path_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; file_path_name = filesDir + "/" + file_path_name if (!(fs.accessSync(file_path_name))) { // file doesn't exist return undefined; } return fs....
AST#export_declaration#Left export AST#function_declaration#Left function sandbox_read_arrayBuffer AST#parameter_list#Left ( AST#parameter#Left file_path_name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context_filesDi...
export function sandbox_read_arrayBuffer(file_path_name: string, context_filesDir?: string) { let filesDir: string = context_filesDir || meowContext().filesDir; file_path_name = filesDir + "/" + file_path_name if (!(fs.accessSync(file_path_name))) { return undefined; } return fs.open(file_path_name, ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L498-L517
7932494e945e45cccc7563ad1a153a1a1b80bdbf
gitee
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
NEXT/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets
arkts
聊天配置类:单例模式
export class ChatConfig { private static _instance: ChatConfig | null = null; /** * 获取对象函数 * @returns */ public static getInstance() { if (!ChatConfig._instance) { ChatConfig._instance = new ChatConfig(); } return ChatConfig._instance } }
AST#export_declaration#Left export AST#class_declaration#Left class ChatConfig AST#class_body#Left { AST#property_declaration#Left private static _instance : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ChatConfig AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union...
export class ChatConfig { private static _instance: ChatConfig | null = null; public static getInstance() { if (!ChatConfig._instance) { ChatConfig._instance = new ChatConfig(); } return ChatConfig._instance } }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/ChatConfig.ets#L20-L33
415f73d73fa2057bf4a0d9c86cde0a19b9b676f6
gitee
wasd09090030/MyHongmengProject.git
a8ed386b658ceeac69ef5bc42a92d78c7980821c
entry/src/main/ets/components/ReviewPage.ets
arkts
HistoryView
历史视图
@Builder HistoryView() { Column() { // 历史记录列表 if (this.completedTasksList.length === 0) { Column({ space: 16 }) { SymbolGlyph($r('sys.symbol.calendar_badge_clock')) .fontSize(80) .fontColor(['#CCCCCC']) Text('暂无完成记录') .fontSize(18) ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right HistoryView AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 历史记录列表 AST#ui_...
@Builder HistoryView() { Column() { if (this.completedTasksList.length === 0) { Column({ space: 16 }) { SymbolGlyph($r('sys.symbol.calendar_badge_clock')) .fontSize(80) .fontColor(['#CCCCCC']) Text('暂无完成记录') .fontSize(18) .f...
https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/ReviewPage.ets#L446-L510
9dede6ecd6336114c18e72dced0c6678df58b6b3
github
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
common/component/src/main/ets/default/sliderComponent.ets
arkts
onChangeHandler
Change handler @param value - Change value @param mode - State
onChangeHandler(value: number, mode: SliderChangeMode) { if (this.onChange) { this.onChange(value, mode); } }
AST#method_declaration#Left onChangeHandler AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left SliderChangeMode AST#prim...
onChangeHandler(value: number, mode: SliderChangeMode) { if (this.onChange) { this.onChange(value, mode); } }
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/sliderComponent.ets#L104-L108
f5f7d28b39e727ac4593c38fcc66ce4dad2d7f07
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
getTotalCount
获取全部试题数量 @returns
public getTotalCount(): number { return this.examDetails.length; }
AST#method_declaration#Left public getTotalCount 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_exp...
public getTotalCount(): number { return this.examDetails.length; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L172-L174
42245ec275fe6d52081d51ba00a68ec8cef24563
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
createTable
创建表 @param tableName 表名 @param columnTypeMap 字段名与其类型
async createTable(tableName: string, columnTypeMap: string[][]): Promise<void> { if (store === undefined) { return; } let fieldStatements: string = Constants.EMPTY_STRING; columnTypeMap.forEach(columnType => { fieldStatements += Constants.COMMA + columnType[0] + Constants.SPACE + columnType[...
AST#method_declaration#Left async createTable AST#parameter_list#Left ( AST#parameter#Left tableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left columnTypeMap : AST#type_annotation#Left AST#primary_type#Left AST#array_...
async createTable(tableName: string, columnTypeMap: string[][]): Promise<void> { if (store === undefined) { return; } let fieldStatements: string = Constants.EMPTY_STRING; columnTypeMap.forEach(columnType => { fieldStatements += Constants.COMMA + columnType[0] + Constants.SPACE + columnType[...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L74-L88
b42086e6773b42c9232eb47a358ad3253ddc3b90
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets
arkts
makeNode
必须要重写的方法,用于构建节点数、返回节点挂载在对应NodeContainer中 在对应NodeContainer创建的时候调用、或者通过rebuild方法调用刷新
makeNode(uiContext: UIContext): FrameNode | null { console.log(' uicontext is undefined : '+ (uiContext === undefined)); if (this.rootnode != null) { // 返回FrameNode节点 return this.rootnode.getFrameNode(); } // 返回null控制动态组件脱离绑定节点 return null; }
AST#method_declaration#Left makeNode 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#union_type#Left AST#primary_type#Left Fram...
makeNode(uiContext: UIContext): FrameNode | null { console.log(' uicontext is undefined : '+ (uiContext === undefined)); if (this.rootnode != null) { return this.rootnode.getFrameNode(); } return null; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkWeb/UseOfflineWebComp/entry/src/main/ets/pages/common.ets#L46-L54
2520f76f7dd31a89777fa9cf2008b0018db18e13
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/commoncomponents/ViewCodeText.ets
arkts
ViewCodeText
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 ViewCodeText { @StorageLink('sideBarShow') sideBarShow: boolean = false; private webSrc: Resource = $rawfile('BaseTypeCode.ets.html'); build() { Column(){ Text($r('app.string.source_code')) .fontColor($r('app.color.source_code_font_color')) .fontSize($r('app.fl...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ViewCodeText AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ StorageLink ( AST#expression#Left 'sideBarShow' AST#expression#Right ) AST#decorator#Right sideBarShow : AST#type_annotation#Le...
@Component export struct ViewCodeText { @StorageLink('sideBarShow') sideBarShow: boolean = false; private webSrc: Resource = $rawfile('BaseTypeCode.ets.html'); build() { Column(){ Text($r('app.string.source_code')) .fontColor($r('app.color.source_code_font_color')) .fontSize($r('app.fl...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/StateManagement/entry/src/main/ets/commoncomponents/ViewCodeText.ets#L16-L37
ac88a34696fd07ced0c9b5dc701262f9e732ba73
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
getNavPathStack
通过名称获取router
private static getNavPathStack(): NavPathStack { return DynamicsRouter.navPathStack; }
AST#method_declaration#Left private static getNavPathStack 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#expression#Lef...
private static getNavPathStack(): NavPathStack { return DynamicsRouter.navPathStack; }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/router/DynamicsRouter.ets#L76-L78
b24bab67648639cd4dda28d78b15fd3f08891737
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
updateCurrentPage
更新当前页面索引 @param {number} index - 目标页面索引 @returns {void} 无返回值
updateCurrentPage(index: number): void { this.currentPageIndex = index; }
AST#method_declaration#Left updateCurrentPage 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 void AST#primary_type#...
updateCurrentPage(index: number): void { this.currentPageIndex = index; }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L30-L32
04a08438a21e1e616f0ddac380bba34c240a4b7f
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
updateTaskStatus
Update task status @param taskId - ID of task to update @param isDone - New done status
async updateTaskStatus(taskId: number, isDone: boolean): Promise<void> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const valueBucket: relationalStore.ValuesBucket = { is_done: isDone ? 1 : 0 }; const predicates = new relationalStore.RdbPredicates(Constants.TA...
AST#method_declaration#Left async updateTaskStatus AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isDone : AST#type_annotation#Left AST#primary_type#Left boolean AST#pri...
async updateTaskStatus(taskId: number, isDone: boolean): Promise<void> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const valueBucket: relationalStore.ValuesBucket = { is_done: isDone ? 1 : 0 }; const predicates = new relationalStore.RdbPredicates(Constants.TA...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L274-L294
5cc9e87cf0c897509806a832f6d039f7339bc09b
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets
arkts
reminderTime
日程提醒时间菜单
@Builder reminderTimeMenu() { Column() { ForEach(Constants.REMINDER_TIME_OPTION, (item: string, index: number) => { Column() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { ...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right AST#ERROR#Left reminderTimeMenu AST#parameter_list#Left ( ) AST#parameter_list#Right { Column ( ) { ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Left Constants AST#expression#Right . REMINDER_TIME_OPTION AST#member_e...
@Builder reminderTimeMenu() { Column() { ForEach(Constants.REMINDER_TIME_OPTION, (item: string, index: number) => { Column() { Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/customcalendar/components/SchedulePoint.ets#L159-L242
e02fecf2b0cfe2c4728de13aefb48659f3976bfd
gitee
AlatusLee/HarmonyOS-Next-Weather-Assistant.git
d3c7060a8ff7f7656175e83fa32536b11e136556
alatus/src/main/ets/view/cityView.ets
arkts
展示数据
build() { Column(){ // 当天天气数据 ForEach(this.casts,(cast:cast)=>{ if(this.casts[0] === cast){ // 图片渲染 this.weatherImage(cast.dayweather,260,200) Column(){ // 日期,气温,天气 Text(`${cast.dayweather} ${cast.daytemp}° 至 ${cast.nighttemp}°`).fontSize(30)...
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#ui_control_flow#Left AST#for_each_statement#Left ForEach ( AST#expression#Left AST#member_expression#Left AST#expression#Lef...
build() { Column(){ ForEach(this.casts,(cast:cast)=>{ if(this.casts[0] === cast){ this.weatherImage(cast.dayweather,260,200) Column(){ Text(`${cast.dayweather} ${cast.daytemp}° 至 ${cast.nighttemp}°`).fontSize(30) .fontColor(C...
https://github.com/AlatusLee/HarmonyOS-Next-Weather-Assistant.git/blob/d3c7060a8ff7f7656175e83fa32536b11e136556/alatus/src/main/ets/view/cityView.ets#L26-L65
82cd20325042aa09e41ed6ebd2ba0e02df441aa3
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets
arkts
键盘按键类型枚举
export enum EKeyType { INPUT, // 输入类型,输入具体的值 DELETE, // 删除一个输入字符 NUMERIC, // 切换数字键盘 CAPSLOCK, // 切换大小写键盘 SPECIAL, // 切换特殊字符键盘 }
AST#export_declaration#Left export AST#enum_declaration#Left enum EKeyType AST#enum_body#Left { AST#enum_member#Left INPUT AST#enum_member#Right , // 输入类型,输入具体的值 AST#enum_member#Left DELETE AST#enum_member#Right , // 删除一个输入字符 AST#enum_member#Left NUMERIC AST#enum_member#Right , // 切换数字键盘 AST#enum_member#Left CAPSLOCK A...
export enum EKeyType { INPUT, DELETE, NUMERIC, CAPSLOCK, SPECIAL, }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customkeyboardtoh5/src/main/ets/model/Constants.ets#L29-L35
9482fb82bce574adc558c784d58b2dce06dcf086
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets
arkts
getMockExamManager
获取模拟考试考卷,每次获得一个新对象 @param name @returns
getMockExamManager(name: string | Resource) { let examManager = new ExamManager(name, this.generateExamDetail()); examManager.timeLimit = 1; return examManager; }
AST#method_declaration#Left getMockExamManager AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right )...
getMockExamManager(name: string | Resource) { let examManager = new ExamManager(name, this.generateExamDetail()); examManager.timeLimit = 1; return examManager; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L111-L115
3125795ad22cca1fb78c88dae266e6519e10db4f
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Index.ets
arkts
startAccountAbilityForResult
TODO 启动AccountAbility
async startAccountAbilityForResult() { if (this.isLogin == false) { //尚未登录 let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; // UIAbilityContext let want: Want = { deviceId: '', // deviceId为空表示本设备 bundleName: 'com.example.star...
AST#method_declaration#Left async startAccountAbilityForResult 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 this AST#expressi...
async startAccountAbilityForResult() { if (this.isLogin == false) { let context: common.UIAbilityContext = this.getUIContext().getHostContext() as common.UIAbilityContext; let want: Want = { deviceId: '', bundleName: 'com.example.startabilityforresult', moduleName: 'en...
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/demoCollect/startAbility/experiment/AbilityKit/StartAbilityForResult/entry/src/main/ets/pages/Index.ets#L130-L154
5b7ba8015c1fa152b1762b9923fdfca053519b7f
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/RSA.ets
arkts
signSegmentSync
对数据进行分段签名,同步 @param data 待签名数据 @param priKey 私钥 @param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、、等)。 @param len 自定义的数据拆分长度,此处取64 @returns
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256', len: number = 64): cryptoFramework.DataBlob { return CryptoUtil.signSegmentSync(data, priKey, algName, len); }
AST#method_declaration#Left static signSegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left AST#qualified...
static signSegmentSync(data: Uint8Array, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256', len: number = 64): cryptoFramework.DataBlob { return CryptoUtil.signSegmentSync(data, priKey, algName, len); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L299-L301
8145f956b00d5516ed7421358ed764cde6a4e1dd
gitee
sithvothykiv/dialog_hub.git
b676c102ef2d05f8994d170abe48dcc40cd39005
custom_dialog/src/main/ets/core/proxy/ImageDialogBuilderProxy.ets
arkts
isClearCacheAfterShow
是否在关闭弹窗后清理缓存图片 @param isClearCacheAfterShow 默认false @returns
isClearCacheAfterShow(isClearCacheAfterShow: boolean) { this.builderOptions.isClearCacheAfterShow = isClearCacheAfterShow return this }
AST#method_declaration#Left isClearCacheAfterShow AST#parameter_list#Left ( AST#parameter#Left isClearCacheAfterShow : 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#block_statement#Left { AST#statement#Left AST#...
isClearCacheAfterShow(isClearCacheAfterShow: boolean) { this.builderOptions.isClearCacheAfterShow = isClearCacheAfterShow return this }
https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/proxy/ImageDialogBuilderProxy.ets#L56-L59
3e13ab7f53b2536f8562ff48f815e36eb5363573
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets
arkts
deleteEmitter
取消事件订阅
deleteEmitter() { emitter.off(1); }
AST#method_declaration#Left deleteEmitter 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 emitter AST#expression#Right . off AST#member_expr...
deleteEmitter() { emitter.off(1); }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageflip/src/main/ets/components/mainpage/PageFlip.ets#L119-L121
6b693bb72a77d16974935909599c15b9fb93933b
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
disconnectInner
断开与蓝牙设备的连接
private disconnectInner(gattClientDevice: ble.GattClientDevice) { Log.showInfo(TAG, `disconnectInner`); try { if (!gattClientDevice) { Log.showWarn(TAG, `disconnectInner: mGattClientDevice is null`); return; } this.offBLEConnectionStateChange(); this.offBLECharacteristic...
AST#method_declaration#Left private disconnectInner AST#parameter_list#Left ( AST#parameter#Left gattClientDevice : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ble . GattClientDevice AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_...
private disconnectInner(gattClientDevice: ble.GattClientDevice) { Log.showInfo(TAG, `disconnectInner`); try { if (!gattClientDevice) { Log.showWarn(TAG, `disconnectInner: mGattClientDevice is null`); return; } this.offBLEConnectionStateChange(); this.offBLECharacteristic...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets#L417-L440
d8e664197e65999e62bf693bc07ba9845801656b
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getYRange
Returns the range of y-values this chart can display. @return
public getYRange(): number { return this.mYAxis.mAxisRange; }
AST#method_declaration#Left public getYRange 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_express...
public getYRange(): number { return this.mYAxis.mAxisRange; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/RadarChartModel.ets#L374-L376
c25775c9479310a6a3d46184e584988a9dc25cb7
gitee
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets
arkts
pixelsToValue
Transforms the given array of touch positions (pixels) (x, y, x, y, ...) into values on the chart. @param pixels
public pixelsToValue(pixels: number[]) { var tmp: Matrix = this.mPixelToValueMatrixBuffer; tmp.reset(); // invert all matrixes to convert back to the original value this.mMatrixOffset.invert(tmp); tmp.mapPoints(pixels); this.mViewPortHandler.getMatrixTouch().invert(tmp); tmp.mapPoints(pixe...
AST#method_declaration#Left public pixelsToValue AST#parameter_list#Left ( AST#parameter#Left pixels : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Le...
public pixelsToValue(pixels: number[]) { var tmp: Matrix = this.mPixelToValueMatrixBuffer; tmp.reset(); this.mMatrixOffset.invert(tmp); tmp.mapPoints(pixels); this.mViewPortHandler.getMatrixTouch().invert(tmp); tmp.mapPoints(pixels); this.mMatrixValueToPx.invert(tmp); tmp.mapPoin...
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/Transformer.ets#L346-L359
be518e59bc79a8dae5699bfd95d97c4a37030a2c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets
arkts
getHardwareIcon
获取硬件对应图标
getHardwareIcon(type: batteryStats.ConsumptionType) { if (this.hardwareIcons.size === 0) { this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_INVALID, $r("app.media.ic_battery_invalid")); this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH, $r("app.media.ic_b...
AST#method_declaration#Left getHardwareIcon AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left batteryStats . ConsumptionType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right A...
getHardwareIcon(type: batteryStats.ConsumptionType) { if (this.hardwareIcons.size === 0) { this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_INVALID, $r("app.media.ic_battery_invalid")); this.hardwareIcons.set(batteryStats.ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH, $r("app.media.ic_b...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/BatteryStatsUtil.ets#L244-L256
a61e580b486a9111eb81ccea1b6d1fe0b11297cf
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/interface_class/simple_class/simple_class_004_F.ets
arkts
Introduction 简单类字段
export function simple_class_004_F(taint_src : string) : void { let _t = taint_src; let _clean = new A("clean"); taint.Sink(_clean.data); }
AST#export_declaration#Left export AST#function_declaration#Left function simple_class_004_F AST#parameter_list#Left ( AST#parameter#Left taint_src : 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_annotatio...
export function simple_class_004_F(taint_src : string) : void { let _t = taint_src; let _clean = new A("clean"); taint.Sink(_clean.data); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/interface_class/simple_class/simple_class_004_F.ets#L5-L9
4e7cc4cec03a1231230ea185fe6cda0118f7262e
github
jxdiaodeyi/YX_Sports.git
af5346bd3d5003c33c306ff77b4b5e9184219893
YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets
arkts
decryptGCMSegment
解密(GCM模式)分段,异步 @param data 加密或者解密的数据。data不能为null。 @param symKey 指定加密或解密的密钥。 @param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。 @param len 自定义的数据拆分长度。 @returns
static async decryptGCMSegment(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); await decoder.init(cryptoFramework.CryptoMode....
AST#method_declaration#Left static async decryptGCMSegment AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#paramet...
static async decryptGCMSegment(dataBlob: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey, gcmParams: cryptoFramework.GcmParamsSpec, len: number = 128): Promise<cryptoFramework.DataBlob> { let decoder = cryptoFramework.createCipher('SM4_128|GCM|PKCS7'); await decoder.init(cryptoFramework.CryptoMode....
https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/SM4.ets#L308-L326
0a4f7ed73bae6fc725c751e6f3baf5db71b165aa
github
IceYuanyyy/OxHornCampus.git
bb5686f77fa36db89687502e35898cda218d601f
entry/src/main/ets/controller/MapController.ets
arkts
tapAction
Double-click the map.
tapAction(callBack: Function): void { let isMaxTime: boolean = false; if (++this.pinchCount > Const.ZOOM_MAX_TIMES) { this.pinchCount = Const.ZOOM_MAX_TIMES; isMaxTime = true; } this.leftTop = callBack(isMaxTime); }
AST#method_declaration#Left tapAction AST#parameter_list#Left ( AST#parameter#Left callBack : AST#type_annotation#Left AST#primary_type#Left Function 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_type#Rig...
tapAction(callBack: Function): void { let isMaxTime: boolean = false; if (++this.pinchCount > Const.ZOOM_MAX_TIMES) { this.pinchCount = Const.ZOOM_MAX_TIMES; isMaxTime = true; } this.leftTop = callBack(isMaxTime); }
https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/controller/MapController.ets#L84-L91
84815b0ded2351cb3370eb714d52f44630bca8e0
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoUtil.ets
arkts
getPemKeyPair
获取指定数据生成非对称密钥。 @param algName @param pubKey 指定的公钥材料。如果公钥不需要转换,可直接传入null。 @param priKey 指定的私钥材料。如果私钥不需要转换,可直接传入null。注:公钥和私钥材料不能同时为null。 @returns
static async getPemKeyPair(algName: string, pubKey: string, priKey: string): Promise<cryptoFramework.KeyPair> { let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); let keyPair = await asyKeyGenerator.convertPemKey(pubKey, priKey); // let pubStr = keyPair.pubKey.getEncodedPem('X509'); ...
AST#method_declaration#Left static async getPemKeyPair AST#parameter_list#Left ( AST#parameter#Left algName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST...
static async getPemKeyPair(algName: string, pubKey: string, priKey: string): Promise<cryptoFramework.KeyPair> { let asyKeyGenerator = cryptoFramework.createAsyKeyGenerator(algName); let keyPair = await asyKeyGenerator.convertPemKey(pubKey, priKey); return keyPair; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L217-L223
c4176f26667e74e4fa75b4c4308d7b5399eda473
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/clickanimation/Index.ets
arkts
ClickAnimationComponent
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...
export { ClickAnimationComponent } from './src/main/ets/components/ClickAnimationComponent';
AST#export_declaration#Left export { ClickAnimationComponent } from './src/main/ets/components/ClickAnimationComponent' ; AST#export_declaration#Right
export { ClickAnimationComponent } from './src/main/ets/components/ClickAnimationComponent';
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/clickanimation/Index.ets#L16-L16
c0f2fabf9afabe7d1b4885702d8f3d50b6770bf3
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
registerDataChangeListener
Register a controller that changes data. @param {DataChangeListener} listener Data change listener
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
AST#method_declaration#Left registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener); } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets#L63-L67
ad9f40e14e87930208e624672f10527b4739a254
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/utils/Utils.ets
arkts
getNormalizedAngle
returns an angle between 0.f < 360.f (not less than zero, less than 360)
public static getNormalizedAngle(angle: number): number { while (angle < 0) angle += 360; return angle % 360; }
AST#method_declaration#Left public static getNormalizedAngle 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 number ...
public static getNormalizedAngle(angle: number): number { while (angle < 0) angle += 360; return angle % 360; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L243-L248
6a93837f63864596a27c0053999088e1131304d7
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets
arkts
CommentDataSource
评论数据源
@Observed export class CommentDataSource extends BasicDataSource { private commentArray: Comment[] = []; public totalCount(): number { return this.commentArray.length; } /** * 获取指定索引数据 * @param index * @returns */ public getData(index: number): Comment { return this.commentArray[index]; ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class CommentDataSource extends AST#type_annotation#Left AST#primary_type#Left BasicDataSource AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#property_declaration#Left private commentArray : AST#ty...
@Observed export class CommentDataSource extends BasicDataSource { private commentArray: Comment[] = []; public totalCount(): number { return this.commentArray.length; } public getData(index: number): Comment { return this.commentArray[index]; } public addData(index: number, data: Comment):...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L103-L138
b6c4ca06d1c33c65fb89e44e63d38ad3fe96045d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/servercfg/AppCfgManager.ets
arkts
应用配置枚举 - 所有配置项定义
export enum AppCfg { // 通用配置 Dictation_Detect_Merged_Api_GeneralOrHandwriting = "Dictation_Detect_Merged_Api_GeneralOrHandwriting", // [通用] 听写合并检测Api使用通用还是手写 InAppBooks_Show_In_SaveToBooks = "InAppBooks_Show_In_SaveToBooks", // [通用] 内置课本 在SaveToBooks(CopyTo,ImportCsv)时是否显示 ...
AST#export_declaration#Left export AST#enum_declaration#Left enum AppCfg AST#enum_body#Left { // 通用配置 AST#enum_member#Left Dictation_Detect_Merged_Api_GeneralOrHandwriting = AST#expression#Left "Dictation_Detect_Merged_Api_GeneralOrHandwriting" AST#expression#Right AST#enum_member#Right , // [通用] 听写合并检测Api使用通用还是手写 AST#...
export enum AppCfg { Dictation_Detect_Merged_Api_GeneralOrHandwriting = "Dictation_Detect_Merged_Api_GeneralOrHandwriting", InAppBooks_Show_In_SaveToBooks = "InAppBooks_Show_In_SaveToBooks", InAppBooks_Can_ShareOnline = "InAppBooks_Can_ShareOnline"...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/servercfg/AppCfgManager.ets#L20-L67
2254f2c683d41ee54982e620c11cc28913925186
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/model/src/main/ets/network/NetworkResponse.ets
arkts
@file 网络通用响应模型 @author Joker.X
export class NetworkResponse<T> { /** * 真实数据 */ data: T | null; /** * 状态码,等于1000表示成功 */ code: number; /** * 错误提示信息 */ message: string | null; /** * 构造函数,对接口返回做空值兜底 * @param {Partial<NetworkResponse<T>>} payload - 接口原始数据 */ constructor(payload?: Partial<NetworkResponse<T>>) { ...
AST#export_declaration#Left export AST#class_declaration#Left class NetworkResponse AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { /** * 真实数据 */ AST#property_declaration#Left data : AST#type_annotation#Left AST#union_type#Left AST#pr...
export class NetworkResponse<T> { data: T | null; code: number; message: string | null; constructor(payload?: Partial<NetworkResponse<T>>) { this.data = payload?.data ?? null; this.code = payload?.code !== undefined ? Number(payload.code) : 1000; this.message = payload?.message ?? null;...
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/network/NetworkResponse.ets#L5-L37
64c9c1e723f5965acf600cf17594995343ba885e
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_005_T.ets
arkts
Introduction 库函数-string_valueOf
export function string_lib_func_005_T(taint_src : string) { let t = taint_src.valueOf(); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_005_T AST#parameter_list#Left ( AST#parameter#Left taint_src : 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_stateme...
export function string_lib_func_005_T(taint_src : string) { let t = taint_src.valueOf(); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_005_T.ets#L7-L10
9d435a440765c287638c6d87367010c1c08b60a9
github
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/pages/user/settings.ets
arkts
saveHoldCheckEnabled
保存智感握持设置
private async saveHoldCheckEnabled(enabled: boolean) { try { await setHoldCheckEnabled(enabled); this.holdCheckON = enabled; } catch (error) { console.error("保存智感握持设置失败:", error); } }
AST#method_declaration#Left private async saveHoldCheckEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : 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#block_statement#Left { AST#statement#Left AST#t...
private async saveHoldCheckEnabled(enabled: boolean) { try { await setHoldCheckEnabled(enabled); this.holdCheckON = enabled; } catch (error) { console.error("保存智感握持设置失败:", error); } }
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/pages/user/settings.ets#L158-L165
564b69a95efc2c57da1f37a27faf64fa64b5490a
github
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
getTransactions
按照指定条件获取交易报表
public async getTransactions( conditions: UserTablePredicateParams[], ): Promise<TransactionReportRsp> { try { return this.transaction<TransactionReportRsp>(async () => { const orderBy: TableOrderByParams = { field: TransactionTableFields.TRANSACTION_ID, desc: true, }...
AST#method_declaration#Left public async getTransactions AST#parameter_list#Left ( AST#parameter#Left conditions : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left UserTablePredicateParams [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right AST#ERROR#Left , AS...
public async getTransactions( conditions: UserTablePredicateParams[], ): Promise<TransactionReportRsp> { try { return this.transaction<TransactionReportRsp>(async () => { const orderBy: TableOrderByParams = { field: TransactionTableFields.TRANSACTION_ID, desc: true, }...
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#L221-L268
064737228413f603ec7bb956a22cfba7f7f9b8bb
github
JinnyWang-Space/guanlanwenjuan.git
601c4aa6c427e643d7bf42bc21945f658738e38c
entry/src/main/ets/views/AgreementView.ets
arkts
navBar
导航栏
@Builder navBar() { Row() { Button() { SymbolGlyph($r('sys.symbol.chevron_left')) .fontSize(24) .fontColor([$r('sys.color.ohos_id_color_titlebar_icon')]) } .width(40) .height(40) .backgroundColor($r('sys.color.ohos_id_color_button_normal')) .onClick(...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right navBar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_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_element#Left...
@Builder navBar() { Row() { Button() { SymbolGlyph($r('sys.symbol.chevron_left')) .fontSize(24) .fontColor([$r('sys.color.ohos_id_color_titlebar_icon')]) } .width(40) .height(40) .backgroundColor($r('sys.color.ohos_id_color_button_normal')) .onClick(...
https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/entry/src/main/ets/views/AgreementView.ets#L21-L42
45e87b318a5b21f1397eeab22dcbb61bfc52fc3d
github
zhongte/TaoYao
80850f3800dd6037216d3f7c58a2bf34a881c93f
taoyao/src/main/ets/shijing/taoyao/IAccessControl.ets
arkts
处理权限和系统设置的总入口
export interface IAccessControl { /** * 跟申请权限相关 * * @returns */ runtime(): RuntimeAccessControl /** * 跟系统设置相关 * * @returns */ setting(): Setting /** * 通知权限 * * @returns */ notification(): Notification /** * 联系人选择器 * * @returns */ contact(): Contact ...
AST#export_declaration#Left export AST#interface_declaration#Left interface IAccessControl AST#object_type#Left { /** * 跟申请权限相关 * * @returns */ AST#type_member#Left runtime AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left RuntimeAccessControl AST#primary_...
export interface IAccessControl { runtime(): RuntimeAccessControl setting(): Setting notification(): Notification contact(): Contact camera(): Camera media(): Media document(): Document audio(): Audio }
https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/IAccessControl.ets#L13-L70
d52621e3456f572370eb827cb2bb665a855dc915
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/navigation/src/main/ets/auth/AuthNavigator.ets
arkts
toRegister
跳转到注册页面 @returns {void} 无返回值
static toRegister(): void { navigateTo(AuthRoutes.Register); }
AST#method_declaration#Left static toRegister 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_custom_component_statement#Left navigateTo ( AST#expression#Left AST#member_ex...
static toRegister(): void { navigateTo(AuthRoutes.Register); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/navigation/src/main/ets/auth/AuthNavigator.ets#L37-L39
0bde5d847db8befdf6eb5832c2f326925a76ba7f
github
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/designsystem/src/main/ets/constants/LayoutPercent.ets
arkts
25% 百分比
export const P25: string = "25%";
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P25 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "25%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right...
export const P25: string = "25%";
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L34-L34
511efd39951d1973cf8b895682320a078e56420f
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.atomicservice.AtomicServiceTabs.d.ets
arkts
Callback for OnContentWillChange @typedef { function } OnContentWillChange @param { number } currentIndex - the index value of the current tab. @param { number } comingIndex - the index value of the tab that will change. @returns { boolean } @syscap SystemCapability.ArkUI.ArkUI.Full @atomicservice @since 12
export type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;
AST#export_declaration#Left export AST#type_declaration#Left type OnContentWillChangeCallback = AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter...
export type OnContentWillChangeCallback = (currentIndex: number, comingIndex: number) => boolean;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceTabs.d.ets#L224-L224
d91ebad3715a5b03f33f411b0603282bd78af1b3
gitee
iotjin/JhHarmonyDemo.git
819e6c3b1db9984c042a181967784550e171b2e8
JhCommon/Index.ets
arkts
/ utils
export * from '../JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils'
AST#export_declaration#Left export * from '../JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils' AST#export_declaration#Right
export * from '../JhCommon/src/main/ets/JhCommon/utils/JhCommonUtils'
https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/Index.ets#L48-L48
4a608ed52b90f441ba16d0d74596977efb53bdc3
github
liuchao0739/arkTS_universal_starter.git
0ca845f5ae0e78db439dc09f712d100c0dd46ed3
entry/src/main/ets/theme/ThemeManager.ets
arkts
loadTheme
加载主题设置
private async loadTheme(): Promise<void> { try { const theme = await StorageManager.getString(this.THEME_KEY, 'light') as ThemeMode; this.currentTheme = theme; Logger.info('ThemeManager', `Theme loaded: ${theme}`); } catch (error) { Logger.error('ThemeManager', `Failed to load theme: ${S...
AST#method_declaration#Left private async loadTheme 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#typ...
private async loadTheme(): Promise<void> { try { const theme = await StorageManager.getString(this.THEME_KEY, 'light') as ThemeMode; this.currentTheme = theme; Logger.info('ThemeManager', `Theme loaded: ${theme}`); } catch (error) { Logger.error('ThemeManager', `Failed to load theme: ${S...
https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/theme/ThemeManager.ets#L69-L77
c61de102c239cbc7e083c59d0c41259f6dd9dfc7
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/home/Swiper.ets
arkts
getOffSetX
Get the image offset. @param index @returns offset
getOffSetX(index: number): number { let offsetIndex: number = this.getImgCoefficients(index); let tempOffset: number = Math.abs(offsetIndex); let offsetX: number = 0; if (tempOffset === 1) { offsetX = -40 * offsetIndex; } return offsetX; }
AST#method_declaration#Left getOffSetX 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 number AST#primary_type#Right...
getOffSetX(index: number): number { let offsetIndex: number = this.getImgCoefficients(index); let tempOffset: number = Math.abs(offsetIndex); let offsetX: number = 0; if (tempOffset === 1) { offsetX = -40 * offsetIndex; } return offsetX; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Shopping/OrangeShopping/feature/navigationHome/src/main/ets/components/home/Swiper.ets#L56-L64
1f67c5eaed0f200d87405f3a43be678e07ab52a6
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets
arkts
get
获取数据
get(key: string): dataPreferences.ValueType | null | undefined { if (!this.preferences) { this.initPreferences(); } let value = this.preferences?.getSync(key, null);; return value; }
AST#method_declaration#Left get AST#parameter_list#Left ( AST#parameter#Left key : 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#union_type#Left AST#primary_type#Left AST#qualified_type...
get(key: string): dataPreferences.ValueType | null | undefined { if (!this.preferences) { this.initPreferences(); } let value = this.preferences?.getSync(key, null);; return value; }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/utils/DataPreferencesUtils.ets#L28-L34
a1c8cd5b9dc5b5ccb40c092a6eb9af26e14f55a9
github
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets
arkts
getPrice
When a constant is declared as a base type, its content cannot be changed
function getPrice() { return PRICE; }
AST#function_declaration#Left function getPrice AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left PRICE AST#expression#Right ; AST#return_statement#Right AST#statement#Right } AST#block_statement#Right AST#function_dec...
function getPrice() { return PRICE; }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets#L11-L13
5dadd976469a73af3a92a077fa08f0156d8f6076
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets
arkts
uploadAvatar
上传头像到服务器
async uploadAvatar(imageUri: string) { this.isUploadingAvatar = true; try { const toastOpts: ToastOptions = { message: '正在上传头像...', duration: 2000 }; promptAction.showToast(toastOpts); console.info(`准备上传头像: ${imageUri}`); // 将图片转为Base64 const base64St...
AST#method_declaration#Left async uploadAvatar AST#parameter_list#Left ( AST#parameter#Left imageUri : 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_statem...
async uploadAvatar(imageUri: string) { this.isUploadingAvatar = true; try { const toastOpts: ToastOptions = { message: '正在上传头像...', duration: 2000 }; promptAction.showToast(toastOpts); console.info(`准备上传头像: ${imageUri}`); const base64String = await t...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/ProfileEditPage.ets#L214-L261
ab44719b098e2c8f74da430dcab5003a9dccf594
github
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets
arkts
arrayBufferToBase64
ArrayBuffer转Base64工具函数
private arrayBufferToBase64(buffer: Uint8Array): string { // 创建Base64Helper实例后再调用方法 const base64Helper: util.Base64Helper = new util.Base64Helper(); return base64Helper.encodeToStringSync(buffer); }
AST#method_declaration#Left private arrayBufferToBase64 AST#parameter_list#Left ( AST#parameter#Left buffer : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string ...
private arrayBufferToBase64(buffer: Uint8Array): string { const base64Helper: util.Base64Helper = new util.Base64Helper(); return base64Helper.encodeToStringSync(buffer); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/dream/DreamEditPage.ets#L865-L869
42cfbece32be929df987d652d624508bd370bef0
github
openharmony-tpc/ImageKnife
bc55de9e2edd79ed4646ce37177ad94b432874f7
library/src/main/ets/downsampling/DownsampleStartegy.ets
arkts
宽高进行等比缩放宽高里面最大的比例先放进去 然后再更据原图的缩放比去适配另一边
export class CenterInside implements BaseDownsampling { getName() { return 'CenterInside' } getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number, downsampType: DownsampleStrategy ): number { let outSize: Size = { width: round(Math.min(1, get...
AST#export_declaration#Left export AST#class_declaration#Left class CenterInside AST#implements_clause#Left implements BaseDownsampling AST#implements_clause#Right AST#class_body#Left { AST#method_declaration#Left getName AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left...
export class CenterInside implements BaseDownsampling { getName() { return 'CenterInside' } getScaleFactor(sourceWidth: number, sourceHeight: number, requestedWidth: number, requestedHeight: number, downsampType: DownsampleStrategy ): number { let outSize: Size = { width: round(Math.min(1, get...
https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/downsampling/DownsampleStartegy.ets#L97-L131
e5af9c813682eab4f05cd948e168912d799a8873
gitee