nwo
stringclasses
304 values
sha
stringclasses
304 values
path
stringlengths
9
214
language
stringclasses
1 value
identifier
stringlengths
0
49
docstring
stringlengths
1
34.2k
function
stringlengths
8
59.4k
ast_function
stringlengths
71
497k
obf_function
stringlengths
8
39.4k
url
stringlengths
102
324
function_sha
stringlengths
40
40
source
stringclasses
2 values
openharmony/applications_settings
aac607310ec30e30d1d54db2e04d055655f72730
common/component/src/main/ets/default/ComponentConfig.ets
arkts
Copyright (c) 2021 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 class ComponentConfig { WH_100_100 = '100%'; WH_30_100 = '30%'; WH_33_100 = '33%'; WH_35_100 = '35%'; WH_40_100 = '40%'; WH_45_100 = '45%'; WH_50_100 = '50%'; WH_55_100 = '55%'; WH_83_100 = '83%'; WH_90_100 = '90%'; value_20 = 20; font_20 = 20; MAX_LINES_1 = 1; MAX_LINES_2 = 2; MAX_...
AST#export_declaration#Left export AST#class_declaration#Left class ComponentConfig AST#class_body#Left { AST#property_declaration#Left WH_100_100 = AST#expression#Left '100%' AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left WH_30_100 = AST#expression#Left '30%' AST#expression#Right ;...
export class ComponentConfig { WH_100_100 = '100%'; WH_30_100 = '30%'; WH_33_100 = '33%'; WH_35_100 = '35%'; WH_40_100 = '40%'; WH_45_100 = '45%'; WH_50_100 = '50%'; WH_55_100 = '55%'; WH_83_100 = '83%'; WH_90_100 = '90%'; value_20 = 20; font_20 = 20; MAX_LINES_1 = 1; MAX_LINES_2 = 2; MAX_...
https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/ComponentConfig.ets#L16-L33
037904f690deeafc6416288d2a668a861fb3e46f
gitee
Joker-x-dev/HarmonyKit.git
f97197ce157df7f303244fba42e34918306dfb08
core/util/src/main/ets/toast/ToastUtils.ets
arkts
showBottom
显示底部 Toast @param {string | ResourceStr} message - 提示内容 @returns {void} 无返回值
static showBottom(message: string | ResourceStr): void { IBestToast.show({ position: "bottom", offsetY: "-20%", message: message }); }
AST#method_declaration#Left static showBottom AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left ResourceStr AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Ri...
static showBottom(message: string | ResourceStr): void { IBestToast.show({ position: "bottom", offsetY: "-20%", message: message }); }
https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/toast/ToastUtils.ets#L106-L112
6cbeb7649cee29c35f0661d6791d1fa9096fe77a
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/shareimagepage/src/main/ets/components/ListDataSource.ets
arkts
实现IDataSource接口的对象,用于瀑布流组件加载数据
export class ListDataSource implements IDataSource { private dataArray: textDetailData[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: textDetailData[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } /** * 获取索引对应的数据 * @p...
AST#export_declaration#Left export AST#class_declaration#Left class ListDataSource AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left private dataArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left textDetailData [ ] A...
export class ListDataSource implements IDataSource { private dataArray: textDetailData[] = []; private listeners: DataChangeListener[] = []; constructor(dataArray: textDetailData[]) { for (let i = 0; i < dataArray.length; i++) { this.dataArray.push(dataArray[i]); } } public getData(index: n...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shareimagepage/src/main/ets/components/ListDataSource.ets#L21-L134
ecb8f45a1228ad865865e7480ec3c7306d39b210
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/FlowManagement_case/entry/src/main/ets/pages/Index.ets
arkts
用于显示日志的变量
build() { Column() { Text($r('app.string.TitleName')) .fontSize(TEXT_FONT_SIZE) .fontColor(Color.Black) .id('title') // 显示日志的文本 Text(this.logMessage) .fontSize(LOG_FONT_SIZE) .fontColor(Color.Black) .margin({ bottom: LOG_MARGIN }) .textAlign...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left AST#resource_expression#Left...
build() { Column() { Text($r('app.string.TitleName')) .fontSize(TEXT_FONT_SIZE) .fontColor(Color.Black) .id('title') Text(this.logMessage) .fontSize(LOG_FONT_SIZE) .fontColor(Color.Black) .margin({ bottom: LOG_MARGIN }) .textAlign(TextAlign...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/FlowManagement_case/entry/src/main/ets/pages/Index.ets#L34-L172
0d3f8ecb35d3e750b429e96cad013c6d4ec450c2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_ui/src/main/ets/ui/base/ImmersionUtil.ets
arkts
顶部状态栏偏移量
constructor() { if (!ImmersionUtil.instance) { ImmersionUtil.instance = this; } return ImmersionUtil.instance; }
AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! AST#expression#Left ImmersionUtil AST#expression#Right...
constructor() { if (!ImmersionUtil.instance) { ImmersionUtil.instance = this; } return ImmersionUtil.instance; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/ImmersionUtil.ets#L43-L48
fcc35617b6312180d0d3e06d582a17a38cd7272c
gitee
robotzzh/AgricultureApp.git
7b12c588dd1d07cc07a8b25577d785d30bd838f6
entry/src/main/ets/common/bean/FarmBean.ets
arkts
alert_fieldId
--------------------数据库操作部分(finished)------------------// 给定一个Farm_index,获取JSON中的数据 弃用 static read_Json(index:number):FarmBean{ let context = getContext(this) as common.UIAbilityContext; let filesDir = context.filesDir; let data: FarmBean = null; fs.listFile(filesDir+'/FarmBean').then((filenames) => { console.info("l...
alert_fieldId(fieldId : number){ this.fieldId = fieldId; }
AST#method_declaration#Left alert_fieldId AST#parameter_list#Left ( AST#parameter#Left fieldId : 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#builder_function_body#Left { AST#expression_statement#Left AST#expres...
alert_fieldId(fieldId : number){ this.fieldId = fieldId; }
https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/common/bean/FarmBean.ets#L199-L201
4f4d5cec1bd1ad78091ae3b997495c5fafd8cabd
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_UIAbilityComponentsBasicUsage.ets
arkts
startAbilityTest
注册订阅系统环境变化的ID
startAbilityTest(): void { let context = getContext(this) as common.UIAbilityContext; let want: Want = { // Want参数信息 }; context.startAbility(want); }
AST#method_declaration#Left startAbilityTest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left context = ...
startAbilityTest(): void { let context = getContext(this) as common.UIAbilityContext; let want: Want = { }; context.startAbility(want); }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ApplicationModels/StageModelAbilityDevelop/entry/src/main/ets/pages/Page_UIAbilityComponentsBasicUsage.ets#L31-L37
9dcdbc0f5764f57eaf5bc7823f01a8751eb7cdc9
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/action/DialogUtil.ets
arkts
showTextPicker
文本滑动选择器弹窗 (TextPickerDialog) @param options range 选择器的数据选择列表。不可设置为空数组,若设置为空数组,则不显示;若动态变化为空数组,则保持当前正常值显示。 说明:单列数据选择器使用string[],Resource,TextPickerRangeContent[]类型。 多列数据选择器使用string[][]类型。多列联动数据选择器使用TextCascadePickerRangeContent[]类型。Resource类型只支持strarray.json。 selected 设置默认选中项在数组中的索引值。默认值:0 说明:单列数据选择器使用number类型。 多列、多列联动数据...
static showTextPicker(options: TextPickerDialogOptions) { DialogUtil.initPickerDialogDefault(options); TextPickerDialog.show(options); }
AST#method_declaration#Left static showTextPicker AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left TextPickerDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_...
static showTextPicker(options: TextPickerDialogOptions) { DialogUtil.initPickerDialogDefault(options); TextPickerDialog.show(options); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/action/DialogUtil.ets#L195-L198
5aa7097495b40951c076f4b96f64295820cc51fd
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/orientationDevelopment/entry/src/main/ets/pages/ScreenRotationA.ets
arkts
[End orientation]
build() { Text('你好') }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Text ( AST#expression#Left '你好' AST#expression#Right ) AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#Right AST#build_method#Ri...
build() { Text('你好') }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/orientationDevelopment/entry/src/main/ets/pages/ScreenRotationA.ets#L22-L24
ff4a2537200b9a02a4e1099fddafa5b76fc7ec22
gitee
harmonyos_samples/BestPracticeSnippets
490ea539a6d4427dd395f3dac3cf4887719f37af
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment1.ets
arkts
[StartExclude Case1]
build() { Column() { } }
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#container_content_body#Right AST#ui_component#Right AST#ui_element_with_modifiers#Right AST#arkts_ui_element#Right } AST#build_body#...
build() { Column() { } }
https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment1.ets#L37-L40
c44559fee2fbb630dd84c9206c46f1a03c42a151
gitee
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/KvUtil.ets
arkts
getEntries
获取匹配指定键前缀的所有键值对 @param keyPrefix 表示要匹配的键前缀。不能包含'^',包含'^'的话将导致谓词失效,查询结果会返回数据库中的所有数据。 @returns
static async getEntries(keyPrefix: string): Promise<distributedKVStore.Entry[]> { let kvStore = await KvUtil.getKvStore(); return kvStore.getEntries(keyPrefix); }
AST#method_declaration#Left static async getEntries AST#parameter_list#Left ( AST#parameter#Left keyPrefix : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_...
static async getEntries(keyPrefix: string): Promise<distributedKVStore.Entry[]> { let kvStore = await KvUtil.getKvStore(); return kvStore.getEntries(keyPrefix); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/KvUtil.ets#L156-L159
533ef1b3155fbde9deca0a2332aaba9bcae6f5ed
gitee
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@ohos.util.d.ets
arkts
getCommonFactor
Get the greatest common factor of two integers. @param { number } number1 - Is an integer. @param { number } number2 - Is an integer. @returns { number } Returns the greatest common factor of two integers, integer type. @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left u...
static getCommonFactor(number1: number, number2: number): number;
AST#method_declaration#Left static getCommonFactor AST#parameter_list#Left ( AST#parameter#Left number1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left number2 : AST#type_annotation#Left AST#primary_type#Left number AST#pr...
static getCommonFactor(number1: number, number2: number): number;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L970-L970
053ed02744815fd317f7db924c0deb059ade8497
gitee
bigbear20240612/planner_build-.git
89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1
entry/src/main/ets/viewmodel/SimpleOfflineManager.ets
arkts
离线操作记录
export interface SimpleOfflineOperation { id: string; type: string; entityType: string; entityId: number; timestamp: number; }
AST#export_declaration#Left export AST#interface_declaration#Left interface SimpleOfflineOperation AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left type : AST#type_annotati...
export interface SimpleOfflineOperation { id: string; type: string; entityType: string; entityId: number; timestamp: number; }
https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L21-L27
ed0fe36fa2d6fadf7d0f82a705add1f461f0caf4
github
harmonyos/samples
f5d967efaa7666550ee3252d118c3c73a77686f5
HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets
arkts
decryptDataUseSm4
模拟使用HUKS生成的新密钥进行低安访问控制与解密
async decryptDataUseSm4(resultCallback: Function): Promise<void> { let decryptOptions: HuksProperties[] = new Array(); getSm4DecryptProperties(decryptOptions); let sm4KeyAlias = 'test_sm4KeyAlias'; let handle: number = 0; let options: huks.HuksOptions = { properties: decryptOptions, inDa...
AST#method_declaration#Left async decryptDataUseSm4 AST#parameter_list#Left ( AST#parameter#Left resultCallback : 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 AST#g...
async decryptDataUseSm4(resultCallback: Function): Promise<void> { let decryptOptions: HuksProperties[] = new Array(); getSm4DecryptProperties(decryptOptions); let sm4KeyAlias = 'test_sm4KeyAlias'; let handle: number = 0; let options: huks.HuksOptions = { properties: decryptOptions, inDa...
https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/Security/Huks/entry/src/main/ets/model/HuksModel.ets#L456-L474
8ed72a814e54d11d13a1251f39dca81c96e4e759
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Sync.ets
arkts
testEccUseCommKeySpecGetSync
根据EccCommonSpec实例生成ECC密钥对,获取密钥规格
function testEccUseCommKeySpecGetSync() { try { let commKeySpec = genEccCommonSpec(); // 使用参数属性,构造ECC公私钥公共密钥参数对象 let generatorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(commKeySpec); // 使用密钥参数对象创建生成器 let keyPair = generatorBySpec.generateKeyPairSync(); // Generate an ECC key pair. if (keyPai...
AST#function_declaration#Left function testEccUseCommKeySpecGetSync AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left commKeySpec = AST...
function testEccUseCommKeySpecGetSync() { try { let commKeySpec = genEccCommonSpec(); let generatorBySpec = cryptoFramework.createAsyKeyGeneratorBySpec(commKeySpec); let keyPair = generatorBySpec.generateKeyPairSync(); if (keyPair != null) { showEccSpecDetailInfo(keyPair.priKey, 'priKey'); ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Sync.ets#L96-L111
cfe765e584a0fe4eaf19c996c03a76d6be9cfd20
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/VideoPlay/entry/src/main/ets/components/SpeedDialog.ets
arkts
SpeedDialog
倍速列表索引
@CustomDialog export struct SpeedDialog { @State speedList: Resource[] = [$r('app.string.video_speed_1_0X'), $r('app.string.video_speed_1_25X'), $r('app.string.video_speed_1_75X'), $r('app.string.video_speed_2_0X')]; @Link speedSelect: number; // 当前选择项的索引 @StorageLink('avPlayManage') avPlayManage: avPlayManage | ...
AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct SpeedDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right speedList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Resource [ ] AST#arr...
@CustomDialog export struct SpeedDialog { @State speedList: Resource[] = [$r('app.string.video_speed_1_0X'), $r('app.string.video_speed_1_25X'), $r('app.string.video_speed_1_75X'), $r('app.string.video_speed_2_0X')]; @Link speedSelect: number; @StorageLink('avPlayManage') avPlayManage: avPlayManage | null = null...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/VideoPlay/entry/src/main/ets/components/SpeedDialog.ets#L23-L121
dcd904950fce4b5808e0983ec0db80d62cb52da3
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/data/ContactService.ets
arkts
initializeMockData
初始化模拟数据 - 清空所有数据,只保留测试用的联系人
private initializeMockData(): void { // 清空所有联系人数据 this.contacts = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Initialized ContactService with empty contact list for production`); }
AST#method_declaration#Left private initializeMockData 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#assignmen...
private initializeMockData(): void { this.contacts = []; hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Initialized ContactService with empty contact list for production`); }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/data/ContactService.ets#L108-L113
51061fbd7af90ae3b2a1acb2ccfadc75965dd813
github
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/popup/AdvancedPopup.ets
arkts
PopupBuilder_AllOptions
所有入参属性
@Builder PopupBuilder_AllOptions(){ Popup({ icon: { image: $r('app.media.app_icon'), } as PopupIconOptions, title: { text: 'Popup title' } as PopupTextOptions, message: { text: 'Popup message' } as PopupTextOptions, showClose: true, onClose...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right PopupBuilder_AllOptions 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 Popup ( AST#component_parameters#Left { AST#compon...
@Builder PopupBuilder_AllOptions(){ Popup({ icon: { image: $r('app.media.app_icon'), } as PopupIconOptions, title: { text: 'Popup title' } as PopupTextOptions, message: { text: 'Popup message' } as PopupTextOptions, showClose: true, onClose...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/popup/AdvancedPopup.ets#L325-L347
9de1047cd6c41b260c6395ddfd8c6c580316f857
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Marks a window to be a zone. @param window_id The id of zone / window. @returns True if success, false if duplicate alias, undefined if already is zone.
export function set_zone(window_id: string) { let storage = storage_of_id(window_id); let alias = storage.get('my_window_alias') as string; // Do not allow duplicate aliases if ((scan_zones()[0] as string[]).includes(alias)) { console.log(`[zone_actions][set_zone] Failed, duplicated alias!`); return fa...
AST#export_declaration#Left export AST#function_declaration#Left function set_zone AST#parameter_list#Left ( AST#parameter#Left window_id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST...
export function set_zone(window_id: string) { let storage = storage_of_id(window_id); let alias = storage.get('my_window_alias') as string; if ((scan_zones()[0] as string[]).includes(alias)) { console.log(`[zone_actions][set_zone] Failed, duplicated alias!`); return false; } let tabs = storage...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L93-L133
98109bd13524d78e800c51704a2053f579cb4b95
gitee
wcmzllx/axis-render
34a330085691968cf1c132095e5ce078aa7ee933
AxisRenderLibrary/src/main/ets/common/AxisRender.ets
arkts
StandardScale
一个标准缩放的刻度占用像素
@Observed export class StandardScale { // 单位 @Track unit: number = 1; // 单位占用像素 @Track pixel: number = 12; }
AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class StandardScale AST#class_body#Left { // 单位 AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right unit : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotat...
@Observed export class StandardScale { @Track unit: number = 1; 占用像素 @Track pixel: number = 12; }
https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L110-L116
044a39992af27fbdbcc4a8c1337e8adade12d5c7
gitee
htliang128/arkts_oss.git
9da4a87c36272873c649f556854bd793ac337a18
htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets
arkts
getResumeFrom
Getter and setter for resumeFrom
getResumeFrom(): number | undefined { return this.resumeFrom; }
AST#method_declaration#Left getResumeFrom AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statement#Le...
getResumeFrom(): number | undefined { return this.resumeFrom; }
https://github.com/htliang128/arkts_oss.git/blob/9da4a87c36272873c649f556854bd793ac337a18/htliang_oss/src/main/ets/common/comm/CustomHttpRequestOptions.ets#L128-L130
fc2839cba47409a48b1937759e00aad9145c2d35
github
mayuanwei/harmonyOS_bilibili
8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5
HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/pages/SuccessPage.ets
arkts
TODO
build() { Column() { Column() { //TODO } .backgroundColor(Color.White) .height(CommonConstants.FULL_PARENT) .borderRadius($r('app.float.verify_ok_margin')) } .padding({ bottom: $r('app.float.verify_bottom_padding') }) .height(CommonConstants.FULL_PARENT) }
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { //TODO } A...
build() { Column() { Column() { } .backgroundColor(Color.White) .height(CommonConstants.FULL_PARENT) .borderRadius($r('app.float.verify_ok_margin')) } .padding({ bottom: $r('app.float.verify_bottom_padding') }) .height(CommonConstants.FULL_PARENT) }
https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/HCIA/framework/ArkUI/ArkUI_Experiment_frame/entry/src/main/ets/pages/SuccessPage.ets#L9-L21
71474b814db8b1fc5b11466ade86820503458839
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/ContactTypes.ets
arkts
自定义属性接口
export interface CustomAttribute { id: string; // 属性ID name: string; // 属性名称 value: string; // 属性值 category: string; // 属性分类 icon?: string; // 图标 color?: string; // 颜色 }
AST#export_declaration#Left export AST#interface_declaration#Left interface CustomAttribute AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 属性ID AST#type_member#Left name : AST#type_annotat...
export interface CustomAttribute { id: string; name: string; value: string; category: string; icon?: string; color?: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L130-L137
7817082771cfde6cd23356a29eb150e9da4e26c2
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets
arkts
[End read_Write_File] 以流的形式读写文件test.txt => destFile.txt
export async function readWriteFileWithStream(): Promise<void> { // 打开文件流 let inputStream = fs.createStreamSync(filesDir + '/test.txt', 'r+'); let outputStream = fs.createStreamSync(filesDir + '/destFile.txt', 'w+'); // 以流的形式读取源文件内容并写入目的文件 let bufSize = BUFFER; let readSize = READSIZE; let buf = new Array...
AST#export_declaration#Left export AST#function_declaration#Left async function readWriteFileWithStream 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#pr...
export async function readWriteFileWithStream(): Promise<void> { let inputStream = fs.createStreamSync(filesDir + '/test.txt', 'r+'); let outputStream = fs.createStreamSync(filesDir + '/destFile.txt', 'w+'); let bufSize = BUFFER; let readSize = READSIZE; let buf = new ArrayBuffer(bufSize); let readOpt...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/FileSample/entry/src/main/ets/fileFs/FileFs.ets#L93-L117
e7c67a543bf186f1ebc32e328f448a667f1f3522
gitee
Tianpei-Shi/MusicDash.git
4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5
src/model/UserModel.ets
arkts
fromCloudObject
从CloudDB对象创建UserInfo
static fromCloudObject(obj: CloudDBZoneObject): UserInfo { const user = new UserInfo(obj.id as number, obj.username as string, obj.password as string); user.like = obj.like as string; user.history = obj.history as string; user.phone = obj.phone as number; user.createdTime = obj.createdTime as number...
AST#method_declaration#Left static fromCloudObject AST#parameter_list#Left ( AST#parameter#Left obj : AST#type_annotation#Left AST#primary_type#Left CloudDBZoneObject AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left UserInfo...
static fromCloudObject(obj: CloudDBZoneObject): UserInfo { const user = new UserInfo(obj.id as number, obj.username as string, obj.password as string); user.like = obj.like as string; user.history = obj.history as string; user.phone = obj.phone as number; user.createdTime = obj.createdTime as number...
https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/model/UserModel.ets#L55-L64
1ac876f8198a249baec38992e4efc830dde62c83
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/crypto/CryptoHelper.ets
arkts
getRandomUint8Array
根据传入的大小生成随机Uint8Array @param size 生成的串长度 @returns
static getRandomUint8Array(size: number): Uint8Array { return cryptoFramework.createRandom().generateRandomSync(size).data; }
AST#method_declaration#Left static getRandomUint8Array AST#parameter_list#Left ( AST#parameter#Left size : 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 Uint8Array AST...
static getRandomUint8Array(size: number): Uint8Array { return cryptoFramework.createRandom().generateRandomSync(size).data; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L135-L137
7d049295a8025a2df5ad6b610acdc5b4edc94bcc
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/loop_stmt/foreach_002_F.ets
arkts
Introduction 循环结构-循环体-foreach
export function foreach_002_F(taint_src : string) { let clean = "" let _t = taint_src; let arr = ["a", "b", clean]; arr.forEach(item => { taint.Sink(item); }) }
AST#export_declaration#Left export AST#function_declaration#Left function foreach_002_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#block_statement#Left ...
export function foreach_002_F(taint_src : string) { let clean = "" let _t = taint_src; let arr = ["a", "b", clean]; arr.forEach(item => { taint.Sink(item); }) }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/loop_stmt/foreach_002_F.ets#L6-L13
660b6def52e8ca01f40bcfddfd36c9e9a9fa9dc0
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/member/EncourageManager.ets
arkts
============================================================ EncourageTypeHelper:激励类型扩展方法(合并了RewardPool功能) ============================================================
export class EncourageTypeHelper { // ============================================================ // 私有静态字段:奖励池数据 // ============================================================ // 激励广告奖励池(类似Swift中的static var rewardAd) private static rewardAd: number[] = ArrayUtils.shuffled([10,10,10,10,10,10,10,10,10,10,2...
AST#export_declaration#Left export AST#class_declaration#Left class EncourageTypeHelper AST#class_body#Left { // ============================================================ // 私有静态字段:奖励池数据 // ============================================================ // 激励广告奖励池(类似Swift中的static var rewardAd) AST#property_declaration#...
export class EncourageTypeHelper { private static rewardAd: number[] = ArrayUtils.shuffled([10,10,10,10,10,10,10,10,10,10,20,20,20,30,30,50,80,90,100]); private static shareApp: number[] = ArrayUtils.shuffled([30,30,30,30,30,30,30,30,30,30,40,50,50,60,70,80,90,100]); static getKeyW...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/member/EncourageManager.ets#L27-L72
03b337471a2011b40aa987dc4df3d64ecf8d928b
github
openharmony/interface_sdk-js
c349adc73e2ec1f61f6fca489b5af059e3ed6999
api/@system.router.d.ets
arkts
back
Returns to the previous page or a specified page. @param { BackRouterOptions } options Options. @syscap SystemCapability.ArkUI.ArkUI.Full @since 3 @deprecated since 8
static back(options?: BackRouterOptions): void;
AST#method_declaration#Left static back AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left BackRouterOptions 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#prim...
static back(options?: BackRouterOptions): void;
https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@system.router.d.ets#L272-L272
31a605625c57600d067e1fdc91f6b5b6d0664b4e
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Speech/Wave/WaveView.ets
arkts
buildWavePath
===================== 路径构建方法 ===================== 构建水波路径(基于正弦函数) @param width - 画布宽度 @param height - 画布高度 @returns Path2D对象(描述波形路径)
private buildWavePath(width: number, height: number): Path2D { const path = new Path2D(); // 创建新路径 const waveFrequency = 2.5 * Math.PI / width; // 计算波形频率(基于宽度) path.moveTo(0, this.waveHeight); // 起点定位到波形基准高度 // 构建正弦曲线路径(关键算法) for (let x = 0; x <= width; x++) { // 计算每个x坐标对应的y值(正弦函数...
AST#method_declaration#Left private buildWavePath AST#parameter_list#Left ( AST#parameter#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left height : AST#type_annotation#Left AST#primary_type#Left number AST#primar...
private buildWavePath(width: number, height: number): Path2D { const path = new Path2D(); const waveFrequency = 2.5 * Math.PI / width; path.moveTo(0, this.waveHeight); for (let x = 0; x <= width; x++) { const y = this.waveAmplitude * Math.sin(waveFrequency * x + this.of...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Wave/WaveView.ets#L87-L106
56ddb487e14308dc58fcd5672a3b95763f5478fa
github
open9527/OpenHarmony
fdea69ed722d426bf04e817ec05bff4002e81a4e
entry/src/main/ets/pages/example/ui/PathSvgView.ets
arkts
SVGView
@author open_9527 @date 2025/10/23 @desc 绘制 SVG
@Preview @ComponentV2 export struct SVGView { private size60: number = this.getUIContext().vp2px(60) private size33: number = this.getUIContext().vp2px(33.1371) private commands: string = `M${this.size60} ${this.size60} H0 C${this.size33} ${this.size60} ${this.size60} ${this.size33} ${this.size60} 0 V${this.s...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SVGView AST#component_body#Left { AST#property_declaration#Left private size60 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type...
@Preview @ComponentV2 export struct SVGView { private size60: number = this.getUIContext().vp2px(60) private size33: number = this.getUIContext().vp2px(33.1371) private commands: string = `M${this.size60} ${this.size60} H0 C${this.size33} ${this.size60} ${this.size60} ${this.size33} ${this.size60} 0 V${this.s...
https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/entry/src/main/ets/pages/example/ui/PathSvgView.ets#L7-L48
6fae192b243ae14029dd9f34a95f0fa69bd76a76
gitee
buqiuz/Account.git
b843a38c24a833a9a4386f63cffec5fa5dadc674
oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/BuildProfile.ets
arkts
Use these variables when you tailor your ArkTS code. They must be of the const type.
export const HAR_VERSION = '3.0.15';
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left HAR_VERSION = AST#expression#Left '3.0.15' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right
export const HAR_VERSION = '3.0.15';
https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/BuildProfile.ets#L4-L4
93898d9fcc51ec69b47a58e176cd26c4511e068a
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/MultiDeviceMusic/common/src/main/ets/constants/GridConstants.ets
arkts
Constants for Grid components.
export class GridConstants { /** * Current component width: 4 grids. */ static readonly SPAN_FOUR: number = 4; /** * Current component width: 6 grids. */ static readonly SPAN_SIX: number = 6; /** * Current component width: 8 grids. */ static readonly SPAN_EIGHT: number = 8; /** * C...
AST#export_declaration#Left export AST#class_declaration#Left class GridConstants AST#class_body#Left { /** * Current component width: 4 grids. */ AST#property_declaration#Left static readonly SPAN_FOUR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#...
export class GridConstants { static readonly SPAN_FOUR: number = 4; static readonly SPAN_SIX: number = 6; static readonly SPAN_EIGHT: number = 8; static readonly SPAN_TWELVE: number = 12; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/MultiDeviceMusic/common/src/main/ets/constants/GridConstants.ets#L19-L39
21d05e541bfdd5fca8e2eb3be1bc62ab3a0b3e9e
gitee
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/components/YAxis.ets
arkts
setUseAutoScaleMinRestriction
Sets autoscale restriction for axis min value as enabled/disabled @Deprecated
public setUseAutoScaleMinRestriction(isEnabled: boolean): void { this.mUseAutoScaleRestrictionMin = isEnabled; }
AST#method_declaration#Left public setUseAutoScaleMinRestriction AST#parameter_list#Left ( AST#parameter#Left isEnabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Lef...
public setUseAutoScaleMinRestriction(isEnabled: boolean): void { this.mUseAutoScaleRestrictionMin = isEnabled; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/YAxis.ets#L471-L473
a724ea70d64846e8b7c33c727db20bcea78189d3
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/fixedstyledialog/ActionSheet.ets
arkts
showActionSheetExample
[Start action_sheet_dialog]
@Entry @Component export struct showActionSheetExample { build() { NavDestination() { Column({ space: 12 }) { Column() { Button('showActionSheet') .margin(30) .onClick(() => { this.getUIContext().showActionSheet({ title: 'ActionSheet ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct showActionSheetExample 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...
@Entry @Component export struct showActionSheetExample { build() { NavDestination() { Column({ space: 12 }) { Column() { Button('showActionSheet') .margin(30) .onClick(() => { this.getUIContext().showActionSheet({ title: 'ActionSheet ...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/DialogProject/entry/src/main/ets/pages/fixedstyledialog/ActionSheet.ets#L17-L84
a7279214dd936c2d55833f9a9956497b800681d5
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets
arkts
getUserCouponPage
获取用户优惠券分页 @param {PageRequest} params - 分页参数 @returns {Promise<NetworkResponse<NetworkPageData<Coupon>>>} 优惠券分页数据
async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Coupon>>> = await NetworkClient.http.post("market/coupon/user/page", params); return resp.data; }
AST#method_declaration#Left async getUserCouponPage AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PageRequest AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generi...
async getUserCouponPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Coupon>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Coupon>>> = await NetworkClient.http.post("market/coupon/user/page", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets#L27-L31
25439c218248417c94397dcf7527a515fa78c8cd
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/dbUtils/DBAccessor.ets
arkts
updateDbBatch
在事务中批量执行更新操作 @param sqls - SQL语句数组 @param paramsList - 参数数组的数组(与sqls一一对应) @returns Promise<boolean> 返回是否全部执行成功 注意:该方法会自动关闭数据库连接
async updateDbBatch( sqls: string[], paramsList: ParamType[][] = [] ): Promise<boolean> { if (!await this.initDatabase()) return false; if (!this.isInitialized || !this.rdbStore) { console.error('数据库未初始化成功'); return false; } try { // 使用 beginTransaction(通常不会返回 txId) thi...
AST#method_declaration#Left async updateDbBatch AST#parameter_list#Left ( AST#parameter#Left sqls : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left paramsList : AST#type_annotatio...
async updateDbBatch( sqls: string[], paramsList: ParamType[][] = [] ): Promise<boolean> { if (!await this.initDatabase()) return false; if (!this.isInitialized || !this.rdbStore) { console.error('数据库未初始化成功'); return false; } try { this.rdbStore!.beginTransaction(); ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/dbUtils/DBAccessor.ets#L366-L399
9edfce13721a2f498829669aae196bca9ba887d9
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/app/views/HighlightText.ets
arkts
HighlightText
==================== 组件实现 ====================
@ComponentV2 export struct HighlightText { // ---------- 输入参数 ---------- @Param content: string = ''; @Param keyword: string = ''; @Param highlightColor: ResourceColor = Color.Red; @Param normalColor: ResourceColor = Color.Black; // ---------- 样式配置 ---------- @Param textStyle: TextStyleConfig = { tex...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct HighlightText AST#component_body#Left { // ---------- 输入参数 ---------- AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left string AST#...
@ComponentV2 export struct HighlightText { @Param content: string = ''; @Param keyword: string = ''; @Param highlightColor: ResourceColor = Color.Red; @Param normalColor: ResourceColor = Color.Black; @Param textStyle: TextStyleConfig = { textAlign: TextAlign.Center, maxLines: 0, ...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/HighlightText.ets#L24-L112
17338ca70f6c915403d67a4e173ad28bab50e83c
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/AppUtil.ets
arkts
isApiSupported
检查API版本是否安全 @param apiVersion API方法支持的最低版本
static isApiSupported(apiVersion: number): boolean { return deviceInfo.sdkApiVersion >= apiVersion; }
AST#method_declaration#Left static isApiSupported AST#parameter_list#Left ( AST#parameter#Left apiVersion : 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 boolean AST#p...
static isApiSupported(apiVersion: number): boolean { return deviceInfo.sdkApiVersion >= apiVersion; }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L59-L61
b2d92ff9136a399deeaa20af1d765d97c3695f69
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/common/types/GreetingTypes.ets
arkts
祝福语评价接口
export interface GreetingRating { id: string; greetingId: string; contactId: string; rating: number; // 1-5 comment?: string; tags?: string[]; createdAt: string; }
AST#export_declaration#Left export AST#interface_declaration#Left interface GreetingRating AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left greetingId : AST#type_annotation...
export interface GreetingRating { id: string; greetingId: string; contactId: string; rating: number; comment?: string; tags?: string[]; createdAt: string; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L392-L400
131f2e0de9e79ac732ffca8ddd0eeaaeae5aa4b3
github
openharmony-tpc/lottieArkTS
82cac19eaeb236c38fc72466a268c1d0d8a481ce
entry/src/main/ets/pages/AnimationShow.ets
arkts
aboutToDisappear
页面销毁时释放动画资源
aboutToDisappear(): void { console.info('aboutToDisappear'); }
AST#method_declaration#Left aboutToDisappear 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...
aboutToDisappear(): void { console.info('aboutToDisappear'); }
https://github.com/openharmony-tpc/lottieArkTS/blob/82cac19eaeb236c38fc72466a268c1d0d8a481ce/entry/src/main/ets/pages/AnimationShow.ets#L89-L91
a9948982e5bd4b710bddcee2104433ece6d0d841
gitee
chongzi/Lucky-ArkTs.git
84fc104d4a68def780a483e2543ebf9f53e793fd
entry/src/main/ets/model/OfferModel.ets
arkts
Offer模型
export class OfferModel { id: number = 0; company: string = ''; // 公司名称 position: string = ''; // 职位名称 department: string = ''; // 部门 location: string = ''; // 工作地点 // 薪资信息 baseSalary: number = 0; // 基本工资(月薪,单位:元) annualSalary: number = 0; ...
AST#export_declaration#Left export AST#class_declaration#Left class OfferModel AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST...
export class OfferModel { id: number = 0; company: string = ''; position: string = ''; department: string = ''; location: string = ''; baseSalary: number = 0; annualSalary: number = 0; bonus: number = 0; st...
https://github.com/chongzi/Lucky-ArkTs.git/blob/84fc104d4a68def780a483e2543ebf9f53e793fd/entry/src/main/ets/model/OfferModel.ets#L34-L268
780fbcf0af3ae249745c3cfa2020ae2709d29941
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/TopBarItem.ets
arkts
TopBar entity class.
export class TopBarItem { id: number = 0; name: string = '全部'; }
AST#export_declaration#Left export AST#class_declaration#Left class TopBarItem AST#class_body#Left { AST#property_declaration#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0 AST#expression#Right ; AST#property_declaration#Right AST...
export class TopBarItem { id: number = 0; name: string = '全部'; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/viewmodel/TopBarItem.ets#L19-L22
c32e644185697fe309f5f50e471ac4889d4170f4
gitee
openharmony/arkui_ace_engine
30c7d1ee12fbedf0fabece54291d75897e2ad44f
examples/Overlay/entry/src/main/ets/pages/components/popup/MyComponenet.ets
arkts
MyComponent
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...
@Component export struct MyComponent { @State title: string = 'test' func: () => void = () => { } @Styles pressedStyle() { .backgroundColor(0x238E23) } @Styles normalStyle() { .backgroundColor(0x0000ff) } build() { Text(this.title) .fontSize(10) .backgroundColor(0x0000ff) ...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MyComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotati...
@Component export struct MyComponent { @State title: string = 'test' func: () => void = () => { } @Styles pressedStyle() { .backgroundColor(0x238E23) } @Styles normalStyle() { .backgroundColor(0x0000ff) } build() { Text(this.title) .fontSize(10) .backgroundColor(0x0000ff) ...
https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/popup/MyComponenet.ets#L16-L40
d9412e3506c9dbb09e2f404beb2edba56343985d
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets
arkts
MARK: - 构造
private constructor() { this.context = getAppContext() }
AST#constructor_declaration#Left private constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . context AST#...
private constructor() { this.context = getAppContext() }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/detailitem/DetailItemManager.ets#L78-L80
994f1cc6176c8239c6a9a485fcfcaaf3c50c613a
github
2763981847/Clock-Alarm.git
8949bedddb7d011021848196735f30ffe2bd1daf
entry/src/main/ets/pages/DetailPage.ets
arkts
构建页面内容
build() { Column() { // 顶部容器,包括标题和取消/保存按钮 BackContainer({ header: this.isNew ? $r('app.string.new_alarm') : $r('app.string.update_alarm'), backImgRes: $r('app.media.ic_cancel'), }) { // 保存按钮 Button() { Image($r('app.media.ic_confirm')).objectFit(ImageFit.F...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // 顶部容器,包括标题和取消/保存按钮 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left BackContainer ( AST#component_para...
build() { Column() { BackContainer({ header: this.isNew ? $r('app.string.new_alarm') : $r('app.string.update_alarm'), backImgRes: $r('app.media.ic_cancel'), }) { Button() { Image($r('app.media.ic_confirm')).objectFit(ImageFit.Fill) } .bac...
https://github.com/2763981847/Clock-Alarm.git/blob/8949bedddb7d011021848196735f30ffe2bd1daf/entry/src/main/ets/pages/DetailPage.ets#L87-L154
2e06b11e62c9fc44d31dea854a1b12d83f344004
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/function_call/library_function/string_lib_func_013_T.ets
arkts
Introduction 库函数-string_split
export function string_lib_func_013_T(taint_src : string) { let t = taint_src.split("f"); taint.Sink(t); }
AST#export_declaration#Left export AST#function_declaration#Left function string_lib_func_013_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_013_T(taint_src : string) { let t = taint_src.split("f"); taint.Sink(t); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/string_lib_func_013_T.ets#L7-L10
4d2048edb72728876094d0d9b7452b6c641d8d9e
github
HunZiLei/ArtTs_PokeAccountBook.git
3d91db931f5dd6cea3c6cd414fad7c28942a58ac
entry/src/main/ets/database/AccountTable.ets
arkts
queryMonth
格式:xxx-xx
queryMonth(date: string, callback:Function, isAll: boolean = true){ let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName); if(!isAll){ predicates.equalTo('month',date); } this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet)=>{ let c...
AST#method_declaration#Left queryMonth AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#R...
queryMonth(date: string, callback:Function, isAll: boolean = true){ let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName); if(!isAll){ predicates.equalTo('month',date); } this.accountTable.query(predicates, (resultSet: relationalStore.ResultSet)=>{ let c...
https://github.com/HunZiLei/ArtTs_PokeAccountBook.git/blob/3d91db931f5dd6cea3c6cd414fad7c28942a58ac/entry/src/main/ets/database/AccountTable.ets#L83-L119
600880f7e580ad7f2805ca450334df337989e63b
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/main/src/main/ets/navigation/CartNav.ets
arkts
CartNav
@file 购物车页面导航入口 @returns {void} 无返回值 @author Joker.X
@Builder export function CartNav(): void { CartPage(); }
AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function CartNav 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_compon...
@Builder export function CartNav(): void { CartPage(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/navigation/CartNav.ets#L8-L11
354663fea9e498f069eee771a16f1e12717432f5
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/data/PieDataSet.ets
arkts
setHighlightColor
Sets the color for the highlighted sector (null for using entry color)
public setHighlightColor( /*@Nullable*/ color: number): void { this.mHighlightColor = color; }
AST#method_declaration#Left public setHighlightColor AST#parameter_list#Left ( /*@Nullable*/ AST#parameter#Left color : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left v...
public setHighlightColor( color: number): void { this.mHighlightColor = color; }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L269-L272
6ef33b554b68cc4644c80719cbc994e24fa96210
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ExcellentCase/Healthy_life/entry/src/main/ets/model/WeekCalendarModel.ets
arkts
get previous week data @param showDate base data
export function getPreviousWeek(showDate: Date): WeekCalendarInfo { Logger.debug('WeekCalendarModel', 'get week date by date: ' + showDate.toDateString()); let weekCalendarInfo: WeekCalendarInfo = new WeekCalendarInfo(); let arr: Array<WeekDateModel> = []; let strArr: Array<string> = []; let currentDay = show...
AST#export_declaration#Left export AST#function_declaration#Left function getPreviousWeek AST#parameter_list#Left ( AST#parameter#Left showDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left...
export function getPreviousWeek(showDate: Date): WeekCalendarInfo { Logger.debug('WeekCalendarModel', 'get week date by date: ' + showDate.toDateString()); let weekCalendarInfo: WeekCalendarInfo = new WeekCalendarInfo(); let arr: Array<WeekDateModel> = []; let strArr: Array<string> = []; let currentDay = show...
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/model/WeekCalendarModel.ets#L73-L92
1b5710488d1c0619686c2472ac94427ba9bbae7e
gitee
huang7855196/ArkTs-iLearn.git
08590adaca7a58d5284416ba5cfc09117122af84
commonModule/src/main/ets/utils/HttpUtils.ets
arkts
post
POST请求
static post<T>(url: string, params?: object) { return request<T>(url, http.RequestMethod.POST, params) }
AST#method_declaration#Left static post AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ...
static post<T>(url: string, params?: object) { return request<T>(url, http.RequestMethod.POST, params) }
https://github.com/huang7855196/ArkTs-iLearn.git/blob/08590adaca7a58d5284416ba5cfc09117122af84/commonModule/src/main/ets/utils/HttpUtils.ets#L72-L74
a24c3842fdbbece9a211e89b8abb6128f7db508b
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/NotificationUtil.ets
arkts
setDefaultConfig
默认配置 设置通知的默认统一配置 @param configs
static setDefaultConfig(configs: (config: NotificationConfig) => void): void { configs(NotificationUtil.defaultConfig); }
AST#method_declaration#Left static setDefaultConfig AST#parameter_list#Left ( AST#parameter#Left configs : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left config : AST#type_annotation#Left AST#primary_type#Left NotificationConfig AST#primary_type#Right AST#type_annotation#Ri...
static setDefaultConfig(configs: (config: NotificationConfig) => void): void { configs(NotificationUtil.defaultConfig); }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L50-L52
d8e8ba38438ee42d3328fc8598d897b38b7b58e4
gitee
Rayawa/dashboard.git
9107efe7fb69a58d799a378b79ea8ffa4041cec8
entry/src/main/ets/component/index/HeaderComponent.ets
arkts
HeaderComponent
HeaderComponent.ets
@Component export struct HeaderComponent { @State lastUpdate: string = "-"; @State syncStatus: string = ""; build() { Column() { // 标题卡片 Column() { Text("华为应用市场看板 数据收集自 AppGallery api") .fontSize(20) .fontWeight(FontWei...
AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HeaderComponent AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right lastUpdate : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type...
@Component export struct HeaderComponent { @State lastUpdate: string = "-"; @State syncStatus: string = ""; build() { Column() { Column() { Text("华为应用市场看板 数据收集自 AppGallery api") .fontSize(20) .fontWeight(FontWeight.Med...
https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/component/index/HeaderComponent.ets#L2-L100
06acac174b395ac7513ac3fdc2ebf80ddfddff9f
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_utils/src/main/ets/utils/FileUtil.ets
arkts
getTempDirPath
获取临时目录下的文件夹路径或文件路径。 @param relativePath 文件路径;相对路径(download/wps/doc);传空表示根目录 @param fileName 文件名(test.text);fileName传空表示文件夹路径 @param blHap true:HAP级别文件路径、 false:App级别文件路径 @returns
static getTempDirPath(relativePath: string | undefined = undefined, fileName: string | undefined = undefined, blHap: boolean = true): string { let filePath = blHap ? AppUtil.getContext().tempDir : AppUtil.getApplicationContext().tempDir; //根目录 if (StrUtil.isNotEmpty(relativePath)) { if (StrUtil.starts...
AST#method_declaration#Left static getTempDirPath AST#parameter_list#Left ( AST#parameter#Left relativePath : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right = AST#exp...
static getTempDirPath(relativePath: string | undefined = undefined, fileName: string | undefined = undefined, blHap: boolean = true): string { let filePath = blHap ? AppUtil.getContext().tempDir : AppUtil.getApplicationContext().tempDir; if (StrUtil.isNotEmpty(relativePath)) { if (StrUtil.startsWith(...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FileUtil.ets#L94-L111
ca28e66d0f7d8e63e5a280d7af5e50d695e1c55a
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
eftool/src/main/ets/core/media/ImgPreviewUtil.ets
arkts
ImgPreviewUtil
@TODO 图片预览工具类 @Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Feftool
@Preview @CustomDialog @Component export struct ImgPreviewUtil { defController: CustomDialogController @State imgWidth: number = 300 //图片宽度 @State beis: number = 1 //缩放倍数 @State url: ResourceStr = '' //图片url @State showPopup: boolean = false //控制保存按钮显示 @State filePath: string = '' //下载路径 沙箱路径 // 设置安全控件按钮...
AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ CustomDialog AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct ImgPreviewUtil AST#component_body#Left { AST#property_declaration#Left defController : AST#type_annotation#Left AS...
@Preview @CustomDialog @Component export struct ImgPreviewUtil { defController: CustomDialogController @State imgWidth: number = 300 @State beis: number = 1 @State url: ResourceStr = '' @State showPopup: boolean = false @State filePath: string = '' @State saveButtonOptions: SaveButtonOptions = { ...
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/core/media/ImgPreviewUtil.ets#L26-L49
2099b155327ffc527415cd5a6d0adf6f730283b0
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/AudioManagerModel.ets
arkts
setSpeaker
设置是否打开扬声器
async setSpeaker(speaker: boolean): Promise<void> { Logger.info(TAG,`setSpeaker ${speaker}`); try { if (!this.mAudioRoutingManager) { return; } await this.mAudioRoutingManager.setCommunicationDevice(audio.CommunicationDeviceType.SPEAKER, speaker); Logger.info(TAG,` setSpeaker s...
AST#method_declaration#Left async setSpeaker AST#parameter_list#Left ( AST#parameter#Left speaker : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Lef...
async setSpeaker(speaker: boolean): Promise<void> { Logger.info(TAG,`setSpeaker ${speaker}`); try { if (!this.mAudioRoutingManager) { return; } await this.mAudioRoutingManager.setCommunicationDevice(audio.CommunicationDeviceType.SPEAKER, speaker); Logger.info(TAG,` setSpeaker s...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Media/VoiceCallDemo/entry/src/main/ets/model/AudioManagerModel.ets#L83-L95
67c488d8b37873f37c96d2a5bf55fda9e2209b65
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/List/entry/src/main/ets/common/CommonConstants.ets
arkts
width or height
export const ICON_WIDTH: number = 40;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left ICON_WIDTH : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 40 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#R...
export const ICON_WIDTH: number = 40;
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L35-L35
963a8cbd5e4e29094e7ce9a7e837c447485836b2
gitee
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_rcp/src/main/ets/rcp/EfRcp.ets
arkts
addCodeEvent
添加系统和自定义编码拦截器 @param codeEvent 系统和业务自定义编码监听事件 efRcpConfig.codeEvent @returns
addCodeEvent(codeEvent: efRcpConfig.codeEvent): EfRcp { if (this.cfg.interceptors) { this.cfg.interceptors.push(new EfCodeInterceptor(codeEvent)); } else { this.cfg.interceptors = [new EfCodeInterceptor(codeEvent)]; } return this; }
AST#method_declaration#Left addCodeEvent AST#parameter_list#Left ( AST#parameter#Left codeEvent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left efRcpConfig . codeEvent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#...
addCodeEvent(codeEvent: efRcpConfig.codeEvent): EfRcp { if (this.cfg.interceptors) { this.cfg.interceptors.push(new EfCodeInterceptor(codeEvent)); } else { this.cfg.interceptors = [new EfCodeInterceptor(codeEvent)]; } return this; }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcp.ets#L250-L257
2790fa9abc61ddff6d336fd68741e9c7c3409456
gitee
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/VideoConstants.ets
arkts
Data of video.
export const VIDEO_DATA: VideoItem[] = [ { id: '1', src: $rawfile('video1.mp4'), likesCount: 0, isLikes: false, comment: 102, shareTimes: 666 }, { id: '2', src: $rawfile('video2.mp4'), likesCount: 8654, isLikes: true, comment: 0, shareTimes: 0 } ];
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left VIDEO_DATA : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left VideoItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#expre...
export const VIDEO_DATA: VideoItem[] = [ { id: '1', src: $rawfile('video1.mp4'), likesCount: 0, isLikes: false, comment: 102, shareTimes: 666 }, { id: '2', src: $rawfile('video2.mp4'), likesCount: 8654, isLikes: true, comment: 0, shareTimes: 0 } ];
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SwiperArkTS/entry/src/main/ets/common/constants/VideoConstants.ets#L21-L38
48baf3dd4c68301923a132a05304f20ec5fa78eb
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/recommendation/RecommendationEngine.ets
arkts
推荐上下文接口
export interface RecommendationContext { userId: string; contactId?: string; occasion: string; // 场合 (birthday, anniversary, etc.) relationship: string; // 关系类型 age: number; gender?: string; interests: string[]; budget?: number; location?: string; weather?: string; timeOfDay: str...
AST#export_declaration#Left export AST#interface_declaration#Left interface RecommendationContext AST#object_type#Left { AST#type_member#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left contactId ? : AST#typ...
export interface RecommendationContext { userId: string; contactId?: string; occasion: string; relationship: string; age: number; gender?: string; interests: string[]; budget?: number; location?: string; weather?: string; timeOfDay: string; season: string; culturalBackgroun...
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/recommendation/RecommendationEngine.ets#L49-L64
450476051507e8b50c463424ec2ef3e64b890b76
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets
arkts
线条宽度
build() { Column() { TitleBar({ title: $r('app.string.System_icon') }) Stack() { // 亮度条件组件 Stack() { Slider({ value: this.sliderValue, style: SliderStyle.NONE, direction: Axis.Vertical, reverse: true }) .id('...
AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left TitleBar ( AST#component_parameters#Left { AST#componen...
build() { Column() { TitleBar({ title: $r('app.string.System_icon') }) Stack() { Stack() { Slider({ value: this.sliderValue, style: SliderStyle.NONE, direction: Axis.Vertical, reverse: true }) .id('systemIco...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ArkTsComponentCollection/ComponentCollection/entry/src/main/ets/pages/animations/TransitionAnimations/systemIcon/SystemIcon.ets#L33-L97
0ac15d72271bb25ba15445a2761e3c5b50b65456
gitee
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/control_flow/conditional_stmt/conditional_if_005_T.ets
arkts
Introduction 条件语句-else if
export function conditional_if_005_T(taint_src : string) { if (false) {} else if(true){ taint.Sink(taint_src) } else {} }
AST#export_declaration#Left export AST#function_declaration#Left function conditional_if_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_statemen...
export function conditional_if_005_T(taint_src : string) { if (false) {} else if(true){ taint.Sink(taint_src) } else {} }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/control_flow/conditional_stmt/conditional_if_005_T.ets#L6-L12
2aab1da58cc3c0cc9aa4ae711fb9e964db18b60a
github
salehelper/algorithm_arkts.git
61af15272038646775a4745fca98a48ba89e1f4e
entry/src/main/ets/ciphers/HillCipher.ets
arkts
希尔密码实现 希尔密码是一种基于矩阵乘法的多字母替换密码
export class HillCipher { private static readonly MOD = 26; private static readonly ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; /** * 计算矩阵的行列式 * @param matrix 2x2矩阵 * @returns 行列式的值 */ private static determinant(matrix: number[][]): number { return (matrix[0][0] * matrix[1][1] - matrix[0][1] * mat...
AST#export_declaration#Left export AST#class_declaration#Left class HillCipher AST#class_body#Left { AST#property_declaration#Left private static readonly MOD = AST#expression#Left 26 AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left private static readonly ALPHABET = AST#expression#Le...
export class HillCipher { private static readonly MOD = 26; private static readonly ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; private static determinant(matrix: number[][]): number { return (matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0]) % HillCipher.MOD; } private static modInverse(a: ...
https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/HillCipher.ets#L5-L171
fdc20147174f61d0a3d443848a916cd4c5b11da6
github
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
feature/order/src/main/ets/view/OrderCommentPage.ets
arkts
OrderCommentPage
@file 订单评论页面视图 @author Joker.X
@ComponentV2 export struct OrderCommentPage { /** * 订单评论页面 ViewModel */ @Local private vm: OrderCommentViewModel = new OrderCommentViewModel(); /** * 当前窗口安全区状态 */ @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); /** * 构建订单评论页面 * @returns {void} 无返回值 ...
AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct OrderCommentPage AST#component_body#Left { /** * 订单评论页面 ViewModel */ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Ord...
@ComponentV2 export struct OrderCommentPage { @Local private vm: OrderCommentViewModel = new OrderCommentViewModel(); @Local private windowSafeAreaState: WindowSafeAreaState = getWindowSafeAreaState(); build() { AppNavDestination({ title: $r("app.string.order_comment"), viewModel: th...
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderCommentPage.ets#L25-L183
835a53c1ed3368f589d2d0eb431d4c465baca838
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets
arkts
showBigIntInfo
打印bigint信息
function showBigIntInfo(bnName: string, bnValue: bigint | string | number) { if (typeof bnValue === 'string') { console.error('type is string'); return; } if (typeof bnValue === 'number') { console.error('type is number'); return; } console.info(bnName + ':'); console.info('. Decimal: ' + bn...
AST#function_declaration#Left function showBigIntInfo AST#parameter_list#Left ( AST#parameter#Left bnName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left bnValue : AST#type_annotation#Left AST#union_type#Left AST#primary_t...
function showBigIntInfo(bnName: string, bnValue: bigint | string | number) { if (typeof bnValue === 'string') { console.error('type is string'); return; } if (typeof bnValue === 'number') { console.error('type is number'); return; } console.info(bnName + ':'); console.info('. Decimal: ' + bn...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/KeyGenerationConversion/SpecifiedParametersGenerateAsymmetricKeyPair/entry/src/main/ets/pages/ecc/Promise.ets#L21-L34
59dbb48a85af69b1743f4a816f4e5063c7080b0f
gitee
didi/dimina.git
7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2
harmony/dimina/src/main/ets/Utils/DMPStack.ets
arkts
push
添加元素到栈顶
push(item: T): void { this._items.push(item); }
AST#method_declaration#Left push AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T 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#Right AST#type_anno...
push(item: T): void { this._items.push(item); }
https://github.com/didi/dimina.git/blob/7ad9d89af58cd54e624b2e3d3eb14801cc8e05d2/harmony/dimina/src/main/ets/Utils/DMPStack.ets#L9-L11
92b6c7ffdc51be0a18b61a276e3ccddb40734fce
github
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/processes/zone_actions.ets
arkts
Deletes an offline zone. @param alias The alias of the Zone / window. @returns True if success, false otherwise (Zone is online?)
export function del_offline_zone(alias: string) { let zones = AppStorage.get('zones') as string[]; let idx = zones.indexOf(alias); let zones_opened = AppStorage.get('zones_opened') as boolean[]; if (zones_opened[idx]) { return false; } sandbox_rmdir_sync('zones/' + alias); refresh_AppStorage_zones(); ...
AST#export_declaration#Left export AST#function_declaration#Left function del_offline_zone AST#parameter_list#Left ( AST#parameter#Left alias : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left {...
export function del_offline_zone(alias: string) { let zones = AppStorage.get('zones') as string[]; let idx = zones.indexOf(alias); let zones_opened = AppStorage.get('zones_opened') as boolean[]; if (zones_opened[idx]) { return false; } sandbox_rmdir_sync('zones/' + alias); refresh_AppStorage_zones(); ...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/processes/zone_actions.ets#L196-L206
af43ad4c904db980a29fd9d21c84cbc92e3278e1
gitee
RedRackham-R/WanAndroidHarmoney.git
0bb2a7c8d7b49194a96e42a380d43b7e106cdb22
entry/src/main/ets/utils/ByteConverter.ets
arkts
convertBytes
byte转换文本
static convertBytes(bytes: number): string { const units = ['Byte', 'KB', 'MB', 'GB', 'TB'] let unitIndex = 0 while (bytes >= 1024 && unitIndex < units.length - 1) { bytes /= 1024 unitIndex++ } return `${bytes.toFixed(2)} ${units[unitIndex]}` }
AST#method_declaration#Left static convertBytes AST#parameter_list#Left ( AST#parameter#Left bytes : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t...
static convertBytes(bytes: number): string { const units = ['Byte', 'KB', 'MB', 'GB', 'TB'] let unitIndex = 0 while (bytes >= 1024 && unitIndex < units.length - 1) { bytes /= 1024 unitIndex++ } return `${bytes.toFixed(2)} ${units[unitIndex]}` }
https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/utils/ByteConverter.ets#L3-L13
4dea937deaf9532d33c51f39241050b81ae944a8
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/utils/strings/StringPyHelper.ets
arkts
pinyinToneCount
/返回当前字符串中含有的声调的个数,用于Debug时检查sentencePy数据
static pinyinToneCount(str: string): number { // 去除前后空白并转换为拼音形式 const s = StringPyHelper.convertUnicodeForPinyin(str.trim()); if (!s) return 0; // 空字符串视为没有声调 // 初始化一个声调计数器 let toneCount = 0; // 声调符号对应的Unicode值 const toneMarks = new Set([0x0304, 0x0301, 0x030c, 0x0300]); // 对应声调符号1,2,3,4 ...
AST#method_declaration#Left static pinyinToneCount AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_...
static pinyinToneCount(str: string): number { const s = StringPyHelper.convertUnicodeForPinyin(str.trim()); if (!s) return 0; let toneCount = 0; const toneMarks = new Set([0x0304, 0x0301, 0x030c, 0x0300]); for (let i = 0; i < s.length; i++) { const code = s.charCodeAt(...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/strings/StringPyHelper.ets#L54-L74
b0538a9c9e9c56fffe71d9a5783c4aab3ea34067
github
fmtjava/Ohs_ArkTs_Eyepetizer.git
79578f394ccb926da1455e63b7fe0722df9b9a22
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
getData
获取指定索引的数据 判断索引是否合法,如果非法就返回null
getData(index: number) { return index >= 0 && index < this.totalCount() ? this.dataSource[index] : null; }
AST#method_declaration#Left getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AS...
getData(index: number) { return index >= 0 && index < this.totalCount() ? this.dataSource[index] : null; }
https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L23-L26
51de0f0b07c62182d5d2bffb93612c796445a587
github
openharmony/codelabs
d899f32a52b2ae0dfdbb86e34e8d94645b5d4090
ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets
arkts
Get Module List Data in Flex
export function getFlexModuleList(): Array<ContainerModuleItem> { let flexModuleArray: Array<ContainerModuleItem> = [] FLEX_MODULE.forEach((item: ContainerModuleItem) => { flexModuleArray.push(item); }) return flexModuleArray; }
AST#export_declaration#Left export AST#function_declaration#Left function getFlexModuleList AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left ContainerModuleItem AST#p...
export function getFlexModuleList(): Array<ContainerModuleItem> { let flexModuleArray: Array<ContainerModuleItem> = [] FLEX_MODULE.forEach((item: ContainerModuleItem) => { flexModuleArray.push(item); }) return flexModuleArray; }
https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/OHLayoutAlign/entry/src/main/ets/viewmodel/AttributeModuleData.ets#L22-L28
8010e2cfba424d06a15f227172670ad8a3091ac6
gitee
Joker-x-dev/CoolMallArkTS.git
9f3fabf89fb277692cb82daf734c220c7282919c
core/data/src/main/ets/repository/CustomerServiceRepository.ets
arkts
getSessionDetail
获取会话详情 @returns 会话详情
async getSessionDetail(): Promise<NetworkResponse<CsSession>> { return this.networkDataSource.getSessionDetail(); }
AST#method_declaration#Left async getSessionDetail AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left NetworkResponse AST#type_arguments#Left < ...
async getSessionDetail(): Promise<NetworkResponse<CsSession>> { return this.networkDataSource.getSessionDetail(); }
https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/CustomerServiceRepository.ets#L34-L36
125f7e8bc5e342ee885c92751c2b5da28468132b
github
Application-Security-Automation/Arktan.git
3ad9cb05235e38b00cd5828476aa59a345afa1c0
dataset/completeness/expression/lambda_expression/lambda_expression_002_F.ets
arkts
Introduction lambda表达式
export function lambda_expression_002_F(taint_src : string) { let _t = taint_src; let lambda2 = (a:string) => a; let clean = lambda2("_"); taint.Sink(clean); }
AST#export_declaration#Left export AST#function_declaration#Left function lambda_expression_002_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#block_state...
export function lambda_expression_002_F(taint_src : string) { let _t = taint_src; let lambda2 = (a:string) => a; let clean = lambda2("_"); taint.Sink(clean); }
https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/expression/lambda_expression/lambda_expression_002_F.ets#L6-L11
61290126e2f0734018ac305b79cdfd65dce7c174
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_speech/src/main/ets/TextReaderHelper.ets
arkts
setArticleContent
设置文章内容。 @param id 文章id @param content 文章内容,content不传或者为空时,播放指定id的文章时,控件内容页显示加载失败;传参时,将指定id文章的内容设置为content
static setArticleContent(id: string, content: string): boolean { try { TextReader.setArticleContent(id, content); return true; } catch (e) { console.error(`TextReader failed to setArticleContent. Code: ${e.code}, message: ${e.message}`); return false; } }
AST#method_declaration#Left static setArticleContent AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#prima...
static setArticleContent(id: string, content: string): boolean { try { TextReader.setArticleContent(id, content); return true; } catch (e) { console.error(`TextReader failed to setArticleContent. Code: ${e.code}, message: ${e.message}`); return false; } }
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/TextReaderHelper.ets#L195-L203
5f0bcc0a97449281a9099cb1d59f0c693ae838ba
gitee
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets
arkts
reqPermissionsFromUser
TODO 知识点: 获取蓝牙相关权限
function reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(context, permissions).then((data) => { const granStatus: Array<number> = data.authRe...
AST#function_declaration#Left function reqPermissionsFromUser AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotat...
function reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(context, permissions).then((data) => { const granStatus: Array<number> = data.authRe...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/bluetooth/src/main/ets/pages/BluetoothClient.ets#L43-L56
558a22d2954e9f8c7b8ab668a3a93429b39ad9fd
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets
arkts
loadData
加载帖子数据 @param refresh 是否刷新(true为下拉刷新,false为加载更多)
async loadData(refresh: boolean = false) { // 移除对isLoading的检查,确保初始加载时能执行 // if (this.isLoading) return; try { this.isLoading = true; if (refresh) { this.isRefreshing = true; this.currentPage = 0; } else { this.isLoadingMore = true; } console....
AST#method_declaration#Left async loadData AST#parameter_list#Left ( AST#parameter#Left refresh : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#parameter#Righ...
async loadData(refresh: boolean = false) { try { this.isLoading = true; if (refresh) { this.isRefreshing = true; this.currentPage = 0; } else { this.isLoadingMore = true; } console.info(`加载用户动态: userId=${this.userId}, page=${this.currentPag...
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/UserPostsPage.ets#L79-L118
7ba2a7de72a4dc6c208dfcd0488cb65b0ac6e779
github
ThePivotPoint/ArkTS-LSP-Server-Plugin.git
6231773905435f000d00d94b26504433082ba40b
packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets
arkts
Enum for DownloadDescription @enum { number } @syscap SystemCapability.ArkUI.ArkUI.Full @crossplatform @atomicservice @since 12
export declare enum DownloadDescription { /** * Description is DOWNLOAD. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ DOWNLOAD = 1, /** * Description is DOWNLOAD_FILE. * * @syscap SystemCapability.ArkUI.ArkUI...
AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum DownloadDescription AST#enum_body#Left { /** * Description is DOWNLOAD. * * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice * @since 12 */ AST#enum_memb...
export declare enum DownloadDescription { DOWNLOAD = 1, DOWNLOAD_FILE = 2, SAVE = 3, SAVE_IMAGE = 4, SAVE_FILE = 5, DOWNLOAD_AND_SHARE = 6, RECEIVE = 7, CONTINUE_TO_RECEIVE = 8 }
https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets#L57-L130
611041dbe2ebf091de274b6a2a67f79cfb46fa3a
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/Alarm/AlarmManager.ets
arkts
get
获取单例
static get shared(): AlarmManager { if (!AlarmManager.instance) { AlarmManager.instance = new AlarmManager(getAppContext() as common.UIAbilityContext); } return AlarmManager.instance; }
AST#method_declaration#Left static get AST#ERROR#Left shared AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AlarmManager AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#L...
static get shared(): AlarmManager { if (!AlarmManager.instance) { AlarmManager.instance = new AlarmManager(getAppContext() as common.UIAbilityContext); } return AlarmManager.instance; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Alarm/AlarmManager.ets#L23-L28
3ea60045c1b931a1d3cdc8fac4e3d9c2d6cf9c82
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets
arkts
pixelMapBuilder
拖拽过程中展示的样式
@Builder pixelMapBuilder() { IconWithNameView({ app: this.movedItem }) .width($r('app.string.grid_exchange_builder_width')) }
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right pixelMapBuilder 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 IconWithNameView ( AST#component_parameters#Left { AST#com...
@Builder pixelMapBuilder() { IconWithNameView({ app: this.movedItem }) .width($r('app.string.grid_exchange_builder_width')) }
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L73-L77
a320b857a64b9238ccc697a7bc2116bddd7b07ab
gitee
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/views/card/detail/DetailCardsView.ets
arkts
buildMenuItems
=== 导航菜单 ===
buildMenuItems(): CustomNavigationMenuItem[] { return [ {value: "trash", icon: $r('app.media.trash'), isSvg: true, action: () => { this.actionTrash() } }, {value: "search", icon: $r('app.media.search'), isSvg: true, action: () => { this.actionSearch() } }, {value: "m...
AST#method_declaration#Left buildMenuItems AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left CustomNavigationMenuItem [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return...
buildMenuItems(): CustomNavigationMenuItem[] { return [ {value: "trash", icon: $r('app.media.trash'), isSvg: true, action: () => { this.actionTrash() } }, {value: "search", icon: $r('app.media.search'), isSvg: true, action: () => { this.actionSearch() } }, {value: "m...
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/card/detail/DetailCardsView.ets#L184-L199
09bcee6ab3c6177e86f457887f1d85e8c1d43511
github
BohanSu/LumosAgent-HarmonyOS.git
9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76
entry/src/main/ets/common/RdbHelper.ets
arkts
getChatLogsForDate
Get chat logs for a specific date @param date - Date string in YYYY-MM-DD format @returns Array of ChatLog objects
async getChatLogsForDate(date: string): Promise<ChatLog[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_CHAT_LOGS); predicates.equalTo('date', date); predicates.orderByAsc('timestamp'); try { ...
AST#method_declaration#Left async getChatLogsForDate AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type...
async getChatLogsForDate(date: string): Promise<ChatLog[]> { if (!this.rdbStore) { throw new Error('Database not initialized'); } const predicates = new relationalStore.RdbPredicates(Constants.TABLE_CHAT_LOGS); predicates.equalTo('date', date); predicates.orderByAsc('timestamp'); try { ...
https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/common/RdbHelper.ets#L676-L709
5adf083568d46b900f4c93258b0756cc1e2fbdc3
github
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/Media/Audio/entry/src/main/ets/pages/Karaoke.ets
arkts
enableLoopback
Enable audio loopback
async enableLoopback() { if (this.audioLoopback !== undefined) { try { let status = await this.audioLoopback.getStatus(); if (status == audio.AudioLoopbackStatus.AVAILABLE_IDLE) { this.audioLoopback.on('statusChange', this.statusChangeCallback); let success = await this.aud...
AST#method_declaration#Left async enableLoopback 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#expression#Right . aud...
async enableLoopback() { if (this.audioLoopback !== undefined) { try { let status = await this.audioLoopback.getStatus(); if (status == audio.AudioLoopbackStatus.AVAILABLE_IDLE) { this.audioLoopback.on('statusChange', this.statusChangeCallback); let success = await this.aud...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Audio/entry/src/main/ets/pages/Karaoke.ets#L81-L104
d9258b695412f5ac09d055fe1461106df267da8c
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
getBuilder
通过名称获取builder
public static getBuilder(builderName: string): WrappedBuilder<[object]>{ let builder = RouterModule.builderMap.get(builderName); return builder as WrappedBuilder<[object]>; }
AST#method_declaration#Left public static getBuilder AST#parameter_list#Left ( AST#parameter#Left builderName : 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#gener...
public static getBuilder(builderName: string): WrappedBuilder<[object]>{ let builder = RouterModule.builderMap.get(builderName); return builder as WrappedBuilder<[object]>; }
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L25-L28
794240a1e11252b42778ad05d8130188cf726b84
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets
arkts
sortData
数组按照指定的规则排序
public sortData(compareFn: (a: T, b: T) => number): void { this.originDataArray.sort(compareFn); this.notifyDataReload(); }
AST#method_declaration#Left public sortData AST#parameter_list#Left ( AST#parameter#Left compareFn : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AS...
public sortData(compareFn: (a: T, b: T) => number): void { this.originDataArray.sort(compareFn); this.notifyDataReload(); }
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L95-L98
8c84c5c698252d17501b7c8575aeb7dc403760ff
github
openharmony/developtools_profiler
73d26bb5acfcafb2b1f4f94ead5640241d1e5f73
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets
arkts
animateY
Animates values along the Y axis, in a linear fashion. @param durationMillis animation duration
public animateY(durationMillis: number) { this.animateY(durationMillis, Easing.Linear); }
AST#method_declaration#Left public animateY AST#parameter_list#Left ( AST#parameter#Left durationMillis : 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#builder_function_body#Left { AST#expression_statement#Left A...
public animateY(durationMillis: number) { this.animateY(durationMillis, Easing.Linear); }
https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets#L129-L131
3a79c65f7bf3a7b35ac15f8600b28037e286f554
gitee
longchenxu123/HongmengDemoPandaCommunity.git
331aee32e89ac94764e63aa6d0c8c458201b7df8
entry/src/main/ets/pages/welcomeIndex.ets
arkts
aboutToAppear
是否进行自动登录
async aboutToAppear() { ;(async () => { this.autoLogin = await preferencesUtil.getPreferenceValue('MyLongchenxuOne', 'autoLogin', false) as boolean; if (this.autoLogin) { router.replaceUrl({ url:"pages/appHomeIndex" }) } })() }
AST#method_declaration#Left async aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ERROR#Left ; AST#ERROR#Right AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#expression#Left AS...
async aboutToAppear() { ;(async () => { this.autoLogin = await preferencesUtil.getPreferenceValue('MyLongchenxuOne', 'autoLogin', false) as boolean; if (this.autoLogin) { router.replaceUrl({ url:"pages/appHomeIndex" }) } })() }
https://github.com/longchenxu123/HongmengDemoPandaCommunity.git/blob/331aee32e89ac94764e63aa6d0c8c458201b7df8/entry/src/main/ets/pages/welcomeIndex.ets#L15-L24
94aa3502e934a15fb5494356ef4d3d5f020dda6c
github
yunkss/ef-tool
75f6761a0f2805d97183504745bf23c975ae514d
ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDH.ets
arkts
@Author csx @DateTime 2024/3/20 20:21 @TODO ECDH 动态协商共享密钥
export class ECDH { /** * ecdh动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @returns ECC256共享密钥 */ static async ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<OutDTO<string>>...
AST#export_declaration#Left export AST#class_declaration#Left class ECDH AST#class_body#Left { /** * ecdh动态协商密钥,要求密钥长度为256位的非对称密钥 * @param pubKey 符合256位的非对称密钥的公钥字符串或Uint8Array字节流 【一般为外部传入】 * @param priKey 符合256位的非对称密钥的私钥字符串或Uint8Array字节流 【一般为本项目】 * @returns ECC256共享密钥 */ AST#method_declaration#Left s...
export class ECDH { static async ecdh(pubKey: string | Uint8Array, priKey: string | Uint8Array): Promise<OutDTO<string>> { return DynamicUtil.dynamicKey(pubKey, priKey, 'ECC256', 256); } }
https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/keyAgree/ECDH.ets#L25-L35
f7c73626571e63ccf4b02683ef2841c2b2b8ed03
gitee
openharmony/communication_wifi
387ba7fa8f98578629a6148635a4d630b2b99aa1
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets
arkts
putObjData
同步保存原始数据
putObjData(key, value) { LogUtil.info('putObjData key == ' + key + ' value == ' + value); mPreferences.putSync(key, value); mPreferences.flush(); }
AST#method_declaration#Left putObjData AST#parameter_list#Left ( AST#parameter#Left key AST#parameter#Right , AST#parameter#Left value AST#parameter#Right ) 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...
putObjData(key, value) { LogUtil.info('putObjData key == ' + key + ' value == ' + value); mPreferences.putSync(key, value); mPreferences.flush(); }
https://github.com/openharmony/communication_wifi/blob/387ba7fa8f98578629a6148635a4d630b2b99aa1/wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets#L51-L55
26bc49c1525e34daf707342c316a073665d33f53
gitee
zqaini002/YaoYaoLingXian.git
5095b12cbeea524a87c42d0824b1702978843d39
YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets
arkts
获取用户所有梦想列表 @param userId 用户ID @returns 梦想列表
export function getDreamsByUserId(userId: number): Promise<Dream[]> { return request<Dream[]>(RequestMethod.GET, `dreams/user/${userId}`, EmptyParams); }
AST#export_declaration#Left export AST#function_declaration#Left function getDreamsByUserId AST#parameter_list#Left ( AST#parameter#Left userId : 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#Le...
export function getDreamsByUserId(userId: number): Promise<Dream[]> { return request<Dream[]>(RequestMethod.GET, `dreams/user/${userId}`, EmptyParams); }
https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L425-L427
2456ed730ff62513b08215ab6e8e5966fec53e51
github
KoStudio/ArkTS-WordTree.git
78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324
entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets
arkts
setTotalInterval
设置总时长(毫秒)
setTotalInterval(intervalMs: number): void { this.totalMs = Math.max(0, intervalMs); this.remainMs = this.totalMs; }
AST#method_declaration#Left setTotalInterval AST#parameter_list#Left ( AST#parameter#Left intervalMs : 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_t...
setTotalInterval(intervalMs: number): void { this.totalMs = Math.max(0, intervalMs); this.remainMs = this.totalMs; }
https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/SimperTimerCountDown.ets#L16-L19
4f51e74941f026f99543f8110d12a23ed0a2abcd
github
harmonyos-cases/cases
eccdb71f1cee10fa6ff955e16c454c1b59d3ae13
CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets
arkts
translateIconWithNameView
用于位移动画的应用样式 @param data app信息,首页应用里的appName和gridItem添加管理类
@Builder translateIconWithNameView(data: TranslateItemWithNameViewMode) { Column() { this.appItemWithNameView({ app: data.app, homeAppNames: data.homeAppNames }); } // TODO:知识点:动态绑定属性信息 .attributeModifier(data.translateItemModifier.getModifier(data.app)) .width($r('app.string.grid_exchange_g...
AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right translateIconWithNameView AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TranslateItemWithNameViewMode AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_lis...
@Builder translateIconWithNameView(data: TranslateItemWithNameViewMode) { Column() { this.appItemWithNameView({ app: data.app, homeAppNames: data.homeAppNames }); } .attributeModifier(data.translateItemModifier.getModifier(data.app)) .width($r('app.string.grid_exchange_grid_item_width')) ...
https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/view/GridExchange.ets#L133-L143
6034b63e0608651dece8f8bbf37426cb317e6ff1
gitee
bigbear20240612/birthday_reminder.git
647c411a6619affd42eb5d163ff18db4b34b27ff
entry/src/main/ets/services/database/DatabaseService.ets
arkts
get
==================== 祝福历史相关操作 ==================== 获取祝福历史DAO
get greetingHistory(): GreetingHistoryDAO { this.checkInitialization(); return this.greetingHistoryDAO; }
AST#method_declaration#Left get AST#ERROR#Left greet in gHistory AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left GreetingHistoryDAO AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_statemen...
get greetingHistory(): GreetingHistoryDAO { this.checkInitialization(); return this.greetingHistoryDAO; }
https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/database/DatabaseService.ets#L204-L207
2a9eff8e95176196178465951a1291fd0592c419
github
xt1314520/IbestKnowTeach
61f0a7a3d328ad5a52de8fd699b9e1e94de0203b
entry/src/main/ets/utils/PreferencesUtil.ets
arkts
savaData
保存数据到首选项 @param preferencesName @param key @param value
static async savaData<T extends keyof number | number | string | boolean | Array<number> | Array<string> | Array<boolean>>(preferencesName: string, key: string, value: T) { const pre = preferences.getPreferencesSync(getContext(), { name: preferencesName }) pre.putSync(key, value as preferences.ValueType) ...
AST#method_declaration#Left static async savaData AST#type_parameters#Left < AST#type_parameter#Left T extends AST#ERROR#Left keyof AST#ERROR#Right AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Le...
static async savaData<T extends keyof number | number | string | boolean | Array<number> | Array<string> | Array<boolean>>(preferencesName: string, key: string, value: T) { const pre = preferences.getPreferencesSync(getContext(), { name: preferencesName }) pre.putSync(key, value as preferences.ValueType) ...
https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/utils/PreferencesUtil.ets#L10-L15
fa261bea939ec4db0b8efd04c308da9688680dae
gitee
awa_Liny/LinysBrowser_NEXT
a5cd96a9aa8114cae4972937f94a8967e55d4a10
home/src/main/ets/hosts/bunch_of_search_engines.ets
arkts
set_global_SE
Sets the global SE. @param idx The index of SE.
static set_global_SE(idx: number) { if (idx == -99) { // Setting index to -99 then the real value // Can force refresh @Watch // And the index -99 has no meaning return; } AppStorage.setOrCreate('search_engine_selected', idx); if (idx <= -1) { // If set back to default ...
AST#method_declaration#Left static set_global_SE AST#parameter_list#Left ( AST#parameter#Left idx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if...
static set_global_SE(idx: number) { if (idx == -99) { return; } AppStorage.setOrCreate('search_engine_selected', idx); if (idx <= -1) { AppStorage.setOrCreate('search_engine', default_search_engine()); } else { AppStorage.setOrCreate('search_engine', bun...
https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_search_engines.ets#L18-L33
b92a8e2b0ee39cefc363dae766a260906ef2f9dc
gitee
openharmony/applications_app_samples
a826ab0e75fe51d028c1c5af58188e908736b53b
code/UI/ExpandTitle/entry/src/main/ets/constants/Constants.ets
arkts
通用常量
export default class Constants { // 扩展后标题继续下拉阈值 public static readonly CONTINUE_PULL_THRESHOLD: number = 90; // 图标下拉的最大距离 public static readonly MENU_DOWN_Y_MAX_VALUE: number = 20; // 标题下拉的最大距离 public static readonly TITLE_DOWN_Y_MAX_VALUE: number = 30; // 标题缩放的最大值 public static readonly TITLE_SCALE_MAX...
AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { // 扩展后标题继续下拉阈值 AST#property_declaration#Left public static readonly CONTINUE_PULL_THRESHOLD : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expressio...
export default class Constants { public static readonly CONTINUE_PULL_THRESHOLD: number = 90; public static readonly MENU_DOWN_Y_MAX_VALUE: number = 20; public static readonly TITLE_DOWN_Y_MAX_VALUE: number = 30; public static readonly TITLE_SCALE_MAX_VALUE: number = 1.2; public static readonly...
https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ExpandTitle/entry/src/main/ets/constants/Constants.ets#L19-L66
6f4e3eead75bbdad706973ad7b889f2039253684
gitee
L1rics06/arkTS-.git
991fd131bfdb11e2933152133c97453d86092ac0
entry/src/main/ets/pages/NetworkUtil.ets
arkts
自定义FormData实现 网络请求工具类
export class NetworkUtil { // 设置认证Token static setAuthToken(token: string): void { authToken = token; } // 获取认证头 static getAuthHeader(): AuthHeader | Record<string, never> { return authToken ? { Authorization: `Bearer ${authToken}` } : {}; } // 合并请求头 static mergeHeaders(contentType: string): Re...
AST#export_declaration#Left export AST#class_declaration#Left class NetworkUtil AST#class_body#Left { // 设置认证Token AST#method_declaration#Left static setAuthToken AST#parameter_list#Left ( AST#parameter#Left token : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right A...
export class NetworkUtil { static setAuthToken(token: string): void { authToken = token; } static getAuthHeader(): AuthHeader | Record<string, never> { return authToken ? { Authorization: `Bearer ${authToken}` } : {}; } static mergeHeaders(contentType: string): Record<string, string> { c...
https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L241-L558
92b115009fab09c271d7b7b325d957acfcd26ee8
github
tongyuyan/harmony-utils
697472f011a43e783eeefaa28ef9d713c4171726
harmony_web/src/main/ets/utils/DialogUtils.ets
arkts
initDialogButton
多个按钮,初始化参数 @param options
private static initDialogButton(options: OptionDialogOptions, input: boolean = false) { if (!options.buttons) { options.buttons = [DialogUtils.defaultConfig.primaryButton, DialogUtils.defaultConfig.secondaryButton] } if (options.buttons && options.buttons.length > 0) { let buttons = new Array<Bu...
AST#method_declaration#Left private static initDialogButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left OptionDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left input : AST#type_annotation#Left AST#primary_typ...
private static initDialogButton(options: OptionDialogOptions, input: boolean = false) { if (!options.buttons) { options.buttons = [DialogUtils.defaultConfig.primaryButton, DialogUtils.defaultConfig.secondaryButton] } if (options.buttons && options.buttons.length > 0) { let buttons = new Array<Bu...
https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DialogUtils.ets#L323-L357
2606018bc156ee764ef72f44a32b56cf8cb39a0e
gitee
Piagari/arkts_example.git
a63b868eaa2a50dc480d487b84c4650cc6a40fc8
hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets
arkts
argb
export const EXPENSE_BAR_INIT_COLOR: number = 0x8094b982;
AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left EXPENSE_BAR_INIT_COLOR : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x8094b982 AST#expression#Right AST#variable_declarator#Right ; AST#va...
export const EXPENSE_BAR_INIT_COLOR: number = 0x8094b982;
https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/features/statistics/src/main/ets/commons/Constants.ets#L12-L12
3a70e02d6415e17332ed4bb8b20a5c81ebc562d0
github
openharmony-tpc/ohos_mpchart
4fb43a7137320ef2fee2634598f53d93975dfb4a
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setCenterTextSize
Sets the size of the center text of the PieChart in vp. @param sizeDp
public setCenterTextSize(sizeDp: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintCenterText().setTextSize( Utils.handleDataValues(sizeDp)); }
AST#method_declaration#Left public setCenterTextSize AST#parameter_list#Left ( AST#parameter#Left sizeDp : 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#prima...
public setCenterTextSize(sizeDp: number): void { ( this.mRenderer as PieChartRenderer).getPaintCenterText().setTextSize( Utils.handleDataValues(sizeDp)); }
https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L571-L575
cdf20b0e3d5a21e1d74ca84981f8c663b4f98f3c
gitee