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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ComponentReuse/entry/src/main/ets/view/UpdaterComponent.ets | arkts | UpdaterComponent | [StartExclude opt_updater] | @Component
export struct UpdaterComponent {
private colorData: ColorData = new ColorData(this.getUIContext().getHostContext());
private readonly LIST_CACHE_COUNT: number = 5;
private readonly LIST_SPACE: number = 18;
aboutToAppear(): void {
this.colorData.getColorData();
}
build() {
Column() {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct UpdaterComponent AST#component_body#Left { AST#property_declaration#Left private colorData : AST#type_annotation#Left AST#primary_type#Left ColorData AST#primary_type#Right AST#type_annotation#Right = AST#expression#L... | @Component
export struct UpdaterComponent {
private colorData: ColorData = new ColorData(this.getUIContext().getHostContext());
private readonly LIST_CACHE_COUNT: number = 5;
private readonly LIST_SPACE: number = 18;
aboutToAppear(): void {
this.colorData.getColorData();
}
build() {
Column() {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/view/UpdaterComponent.ets#L40-L68 | aeb4ebab1455fd8738db5ae00c0bf3cd69bb7895 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowMoreOptions.ets | arkts | visible_when_search_input_is_not_blank | Visibility | visible_when_search_input_is_not_blank() {
return this.search_input == "" ? Visibility.None : Visibility.Visible
} | AST#method_declaration#Left visible_when_search_input_is_not_blank AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expression#Left AST#expression#Left AST#conditional_expression#Left AST#expression#Left AS... | visible_when_search_input_is_not_blank() {
return this.search_input == "" ? Visibility.None : Visibility.Visible
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowMoreOptions.ets#L386-L388 | 41c9ab438d82859b9fc4bfa881e5391262fadbfe | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/CountDownTimer.ets | arkts | reset | 重置倒计时
@param totalTime 新的总时间(毫秒),不填则使用初始总时间 | reset(totalTime?: number): void {
if (totalTime) {
this.totalTime = totalTime;
}
this.remainingTime = this.totalTime;
this.isPaused = false;
} | AST#method_declaration#Left reset AST#parameter_list#Left ( AST#parameter#Left totalTime ? : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right ... | reset(totalTime?: number): void {
if (totalTime) {
this.totalTime = totalTime;
}
this.remainingTime = this.totalTime;
this.isPaused = false;
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/CountDownTimer.ets#L129-L135 | 2ac8a04c8fd24acd375c5097b24afe54de187d14 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customtabbar/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants {
// default icon
static readonly DEFAULT_ICON = $r('app.media.custom_tab_default_icon')
// tab标题
static readonly DEFAULT_TITLE1_TAB = "标题1";
// tab标题
static readonly DEFAULT_TITLE2_TAB = "标题2";
// tab标题
static readonly DEFAULT_TITLE3_TAB = "标题3";
// tab标题
static readonl... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // default icon AST#property_declaration#Left static readonly DEFAULT_ICON = AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left 'app.media.custom_tab_default_icon' AST#expression#Right ) AST#... | export class CommonConstants {
static readonly DEFAULT_ICON = $r('app.media.custom_tab_default_icon')
static readonly DEFAULT_TITLE1_TAB = "标题1";
static readonly DEFAULT_TITLE2_TAB = "标题2";
static readonly DEFAULT_TITLE3_TAB = "标题3";
static readonly DEFAULT_TITLE4_TAB = "标题4";
static reado... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customtabbar/src/main/ets/common/CommonConstants.ets#L16-L39 | 4faa69ba04e7539d2eab220a01b4deabd157b833 | gitee | |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | 轴计算器接口 | export interface IAxisLineCalculator {
// 根据值获取轴坐标
getAxisByValue(targetTime: number): number;
// 根据轴坐标获取值
getValueByAxis(pos: number): number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IAxisLineCalculator AST#object_type#Left { // 根据值获取轴坐标 AST#type_member#Left getAxisByValue AST#parameter_list#Left ( AST#parameter#Left targetTime : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotatio... | export interface IAxisLineCalculator {
getAxisByValue(targetTime: number): number;
getValueByAxis(pos: number): number;
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L180-L185 | 883d304f5044e421c188e9beeeed63537ddeba21 | gitee | |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/function_call/library_function/set_lib_func_001_T.ets | arkts | Introduction 库函数-set_add | export function set_lib_func_001_T(taint_src : string) {
let s = new Set<string>();
s.add(taint_src);
taint.Sink(s);
} | AST#export_declaration#Left export AST#function_declaration#Left function set_lib_func_001_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_statement#... | export function set_lib_func_001_T(taint_src : string) {
let s = new Set<string>();
s.add(taint_src);
taint.Sink(s);
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/function_call/library_function/set_lib_func_001_T.ets#L6-L10 | b7d0e7365fa30544f5802b1777955407fa58688c | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1_oaep/RSAPKCS1OAEPAsync.ets | arkts | genRsa2048KeyPairSpec | 生成RSA2048密钥对参数 | function genRsa2048KeyPairSpec(): cryptoFramework.RSAKeyPairSpec {
let nIn =
BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc4328daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee34e4d933c868187bdc... | AST#function_declaration#Left function genRsa2048KeyPairSpec AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . RSAKeyPairSpec AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left {... | function genRsa2048KeyPairSpec(): cryptoFramework.RSAKeyPairSpec {
let nIn =
BigInt('0x9260d0750ae117eee55c3f3deaba74917521a262ee76007cdf8a56755ad73a1598a1408410a01434c3f5bc54a88b57fa19fc4328daea0750a4c44e88cff3b2382621b80f670464433e4336e6d003e8cd65bff211da144b88291c2259a00a72b711c116ef7686e8fee34e4d933c868187bdc... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Security/CryptoArchitectureKit/EncryptionDecryption/EncryptionDecryptionGuidanceRSA/entry/src/main/ets/pages/rsa_pkcs1_oaep/RSAPKCS1OAEPAsync.ets#L38-L45 | 006d7841d900ed694c3a7f49e78ae5e9d373f6b1 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | decodeAsym | 非对称解密
@param str 待解密的字符串
@param priKey 给定秘钥规格私钥
@param symAlgName 秘钥规格
@param symEncryptName 加密规格
@param keyName 密钥长度
@param keyCoding 密钥编码方式(utf8/hex/base64)
@param dataCoding 入参字符串编码方式(hex/base64)
@param isPem 是否为pem格式的key | static decodeAsym(str: string, priKey: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding,
isPem: boolean): string {
//将私钥转换
let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) :
Crypto... | AST#method_declaration#Left static decodeAsym AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static decodeAsym(str: string, priKey: string, symAlgName: string, symEncryptName: string,
keyName: number, keyCoding: buffer.BufferEncoding, dataCoding: buffer.BufferEncoding,
isPem: boolean): string {
let priPair = isPem ? CryptoSyncUtil.convertPemPriKeyFromStr(priKey, symAlgName) :
CryptoSyncUti... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L383-L399 | d0076d9ef3aeac8ab874e2fe80755c933120a7b9 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.util.d.ets | arkts | isBigInt64Array | Check whether the entered value is of bigint64array array type.
@param { Object } value - A BigInt64Array value
@returns { boolean } Returns true if the value is a BigInt64Array instance.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservice
@since 20 | isBigInt64Array(value: Object): boolean; | AST#method_declaration#Left isBigInt64Array AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Object AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | isBigInt64Array(value: Object): boolean; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.util.d.ets#L1169-L1169 | 41023ae6a7e0ba472798a3042ba687e14e3265b9 | gitee |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/ImageEditInterface.ets | arkts | 图标配置选项,业务可以配置两个图标用于响应选中和非选中两种状态下图标样式 | export class ImageEditIconOption {
selected: Resource
unSelected: Resource
constructor | AST#export_declaration#Left export AST#ERROR#Left class ImageEditIconOption { selected : Resource unSelected : Resource AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export class ImageEditIconOption {
selected: Resource
unSelected: Resource
constructor | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/ImageEditInterface.ets#L128-L132 | 753a2f4f62c1ab9a5863a1ebb85f8ecc0aa2ee73 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets | arkts | getMedianFrameRadio | 方法描述 计算帧率中位数
@param fpsList fpsList
@return java.lang.Integer fps | private static getMedianFrameRadio(fpsArray: Array<number>): number {
if (null == fpsArray || fpsArray.length == 0) {
return null;
}
fpsArray.sort();
let length = fpsArray.length;
if (length % 2 == 0) {
return (fpsArray[fpsArray.length / 2] + fpsArray[fpsArray.length / 2 - 1]) / 2; //... | AST#method_declaration#Left private static getMedianFrameRadio AST#parameter_list#Left ( AST#parameter#Left fpsArray : 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 number AST#primary_type#Right AST#type_annotation#Rig... | private static getMedianFrameRadio(fpsArray: Array<number>): number {
if (null == fpsArray || fpsArray.length == 0) {
return null;
}
fpsArray.sort();
let length = fpsArray.length;
if (length % 2 == 0) {
return (fpsArray[fpsArray.length / 2] + fpsArray[fpsArray.length / 2 - 1]) / 2;
... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/utils/GameUtils.ets#L89-L103 | 3fe00e0c3d3ff3458539835e39ae70d0710ed926 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/data/src/main/ets/repository/AddressRepository.ets | arkts | @file 用户地址仓库,封装用户地址相关请求
@author Joker.X | export class AddressRepository {
/**
* 地址网络数据源
*/
private networkDataSource: AddressNetworkDataSource;
/**
* 构造函数
* @param networkDataSource 可选的网络数据源实例
*/
constructor(networkDataSource?: AddressNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new AddressNetworkDataSourceImp... | AST#export_declaration#Left export AST#class_declaration#Left class AddressRepository AST#class_body#Left { /**
* 地址网络数据源
*/ AST#property_declaration#Left private networkDataSource : AST#type_annotation#Left AST#primary_type#Left AddressNetworkDataSource AST#primary_type#Right AST#type_annotation#Right ; AST#prop... | export class AddressRepository {
private networkDataSource: AddressNetworkDataSource;
constructor(networkDataSource?: AddressNetworkDataSource) {
this.networkDataSource = networkDataSource ?? new AddressNetworkDataSourceImpl();
}
async updateAddress(params: Address): Promise<NetworkResponse<void>... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/data/src/main/ets/repository/AddressRepository.ets#L8-L82 | bf5bb196696d52abb50d70b848f7ac30e09da56d | github | |
openharmony/multimedia_camera_framework | 9873dd191f59efda885bc06897acf9b0660de8f2 | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets | arkts | rotateSecondAnim | 再向内翻转90° | async rotateSecondAnim() {
Logger.info(TAG, 'rotateSecondAnim E');
// 获取已完成的surface截图
let shotPixel = BlurAnimateUtil.getSurfaceShot();
// 后置
if (this.curPosition === 1) {
// 直板机后置镜头旋转补偿90°
await shotPixel.rotate(BlurAnimateUtil.IMG_ROTATE_ANGLE_90); // Image Kit提供的旋转,用于处理图片本身的旋转
/... | AST#method_declaration#Left async rotateSecondAnim AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Logger AST#expression#Right ... | async rotateSecondAnim() {
Logger.info(TAG, 'rotateSecondAnim E');
let shotPixel = BlurAnimateUtil.getSurfaceShot();
if (this.curPosition === 1) {
await shotPixel.rotate(BlurAnimateUtil.IMG_ROTATE_ANGLE_90);
this.shotImgRotation = { y: BlurAnimateUtil.ROTATE_AXIS, angle:... | https://github.com/openharmony/multimedia_camera_framework/blob/9873dd191f59efda885bc06897acf9b0660de8f2/frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/pages/Index.ets#L199-L234 | 8e515ce957a620cc934618dac8e36c5090e75e1e | gitee |
yongoe1024/RdbPlus.git | 4a3fc04ba5903bc1c1b194efbc557017976909dc | rdbplus/src/main/ets/log/Logger.ets | arkts | 日志接口 | export interface Logger {
debug(...args: string[]): void
info(...args: string[]): void
warn(...args: string[]): void
error(...args: string[]): void
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Logger AST#object_type#Left { AST#type_member#Left debug AST#parameter_list#Left ( AST#parameter#Left ... args : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_... | export interface Logger {
debug(...args: string[]): void
info(...args: string[]): void
warn(...args: string[]): void
error(...args: string[]): void
} | https://github.com/yongoe1024/RdbPlus.git/blob/4a3fc04ba5903bc1c1b194efbc557017976909dc/rdbplus/src/main/ets/log/Logger.ets#L4-L13 | cbfb143557349ec158f4ba86a529a2976cab3271 | github | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api12/entry/src/main/ets/MainAbility/pages/Repeat/repeatNoTemplateId.ets | arkts | constructor,用于初始化数组个数 | constructor(count: number) {
for (let i = 0; i < count; i++) {
this.arr.push(i);
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left count : 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#for_statement#Left for... | constructor(count: number) {
for (let i = 0; i < count; i++) {
this.arr.push(i);
}
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement01_api12/entry/src/main/ets/MainAbility/pages/Repeat/repeatNoTemplateId.ets#L20-L24 | 839f639461f62120749bfaf4e805a3cba5602135 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/iab/SubscribeManager.ets | arkts | saveCurrentItem | 保存当前订阅项到本地 | saveCurrentItem(item?: SubscribeItem): void {
if (item) {
this.currentItem = item;
// 发送订阅项已改变通知,让UI刷新
SimpleEventBus.emit(SubscribeManagerNotification.expireDateUpdated)
}
const pref = this.getPrefs();
if (!pref || !this.currentItem) return;
pref.putSync(SubscribeManagerPref.kS... | AST#method_declaration#Left saveCurrentItem AST#parameter_list#Left ( AST#parameter#Left item ? : AST#type_annotation#Left AST#primary_type#Left SubscribeItem 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... | saveCurrentItem(item?: SubscribeItem): void {
if (item) {
this.currentItem = item;
SimpleEventBus.emit(SubscribeManagerNotification.expireDateUpdated)
}
const pref = this.getPrefs();
if (!pref || !this.currentItem) return;
pref.putSync(SubscribeManagerPref.kSku, t... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/iab/SubscribeManager.ets#L92-L108 | cbcf52ff7b3d48404d2a91d3732143dc77f435bf | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets | arkts | pickImages | 挑选图片 | async pickImages(): Promise<void> {
try {
// 创建图片选择器实例
let photoPicker = new picker.PhotoViewPicker();
// 设置选择参数
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 9;
... | AST#method_declaration#Left async pickImages AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | async pickImages(): Promise<void> {
try {
let photoPicker = new picker.PhotoViewPicker();
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 9;
ph... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/community/PostCreatePage.ets#L105-L139 | 7e46049c792f08d68f7bbca71fb19698883defaa | github |
Hyricane/Interview_Success.git | 9783273fe05fc8951b99bf32d3887c605268db8f | entry/src/main/ets/commons/utils/History.ets | arkts | 面向对象 获取首选项实例对象(有很多方法) 增 putSync 删 deleteSync 改 putSync flushSync 查 getSync | export class History {
store: preferences.Preferences | null = null;
getStore() {
if (!this.store) {
const context = AppStorage.get<Context>("context");
this.store = preferences.getPreferencesSync(context, { name: "history-store" });
}
return this.store;
}
// 存一个关键字
setItem(keyword: ... | AST#export_declaration#Left export AST#class_declaration#Left class History AST#class_body#Left { AST#property_declaration#Left store : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left preferences . Preferences AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#... | export class History {
store: preferences.Preferences | null = null;
getStore() {
if (!this.store) {
const context = AppStorage.get<Context>("context");
this.store = preferences.getPreferencesSync(context, { name: "history-store" });
}
return this.store;
}
setItem(keyword: string) {... | https://github.com/Hyricane/Interview_Success.git/blob/9783273fe05fc8951b99bf32d3887c605268db8f/entry/src/main/ets/commons/utils/History.ets#L11-L47 | ebe6873f1324aaff9df83ad8b5578dc550faed76 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/theme/ThemeManager.ets | arkts | addThemeEventListener | 添加主题事件监听器 | addThemeEventListener(listener: (event: ThemeEvent) => void): void {
this.themeEventListeners.push(listener);
} | AST#method_declaration#Left addThemeEventListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left ThemeEvent AST#primary_type#Right AST#type_annotation#Right AST#pa... | addThemeEventListener(listener: (event: ThemeEvent) => void): void {
this.themeEventListeners.push(listener);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/theme/ThemeManager.ets#L479-L481 | 3238942e04fc9e0a0c7c97862673e899a3813a23 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/renderer/scatter/TriangleShapeRenderer.ets | arkts | Created by wajdic on 15/06/2016.
Created at Time 09:08 | export default class TriangleShapeRenderer implements IShapeRenderer {
//不确定改为Path2D还是Path
protected mTrianglePathBuffer: Path2D = new Path2D();
public renderShape(c: CanvasRenderingContext2D, dataSet: IScatterDataSet, viewPortHandler: ViewPortHandler,
posX: number, posY: number, renderPaint... | AST#export_declaration#Left export default AST#class_declaration#Left class TriangleShapeRenderer AST#implements_clause#Left implements IShapeRenderer AST#implements_clause#Right AST#class_body#Left { //不确定改为Path2D还是Path AST#property_declaration#Left protected mTrianglePathBuffer : AST#type_annotation#Left AST#primary_... | export default class TriangleShapeRenderer implements IShapeRenderer {
protected mTrianglePathBuffer: Path2D = new Path2D();
public renderShape(c: CanvasRenderingContext2D, dataSet: IScatterDataSet, viewPortHandler: ViewPortHandler,
posX: number, posY: number, renderPaint: Paint): void {
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/renderer/scatter/TriangleShapeRenderer.ets#L28-L91 | acca587748c0150610d6270421930433d4aa30b3 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets | arkts | addAddress | 新增地址
@param {Address} params - 地址信息
@returns {Promise<NetworkResponse<{ id: number }>>} 新增结果 | async addAddress(params: Address): Promise<NetworkResponse<Id>> {
const resp: AxiosResponse<NetworkResponse<Id>> =
await NetworkClient.http.post("user/address/add", params);
return resp.data;
} | AST#method_declaration#Left async addAddress AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left Address 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#Left... | async addAddress(params: Address): Promise<NetworkResponse<Id>> {
const resp: AxiosResponse<NetworkResponse<Id>> =
await NetworkClient.http.post("user/address/add", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets#L59-L63 | 9d4a34b458d446bd408a5464312f97404c2756de | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets | arkts | 足迹数据 | export const mockFootprints: Footprint[] = [
{ id: 1, goodsId: 1, goodsMainPic: 'https://picsum.photos/100/100?random=2001', viewTime: '2025-11-03 10:30' },
{ id: 2, goodsId: 2, goodsMainPic: 'https://picsum.photos/100/100?random=2002', viewTime: '2025-11-03 09:15' },
{ id: 3, goodsId: 3, goodsMainPic: 'https://p... | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left mockFootprints : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Footprint [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left [ AST#e... | export const mockFootprints: Footprint[] = [
{ id: 1, goodsId: 1, goodsMainPic: 'https://picsum.photos/100/100?random=2001', viewTime: '2025-11-03 10:30' },
{ id: 2, goodsId: 2, goodsMainPic: 'https://picsum.photos/100/100?random=2002', viewTime: '2025-11-03 09:15' },
{ id: 3, goodsId: 3, goodsMainPic: 'https://p... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/coolmall-master/entry/src/main/ets/data/MockData.ets#L179-L185 | 560ab782ff68f40c5b916b63968378a2d9f86ada | github | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/model/HardKeyUtils.ets | arkts | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | export function GetHardKeyValue(keyCode: number, isShift: boolean): string {
let keyList: Map<number, string> = new Map<number, string>();
keyList.set(2000, '0');
keyList.set(2001, '1');
keyList.set(2002, '2');
keyList.set(2003, '3');
keyList.set(2004, '4');
keyList.set(2005, '5');
keyList.set(2006, '6'... | AST#export_declaration#Left export AST#function_declaration#Left function GetHardKeyValue AST#parameter_list#Left ( AST#parameter#Left keyCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isShift : AST#type_annotation#L... | export function GetHardKeyValue(keyCode: number, isShift: boolean): string {
let keyList: Map<number, string> = new Map<number, string>();
keyList.set(2000, '0');
keyList.set(2001, '1');
keyList.set(2002, '2');
keyList.set(2003, '3');
keyList.set(2004, '4');
keyList.set(2005, '5');
keyList.set(2006, '6'... | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/model/HardKeyUtils.ets#L16-L88 | fa2f6dab7a9147454c45ab36ce83e1120b95dfd3 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets | arkts | resetCurrentImageInfo | 在图片消失时,将当前图片的信息设置为默认值 | resetCurrentImageInfo(): void {
animateTo({
duration: this.restImageAnimation
}, () => {
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.imageRotateInfo.reset();
this.matrix = matrix4.identity().copy();
})
} | AST#method_declaration#Left resetCurrentImageInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Lef... | resetCurrentImageInfo(): void {
animateTo({
duration: this.restImageAnimation
}, () => {
this.imageScaleInfo.reset();
this.imageOffsetInfo.reset();
this.imageRotateInfo.reset();
this.matrix = matrix4.identity().copy();
})
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets#L174-L183 | d25553bb08bed35d9bf53508deedbf2868b2c023 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/DateUtil.ets | arkts | getFormatTime | 格式化时间日期字符串(DateTimeFormat)
@param date 时间日期对象
@param options 时间日期格式化选项
@param locale 包含区域设置信息的字符串,包括语言以及可选的脚本和区域
@returns | static getFormatTime(date: Date, options: intl.DateTimeOptions = { dateStyle: "short", timeStyle: "short", hourCycle: "h24" },
locale: string = "zh-CN"): string {
const dateTimeFormat = new intl.DateTimeFormat(locale, options);
return dateTimeFormat.format(date);
} | AST#method_declaration#Left static getFormatTime AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#L... | static getFormatTime(date: Date, options: intl.DateTimeOptions = { dateStyle: "short", timeStyle: "short", hourCycle: "h24" },
locale: string = "zh-CN"): string {
const dateTimeFormat = new intl.DateTimeFormat(locale, options);
return dateTimeFormat.format(date);
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/DateUtil.ets#L382-L386 | a0784d29c573413a1da6faff3c1522efe6e104a5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets | arkts | rightThumbUpdate | 右边条状物被滑动时的位置处理
@param deltaX | rightThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
// 右边距
if (deltaPx >= 0 && ((this.rightThumbRect[2] + deltaPx) >= this.componentMaxWidth - this.rightPadding)) {
deltaPx = this.componentMaxWidth - this.rightPadding - this.rightThumbRect[2];
}
// 左边距
if (deltaPx <= 0 && ((this.rig... | AST#method_declaration#Left rightThumbUpdate AST#parameter_list#Left ( AST#parameter#Left deltaX : 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#variable_declaration#... | rightThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
if (deltaPx >= 0 && ((this.rightThumbRect[2] + deltaPx) >= this.componentMaxWidth - this.rightPadding)) {
deltaPx = this.componentMaxWidth - this.rightPadding - this.rightThumbRect[2];
}
if (deltaPx <= 0 && ((this.rightThumbRect[... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L303-L329 | 0ef22efbcd919e39f331388f6f47e453456373e4 | gitee |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/ui/weight/pullToRefresh/PullToRefreshConfigurator.ets | arkts | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class PullToRefreshConfigurator {
private hasRefresh?: boolean = true; // 是否具有下拉刷新功能
private hasLoadMore?: boolean = true; // 是否具有上拉加载功能
private maxTranslate?: number = 100; // 可下拉上拉的最大距离
private sensitivity?: number = 0.7; // 下拉上拉灵敏度
private listIsPlacement?: boolean = true; // 滑动结束后列表是否归位
private a... | AST#export_declaration#Left export AST#class_declaration#Left class PullToRefreshConfigurator AST#class_body#Left { AST#property_declaration#Left private hasRefresh ? : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left ... | export class PullToRefreshConfigurator {
private hasRefresh?: boolean = true;
private hasLoadMore?: boolean = true;
private maxTranslate?: number = 100;
private sensitivity?: number = 0.7;
private listIsPlacement?: boolean = true;
private animDuration?: number = 150;
private refreshHeight?: number =... | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/ui/weight/pullToRefresh/PullToRefreshConfigurator.ets#L15-L222 | d0c236975c99faff402267bbbdb6fc365b277152 | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AvoidTimeComsume/entry/src/main/ets/views/PositiveOfGrid.ets | arkts | aboutToReuse | [Start positive_of_grid] ... | aboutToReuse(params: Record<string, number>): void {
hiTraceMeter.startTrace('ReuseOfGrid', 1001);
this.item = params.item;
hiTraceMeter.finishTrace('ReuseOfGrid', 1001)
} | AST#method_declaration#Left aboutToReuse AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotatio... | aboutToReuse(params: Record<string, number>): void {
hiTraceMeter.startTrace('ReuseOfGrid', 1001);
this.item = params.item;
hiTraceMeter.finishTrace('ReuseOfGrid', 1001)
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AvoidTimeComsume/entry/src/main/ets/views/PositiveOfGrid.ets#L111-L115 | e2493b4e33cd6a9a8639378c3c8f974481510585 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/contants/Enums.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export enum CardType {
MINE = 1,
OTHER = 2
} | AST#export_declaration#Left export AST#enum_declaration#Left enum CardType AST#enum_body#Left { AST#enum_member#Left MINE = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left OTHER = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right } AST#enum_body#Right AST#enum_decl... | export enum CardType {
MINE = 1,
OTHER = 2
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/contants/Enums.ets#L16-L19 | 6d96c6d28faf63929748cb4b9cd1f9c46471c8de | gitee | |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/goods/VHGoodsComponent.ets | arkts | VHOrderDialog | 订单弹窗 | @CustomDialog
export struct VHOrderDialog {
@State value: number = 1
@State pay: string = 'WEIXIN'
@Prop GoodsData: VHGoodsInfo = new VHGoodsInfo()
@Consume CouponsAvailable: VHCouponInfo[]
@State Index: number = -1 // 初始化为-1,标识未选中优惠券
@State price: number = 0
@Consume CouponsWebinarId: number
@State nam... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct VHOrderDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_ann... | @CustomDialog
export struct VHOrderDialog {
@State value: number = 1
@State pay: string = 'WEIXIN'
@Prop GoodsData: VHGoodsInfo = new VHGoodsInfo()
@Consume CouponsAvailable: VHCouponInfo[]
@State Index: number = -1
@State price: number = 0
@Consume CouponsWebinarId: number
@State name: string = ''
@... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/goods/VHGoodsComponent.ets#L868-L1267 | 37ac1513b8de26dcf8dbba18e03139ab3b8d9ecf | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/dialog/src/main/ets/tips/TipsDialogManager.ets | arkts | showInfo | 内容提示 弹窗
@param params | static showInfo(msg: string = '', infoIcon: ResourceStr = $r('app.media.dialog_tips_info_icon'),) {
let dialogVo = new TipsDialogParams(TipsType.INFO, msg)
dialogVo.infoIcon = infoIcon
PromptActionUtils.getInstance().openCustomDialog<TipsDialogParams>(wrapBuilder(TipsDialogBuilder),
dialogVo)
Tips... | AST#method_declaration#Left static showInfo AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left infoIcon : AST#type_annotation#Left... | static showInfo(msg: string = '', infoIcon: ResourceStr = $r('app.media.dialog_tips_info_icon'),) {
let dialogVo = new TipsDialogParams(TipsType.INFO, msg)
dialogVo.infoIcon = infoIcon
PromptActionUtils.getInstance().openCustomDialog<TipsDialogParams>(wrapBuilder(TipsDialogBuilder),
dialogVo)
Tips... | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/dialog/src/main/ets/tips/TipsDialogManager.ets#L38-L44 | b64d81b4747d6112d4c683a998b6254dc0671534 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/foldablescreencases/src/main/ets/components/MusicPlayerCtrlComp.ets | arkts | showTimeBuilder | 音乐当前播放时间和总时间显示 | @Builder
showTimeBuilder($$: ShowTimeBuilderParam) {
Text($$.str)
.fontSize($r('app.integer.foldable_screen_cases_font_size_music_time'))
.fontColor(Color.White)
.maxLines(CommonConstants.MUSIC_TIME_MAX_LINES)
.textOverflow({ overflow: TextOverflow.Clip })
.flexShrink(CommonConstants... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right showTimeBuilder AST#parameter_list#Left ( AST#parameter#Left $$ : AST#type_annotation#Left AST#primary_type#Left ShowTimeBuilderParam AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_f... | @Builder
showTimeBuilder($$: ShowTimeBuilderParam) {
Text($$.str)
.fontSize($r('app.integer.foldable_screen_cases_font_size_music_time'))
.fontColor(Color.White)
.maxLines(CommonConstants.MUSIC_TIME_MAX_LINES)
.textOverflow({ overflow: TextOverflow.Clip })
.flexShrink(CommonConstants... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/foldablescreencases/src/main/ets/components/MusicPlayerCtrlComp.ets#L48-L56 | f287f5586acaf444c99e368d6fbcec480d474a60 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.fs.d.ets | arkts | ReadTextOptions type
@extends ReadOptions
@interface ReadTextOptions
@syscap SystemCapability.FileManagement.File.FileIO
@since 20 | export interface ReadTextOptions extends ReadOptions {
/**
* The encoding style when reading text.
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 20
*/
encoding?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ReadTextOptions AST#extends_clause#Left extends ReadOptions AST#extends_clause#Right AST#object_type#Left { /**
* The encoding style when reading text.
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.File.FileIO
... | export interface ReadTextOptions extends ReadOptions {
encoding?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.fs.d.ets#L4379-L4388 | e1f2a676bdfcbe958480d9b18f2ed34baf75af68 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/calendar/LunarSolarMappingService.ets | arkts | 农历公历映射项 | export interface LunarSolarMapping {
lunarYear: number;
lunarMonth: number;
lunarDay: number;
isLeapMonth: boolean;
solarYear: number;
solarMonth: number;
solarDay: number;
dayOfYear: number; // 在公历年中的第几天
weekDay: number; // 星期几 (0-6)
description?: string; // 说明信息
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LunarSolarMapping AST#object_type#Left { AST#type_member#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left lunarMonth : AST#type_... | export interface LunarSolarMapping {
lunarYear: number;
lunarMonth: number;
lunarDay: number;
isLeapMonth: boolean;
solarYear: number;
solarMonth: number;
solarDay: number;
dayOfYear: number;
weekDay: number;
description?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/calendar/LunarSolarMappingService.ets#L14-L25 | da2c7db4f83e5b3f98c7770bd69523fcc842a682 | github | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/index.ets | arkts | ArrayListView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { ArrayListView } from './src/main/ets/capabilities/ArrayListView'; | AST#export_declaration#Left export { ArrayListView } from './src/main/ets/capabilities/ArrayListView' ; AST#export_declaration#Right | export { ArrayListView } from './src/main/ets/capabilities/ArrayListView'; | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/index.ets#L16-L16 | 3de549ec6f6bc71bc6293712f9bf8e174d996447 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/address/AddressActionButton.ets | arkts | AddressActionButton | 地址列表场景的编辑按钮
@author Joker.X | @ComponentV2
export struct AddressActionButton {
/**
* 点击回调
*/
@Param
onTap: () => void = () => {
};
/**
* 图标资源
*/
@Param
@Require
iconResId: ResourceStr = "";
/**
* 按钮尺寸(单位:vp)
*/
@Param
buttonSize: number = 32;
/**
* 图标尺寸(单位:vp)
*/
@Param
iconSize: number = 18;
/*... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct AddressActionButton AST#component_body#Left { /**
* 点击回调
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right onTap : AST#type_annotation#Left AST#function_type#Left AST#parameter_li... | @ComponentV2
export struct AddressActionButton {
@Param
onTap: () => void = () => {
};
@Param
@Require
iconResId: ResourceStr = "";
@Param
buttonSize: number = 32;
@Param
iconSize: number = 18;
@Param
bgColor: ResourceColor = $r("app.color.bg_content");
@Param
iconColor: Re... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/address/AddressActionButton.ets#L7-L62 | 3cba47b3c4592c461c2bf5c68b9237862e9f649d | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/highlight/ChartHighlighter.ets | arkts | getClosestHighlightByPixel | Returns the Highlight of the DataSet that contains the closest value on the
y-axis.
@param closestValues contains two Highlight objects per DataSet closest to the selected x-position (determined by
rounding up an down)
@param x
@param y
@param axis the closest axis
@param minSelectionDistance
@r... | public getClosestHighlightByPixel(closestValues: JArrayList<Highlight>, x: number, y: number,
axis: AxisDependency, minSelectionDistance: number): Highlight | null {
let closest: Highlight | null = null;
let distance: number = minSelectionDistance;
for (let i: number = ... | AST#method_declaration#Left public getClosestHighlightByPixel AST#parameter_list#Left ( AST#parameter#Left closestValues : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Highlight AST#primary_type#Right AST#type_an... | public getClosestHighlightByPixel(closestValues: JArrayList<Highlight>, x: number, y: number,
axis: AxisDependency, minSelectionDistance: number): Highlight | null {
let closest: Highlight | null = null;
let distance: number = minSelectionDistance;
for (let i: number = ... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/highlight/ChartHighlighter.ets#L236-L263 | 9e67b3d1cde132da2167bd5146fbe274ca376663 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets | arkts | convertSM2PriKey | 将服务器端生成的16进制的长度为64位的C1C3C2格式的SM2私钥转换为前端所需的ASN.1格式SM2私钥字符串
@param priKey 16进制的64位的私钥字符串
@returns 转换后的私钥字符串 | static convertSM2PriKey(priKey: string): string {
if (priKey.length != 64) {
return '服务器端SM2私钥长度不正确~';
}
//构建SM2私钥参数对象
let keyPair: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
algName: 'SM2',
sk: BigInt('0x' + priKey),
... | AST#method_declaration#Left static convertSM2PriKey AST#parameter_list#Left ( AST#parameter#Left priKey : 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 string AST#prim... | static convertSM2PriKey(priKey: string): string {
if (priKey.length != 64) {
return '服务器端SM2私钥长度不正确~';
}
let keyPair: cryptoFramework.ECCPriKeySpec = {
params: cryptoFramework.ECCKeyUtil.genECCCommonParamsSpec('NID_sm2'),
algName: 'SM2',
sk: BigInt('0x' + priKey),
specType... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L128-L145 | b59ed2df595cf3f8e6a6e54425568dd06405a863 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NumberUtil.ets | arkts | isFinite | 检查值是否为有限数字
@param value
@returns | static isFinite(value: Any): boolean {
return Number.isFinite(value);
} | AST#method_declaration#Left static isFinite AST#parameter_list#Left ( AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left Any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Ri... | static isFinite(value: Any): boolean {
return Number.isFinite(value);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NumberUtil.ets#L44-L46 | f8346919ef2af771f324484131692f05ecd311d4 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/personal/MinePage.ets | arkts | fetchUserInfo | 获取用户信息 | async fetchUserInfo(userId: number) {
try {
this.loading = true;
console.info(`开始获取用户信息, userId: ${userId}`);
// 使用ApiService获取用户信息
const userInfo = await ApiService.getUserById(userId);
if (userInfo) {
this.userInfo = userInfo;
console.info(`成功获取用户信息: ${J... | AST#method_declaration#Left async fetchUserInfo 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#block_statement#Left { AST#statement#Left AST#try_statement#Left... | async fetchUserInfo(userId: number) {
try {
this.loading = true;
console.info(`开始获取用户信息, userId: ${userId}`);
const userInfo = await ApiService.getUserById(userId);
if (userInfo) {
this.userInfo = userInfo;
console.info(`成功获取用户信息: ${JSON.stringify(userInf... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/personal/MinePage.ets#L52-L73 | 841b27fa371faf9967acdcffe585623dd912982d | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets | arkts | tabBuilder | 生成 tab 的函数 | @Builder
tabBuilder(index: number, text: Resource) {
Column() {
Text(text)
.fontSize($r('app.float.size_16'))
.fontColor(this.currentIndex === index ? $r('app.color.black') : $r('app.color.grey'))
}.justifyContent(FlexAlign.Center)
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilder 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#Left text : AST#type_annotation#Left AST... | @Builder
tabBuilder(index: number, text: Resource) {
Column() {
Text(text)
.fontSize($r('app.float.size_16'))
.fontColor(this.currentIndex === index ? $r('app.color.black') : $r('app.color.grey'))
}.justifyContent(FlexAlign.Center)
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/Media/Image/PixelMap/entry/src/main/ets/pages/Index.ets#L76-L83 | b68e1f669ae64d6ecb3680e3a8165cf1372f8d08 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | getSecuritySettings | 获取安全设置
@returns 安全设置 | async getSecuritySettings(): Promise<SecuritySettings> {
const settings = await this.getSettings();
return settings.security;
} | AST#method_declaration#Left async getSecuritySettings 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 SecuritySettings AST#primary_type#Right AST#type_annotation#R... | async getSecuritySettings(): Promise<SecuritySettings> {
const settings = await this.getSettings();
return settings.security;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L286-L289 | 45003b05585c9c1791c4428fc9239023f335d2e1 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 关系类型枚举 | export enum RelationType {
FAMILY = 'family', // 家人
FRIEND = 'friend', // 朋友
COLLEAGUE = 'colleague', // 同事
OTHER = 'other' // 其他
} | AST#export_declaration#Left export AST#enum_declaration#Left enum RelationType AST#enum_body#Left { AST#enum_member#Left FAMILY = AST#expression#Left 'family' AST#expression#Right AST#enum_member#Right , // 家人 AST#enum_member#Left FRIEND = AST#expression#Left 'friend' AST#expression#Right AST#enum_member#Right , // 朋友 ... | export enum RelationType {
FAMILY = 'family',
FRIEND = 'friend',
COLLEAGUE = 'colleague',
OTHER = 'other'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L58-L63 | b815c9ddecc00657b6a4eb20ad3c02659fa39440 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets | arkts | onDisconnectService | 断开连接 | async function onDisconnectService() {
if (connectedAbility == null) {
return;
}
await featureAbility.disconnectAbility(connectedAbility);
connectedAbility = null;
prompt.showToast({
message: "onDisconnectService disconnect done"
});
} | AST#function_declaration#Left async function onDisconnectService 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 connectedAbility AST#expression#Right == AST#expression#Left A... | async function onDisconnectService() {
if (connectedAbility == null) {
return;
}
await featureAbility.disconnectAbility(connectedAbility);
connectedAbility = null;
prompt.showToast({
message: "onDisconnectService disconnect done"
});
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/OpenHarmonyPictureGame/entry/src/main/ets/MainAbility/pages/index.ets#L154-L163 | 699dd5ec88bade1fd451299f9e6635282a3e026f | gitee |
xixi-cquer/BiJiDaiBan.git | 206dc33a837acbe6fc837feff848427e83946534 | entry/src/main/ets/common/utils/FileUtil.ets | arkts | PhotoViewPicker
@returns uri The uri for the selected file. | export async function fileSelect(): Promise<string> {
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoPicker = new picker.PhotoViewPicker();
try {
let photoSelectResult = await ph... | AST#export_declaration#Left export AST#function_declaration#Left async function fileSelect 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 string AST#primary_type#... | export async function fileSelect(): Promise<string> {
let photoSelectOptions = new picker.PhotoSelectOptions();
photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
photoSelectOptions.maxSelectNumber = 1;
let photoPicker = new picker.PhotoViewPicker();
try {
let photoSelectResult = await ph... | https://github.com/xixi-cquer/BiJiDaiBan.git/blob/206dc33a837acbe6fc837feff848427e83946534/entry/src/main/ets/common/utils/FileUtil.ets#L10-L31 | 30f5866bf1a44726ed24725014b0918a17f5d77f | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/CombinedChartModel.ets | arkts | setHighlightFullBarEnabled | Set this to true to make the highlight operation full-bar oriented,
false to make it highlight single values (relevant only for stacked).
@param enabled | public setHighlightFullBarEnabled(enabled: boolean): void {
this.mHighlightFullBarEnabled = enabled;
} | AST#method_declaration#Left public setHighlightFullBarEnabled AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi... | public setHighlightFullBarEnabled(enabled: boolean): void {
this.mHighlightFullBarEnabled = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/CombinedChartModel.ets#L210-L212 | a061b842911930646551e7cf6021c34d02926e73 | gitee |
yinxing2008/note_hongmeng_ArkUI.git | 5c7459ca682903d9184539facc63136bbe6230b9 | entry/src/main/ets/common/utils/Constants.ets | arkts | 厦门大学计算机专业 | 前华为工程师
专注《零基础学编程系列》 http://lblbc.cn/blog
包含:Java | 安卓 | 前端 | Flutter | iOS | 小程序 | 鸿蒙
公众号:蓝不蓝编程 | export const BASE_URL: string = 'https://lblbc.cn/'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BASE_URL : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'https://lblbc.cn/' AST#expression#Right AST#variable_declarator#Right ; AST#variabl... | export const BASE_URL: string = 'https://lblbc.cn/'; | https://github.com/yinxing2008/note_hongmeng_ArkUI.git/blob/5c7459ca682903d9184539facc63136bbe6230b9/entry/src/main/ets/common/utils/Constants.ets#L7-L7 | c0ffdd965028abd9add95f665fce4755918e0a01 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets | arkts | CustomCalendarSamplePage | 功能描述:本示例介绍如何使用自定义日历组件CustomCalendar实现日历年视图,月视图,周视图以及视图切换功能。还有如何使用Calendar Kit日历服务实现日程提醒的功能。
推荐场景:需要使用左右滑动切换年视图,月视图,周视图以及需要添加日程提醒的应用场景
核心组件:
1.CustomCalendar
2.SchedulePoint
实现步骤:
日历切换场景:
1.使用Tabs进行年、月、周视图页面布局。
2.调用自定义日历组件CustomCalendar组件分别在TabContent中显示对应年、月、周视图。
3.点击自定义分段按钮customSegmentButton进行年、月、周视图间切换。使用视图控制器的sw... | @Component
export struct CustomCalendarSamplePage {
// 屏幕宽度
@State screenWidth: number = 0;
// 当前显示的年份
@State currentShowYear: number = TODAY_YEAR;
// 当前显示的月份
@State @Watch('monthChange') currentShowMonth: number = TODAY_MONTH;
// 当前月视图或周视图中选中的日期
@State currentSelectDay: DayInfo =
new DayInfo(new Da... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomCalendarSamplePage AST#component_body#Left { // 屏幕宽度 AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right screenWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_t... | @Component
export struct CustomCalendarSamplePage {
@State screenWidth: number = 0;
@State currentShowYear: number = TODAY_YEAR;
@State @Watch('monthChange') currentShowMonth: number = TODAY_MONTH;
@State currentSelectDay: DayInfo =
new DayInfo(new Date().getFullYear(), new Date().getMonth() + 1... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets#L70-L483 | 2547814bba12c21d77d71d6747f4e0aa5b3ed6d0 | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets | arkts | getDidCount | 获取全部已做数量
@returns | public getDidCount(): number {
return this.examDetails.filter(item => item.isCorrect !== undefined).length;
} | AST#method_declaration#Left public getDidCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre... | public getDidCount(): number {
return this.examDetails.filter(item => item.isCorrect !== undefined).length;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/DriverLicenseExam-master/commons/datasource/src/main/ets/ExamService.ets#L196-L198 | 840c5fe14d4c96c28d2ae502ac8675945efa67ec | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BptaUseResources/entry/src/main/ets/pages/Bluetooth.ets | arkts | onForeground | ... | onForeground(): void {
try {
//Initiate Ble scan and broadcast as required by the service at the foreground
ble.startBLEScan([scanFilter], scanOptions);
ble.startAdvertising(setting, advData, advResponse);
} catch (error) {
let err = error as BusinessError;
hilog.warn(0x000, 'testT... | AST#method_declaration#Left onForeground 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#try_statement#Left try AST#block_statement#Left { //Initiate Ble scan and... | onForeground(): void {
try {
ble.startBLEScan([scanFilter], scanOptions);
ble.startAdvertising(setting, advData, advResponse);
} catch (error) {
let err = error as BusinessError;
hilog.warn(0x000, 'testTag', `startBLEScan or startAdvertising failed, code=${err.code}, message=${err... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/Bluetooth.ets#L24-L33 | da142e86b0d5f85944294027e6f2502202bc3139 | gitee |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/components/NavigationBar.ets | arkts | NavigationBar | 自定义常量 | @Component
export default struct NavigationBar {
private routerState: router.RouterState = router.getState(); //当前路由状态
@Prop title: string; //标题
/**
* 点击返回
*/
clickBack(): void {
if (this.routerState.index > 1) {
router.back()
} else {
router.replaceUrl({
url: 'pages/Index'
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct NavigationBar AST#component_body#Left { AST#property_declaration#Left private routerState : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left router . RouterState AST#qualified_type#Right ... | @Component
export default struct NavigationBar {
private routerState: router.RouterState = router.getState();
@Prop title: string;
clickBack(): void {
if (this.routerState.index > 1) {
router.back()
} else {
router.replaceUrl({
url: 'pages/Index'
})
}
}
build(... | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/components/NavigationBar.ets#L4-L50 | ce41b522cc0ab44412724be222f03d667d1ff4e9 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/pieCharts/PieChartPage.ets | arkts | menuCallback | 标题栏菜单回调 | @Monitor("titleModel.index")
menuCallback() {
if (this.titleModel == null || this.titleModel == undefined) {
return
}
let index: number = this.titleModel.getIndex()
if (!this.model || index == undefined || index == -1) {
return
}
let pieData = this.model.getData();
if (!pieData... | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left "titleModel.index" AST#expression#Right ) AST#decorator#Right menuCallback AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#ERROR#Left AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#b... | @Monitor("titleModel.index")
menuCallback() {
if (this.titleModel == null || this.titleModel == undefined) {
return
}
let index: number = this.titleModel.getIndex()
if (!this.model || index == undefined || index == -1) {
return
}
let pieData = this.model.getData();
if (!pieData... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/pieCharts/PieChartPage.ets#L70-L89 | 87bc14987e8eb29e5f388e7040718e3d5b084cf6 | gitee |
sea5241/PictureSelector | 09bac407ebd61100d1ccbf6e6d3b6349cb0013d7 | selector/src/main/ets/model/TitleStyleData.ets | arkts | 标题样式
@Author sea
@Date 2024/7/8 | export class TitleStyleData {
imageBackSize: number = 24
imageBack: Resource = $r('app.media.ic_close_black')
imageBackMarginLeft: number = 16
titleBarHeight: number = 48
titleText: Resource = $r('app.string.all_picture')
titleTextSize: number = 16
titleTextColor: Resource = $r('app.color.212121')
selec... | AST#export_declaration#Left export AST#ERROR#Left class TitleStyleData { imageBackSize AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 24 AST#expression#Right imageBack : AST#type_annotation#Left AST#primary_type#Left Resource... | export class TitleStyleData {
imageBackSize: number = 24
imageBack: Resource = $r('app.media.ic_close_black')
imageBackMarginLeft: number = 16
titleBarHeight: number = 48
titleText: Resource = $r('app.string.all_picture')
titleTextSize: number = 16
titleTextColor: Resource = $r('app.color.212121')
selec... | https://github.com/sea5241/PictureSelector/blob/09bac407ebd61100d1ccbf6e6d3b6349cb0013d7/selector/src/main/ets/model/TitleStyleData.ets#L6-L21 | 95b2b36cdc611656aca72ec1e5af668a2780e3fb | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_json/src/main/ets/json/JSONUtil.ets | arkts | @Author csx
@DateTime 2023/12/29 20:10
@TODO JSONUtil 各种json转换工具类
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_json | export class JSONUtil {
/**
* 将传入的json对象格式化成json字符串
* @param object 待转换的对象
* @param formatStr 字符串格式化模版
* @returns
* @deprecated 使用JSONObject或者JSONArray/JSONArrayList 方法代替
*/
static toJSONString(object: Object, formatStr?: string): string {
const stringifyValue = (value: Object): string => {
... | AST#export_declaration#Left export AST#class_declaration#Left class JSONUtil AST#class_body#Left { /**
* 将传入的json对象格式化成json字符串
* @param object 待转换的对象
* @param formatStr 字符串格式化模版
* @returns
* @deprecated 使用JSONObject或者JSONArray/JSONArrayList 方法代替
*/ AST#method_declaration#Left static toJSONString AST#p... | export class JSONUtil {
static toJSONString(object: Object, formatStr?: string): string {
const stringifyValue = (value: Object): string => {
if (value instanceof Map) {
let jsonObject: Record<string, Object> = {};
value.forEach((val: string, key: Object) => {
if (key !== undefi... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_json/src/main/ets/json/JSONUtil.ets#L25-L120 | c1edafa6b262be02cf1eb6dea9278c7763685871 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/dialog/LimitedHeightBottomDialog.ets | arkts | closeDialog | 关闭弹窗 | private closeDialog() {
this.showFlag = Visibility.Hidden;
} | AST#method_declaration#Left private closeDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . showFlag AST#member_expression... | private closeDialog() {
this.showFlag = Visibility.Hidden;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/limitedheightbottomdialog/src/main/ets/dialog/LimitedHeightBottomDialog.ets#L93-L95 | a9a382382003e2b4df375a7ba08814f5625f74f8 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/user/UserManager.ets | arkts | savePreference | 5. 保存偏好设置(键名完全不变) | private savePreference() {
if (!this.prefs) return;
this.prefs.putSync(Prefs.kUserId, this.userId ?? "");
this.prefs.putSync(Prefs.kUserName, this.userName ?? "");
this.prefs.putSync(Prefs.kLoginIdentifier, this.loginIdentifier ?? "");
this.prefs.putSync(Prefs.kLoginType, this.loginType?.valueOf() ... | AST#method_declaration#Left private savePreference 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 this AST#expression#Right AS... | private savePreference() {
if (!this.prefs) return;
this.prefs.putSync(Prefs.kUserId, this.userId ?? "");
this.prefs.putSync(Prefs.kUserName, this.userName ?? "");
this.prefs.putSync(Prefs.kLoginIdentifier, this.loginIdentifier ?? "");
this.prefs.putSync(Prefs.kLoginType, this.loginType?.valueOf() ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/user/UserManager.ets#L84-L94 | 785733737a1408a3f907ad283a0b028a59c37180 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM4.ets | arkts | encryptGCMSync | 加密(GCM模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(SM4_128|GCM|PKCS7、SM4_128|GCM|PKCS5、等)
@returns | static encryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'SM4_128|GCM|PKCS7'): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCR... | AST#method_declaration#Left static encryptGCMSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symKe... | static encryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'SM4_128|GCM|PKCS7'): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCR... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM4.ets#L54-L62 | e66ef13977d9462150d6b89430bd2e42788ffd29 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets | arkts | getClippedStringWithoutKindFromText | / 截取翻译文本,不包含词性 | static getClippedStringWithoutKindFromText(srcText: string): string {
let str = srcText;
const kind = BaseWordUtility.getKindFromText(srcText);
if (kind != null) {
const indexNoFound = -1;
const index = str.indexOf(kind);
if (index !== indexNoFound) {
const indexFromPoint = index +... | AST#method_declaration#Left static getClippedStringWithoutKindFromText AST#parameter_list#Left ( AST#parameter#Left srcText : 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#... | static getClippedStringWithoutKindFromText(srcText: string): string {
let str = srcText;
const kind = BaseWordUtility.getKindFromText(srcText);
if (kind != null) {
const indexNoFound = -1;
const index = str.indexOf(kind);
if (index !== indexNoFound) {
const indexFromPoint = index +... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/basedict/utils/BaseWordUtility.ets#L165-L177 | a50494632913f676824756772f8625c67c1f8593 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/common/constants/Constants.ets | arkts | Background color title. | export enum BGC_TITLE {
WHITE = '精白',
YELLOW = '赭黄',
GREEN = '竹青',
BLUE = '碧蓝'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum BGC_TITLE AST#enum_body#Left { AST#enum_member#Left WHITE = AST#expression#Left '精白' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left YELLOW = AST#expression#Left '赭黄' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left GRE... | export enum BGC_TITLE {
WHITE = '精白',
YELLOW = '赭黄',
GREEN = '竹青',
BLUE = '碧蓝'
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/readerLibrary/src/main/ets/common/constants/Constants.ets#L196-L201 | d6dacafe6c7c0bdd8c8f9712b974bb3decad47b0 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/models/ContactModel.ets | arkts | create | 静态方法:创建联系人 | static create(params: CreateContactParams): Contact {
const now = new Date().toISOString();
const id = this.generateId();
const birthdayInfo = this.createBirthdayInfo(params.birthday);
const contact: Contact = {
id,
name: params.name.trim(),
avatar: params.avatar,
phone... | AST#method_declaration#Left static create AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left CreateContactParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Contact AST#... | static create(params: CreateContactParams): Contact {
const now = new Date().toISOString();
const id = this.generateId();
const birthdayInfo = this.createBirthdayInfo(params.birthday);
const contact: Contact = {
id,
name: params.name.trim(),
avatar: params.avatar,
phone... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/models/ContactModel.ets#L20-L44 | 8b0104498c524e48a27a3651cbe2285f633ebf9e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getDeviceId | 设备ID
获取设备ID(卸载APP后依旧不变),需要权限:ohos.permission.STORE_PERSISTENT_DATA。
@param rule 是否带-
@param generateId 自己生成的id,不传使用默认生成的id
@returns | static getDeviceId(rule: boolean = true, generateId?: string): string {
let deviceId = DeviceUtil.deviceId;
if (StrUtil.isEmpty(deviceId)) {
if (AssetUtil.canIUse()) {
deviceId = StrUtil.toStr(AssetUtil.getSync(DEVICE_ID_KEY));
} else {
deviceId = StrUtil.toStr(PreferencesUtil.getStr... | AST#method_declaration#Left static getDeviceId AST#parameter_list#Left ( AST#parameter#Left rule : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#Righ... | static getDeviceId(rule: boolean = true, generateId?: string): string {
let deviceId = DeviceUtil.deviceId;
if (StrUtil.isEmpty(deviceId)) {
if (AssetUtil.canIUse()) {
deviceId = StrUtil.toStr(AssetUtil.getSync(DEVICE_ID_KEY));
} else {
deviceId = StrUtil.toStr(PreferencesUtil.getStr... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L48-L81 | 401c625c96285a7aec63356cb33b98ab120f00cd | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets | arkts | aboutToResize | 绑定的NodeContainer布局时触发,获取NodeContainer的宽高 | aboutToResize(size: Size): void {
this.width = size.width;
this.height = size.height;
// 设置画布底色为白色
if (this.rootRenderNode !== null) {
// NodeContainer布局完成后设置rootRenderNode的背景色为白色
this.rootRenderNode.backgroundColor = 0XFFFFFFFF;
// rootRenderNode的位置从组件NodeContainer的左上角(0,0)坐标开始,大小为Nod... | AST#method_declaration#Left aboutToResize AST#parameter_list#Left ( AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left Size 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 A... | aboutToResize(size: Size): void {
this.width = size.width;
this.height = size.height;
if (this.rootRenderNode !== null) {
this.rootRenderNode.backgroundColor = 0XFFFFFFFF;
this.rootRenderNode.frame = { x: 0, y: 0, width: this.width, height: this.height };
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets#L65-L75 | 6b96c8b6a5ab518cf410ee13d1cacbd9056801f3 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage1.ets | arkts | [Start test1] somePackage1.ets | export class Test1 {
doSomething() { // instance method
// ...
}
static test() { // static method
// ...
}
} | AST#export_declaration#Left export AST#class_declaration#Left class Test1 AST#class_body#Left { AST#method_declaration#Left doSomething AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // instance method // ... } AST#builder_function_body#Right AST#method_declaration#Right AST#metho... | export class Test1 {
doSomething() {
}
static test() {
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppAspectProgrammingDesign/entry/src/main/ets/components/somePackage1.ets#L22-L29 | 1d31e0e896f59fb7cd9d7fa9ff8b32772b040098 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 模型使用统计接口 | export interface ModelUsage {
totalCalls: number;
totalTokens: number;
averageResponseTime: number;
providerDistribution: Record<AIProvider, number>;
costEstimate: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ModelUsage AST#object_type#Left { AST#type_member#Left totalCalls : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left totalTokens : AST#type_annot... | export interface ModelUsage {
totalCalls: number;
totalTokens: number;
averageResponseTime: number;
providerDistribution: Record<AIProvider, number>;
costEstimate: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L638-L644 | 4340c80cccc8e4b2a16c36508ed2677f8d5ffc39 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/Tools.ets | arkts | compressedImage | 图片压缩
@param sourcePixelMap:原始待压缩图片的PixelMap对象
@param maxSize:指定图片的压缩目标大小,单位kb
@param imageFormat:当前只支持"image/jpeg"、"image/webp"、"image/png"和"image/heif"12+(不同硬件设备支持情况不同)。
@returns compressedImageData:返回压缩后的图片数据 | static async compressedImage(sourcePixelMap: image.PixelMap, maxImgSize: number, imageFormat: string = "image/jpeg"): Promise<ArrayBuffer> {
const imagePackerApi = image.createImagePacker(); //创建图像编码ImagePacker对象
const IMAGE_QUALITY = 0;
const packOpts: image.PackingOption = { format: imageFormat, quality: ... | AST#method_declaration#Left static async compressedImage AST#parameter_list#Left ( AST#parameter#Left sourcePixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Lef... | static async compressedImage(sourcePixelMap: image.PixelMap, maxImgSize: number, imageFormat: string = "image/jpeg"): Promise<ArrayBuffer> {
const imagePackerApi = image.createImagePacker();
const IMAGE_QUALITY = 0;
const packOpts: image.PackingOption = { format: imageFormat, quality: IMAGE_QUALITY };
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/Tools.ets#L182-L212 | 20ecd6efb0d4de29a0b5f1576f0f25a79a65f916 | gitee |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets | arkts | subscribeUncollectEvent | 订阅取消收藏event
@param callback | subscribeUncollectEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_UNCOLLECT, key, callback)
} | AST#method_declaration#Left subscribeUncollectEvent AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_... | subscribeUncollectEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_UNCOLLECT, key, callback)
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets#L152-L154 | da4aa0cd86a4d45f543c5af6307d51f562befd15 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/component/Column.ets | arkts | 渲染布局
@returns {void} 无返回值
@example
ColumnCenterEnd() { Text("Hi"); } | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue... | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#ui_custom_component_statement#Left ColumnBase ( AST#component_parameters#Left { AST#component_parameter#Left options : AST#expression#Left AST#member_expressio... | build(): void {
ColumnBase({
options: this.options,
justifyContent: FlexAlign.Center,
alignItems: HorizontalAlign.End,
widthValue: this.widthValue,
heightValue: this.heightValue,
sizeValue: this.sizeValue,
paddingValue: this.paddingValue,
marginValue: this.marginValue... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/component/Column.ets#L764-L779 | 6e0a37da783815ed1d64578315cb95bcd576ff60 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/payment/PaymentManager.ets | arkts | pay | 发起支付 | async pay(method: PaymentMethod, params: PaymentParams): Promise<PaymentResult> {
try {
Logger.info('PaymentManager', `Payment initiated: ${method}, amount: ${params.amount}`);
// Demo 实现,实际需要对接真实支付SDK
// 支付宝、微信、银行卡、苹果内购等都需要集成对应的SDK
return {
success: true,
order... | AST#method_declaration#Left async pay AST#parameter_list#Left ( AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left PaymentMethod AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left PaymentParams AST#pri... | async pay(method: PaymentMethod, params: PaymentParams): Promise<PaymentResult> {
try {
Logger.info('PaymentManager', `Payment initiated: ${method}, amount: ${params.amount}`);
return {
success: true,
orderId: params.orderId,
transactionId: `mock_txn_$... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/payment/PaymentManager.ets#L39-L60 | e68f4a646c87408278b63c2a1de3c60809a125f8 | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/an0n-chat-lib/0.1.5/package/build/token.ets | arkts | TokenType | 应用ES模块导出语法替换CommonJS导出 | export { TokenType, Token }; | AST#export_declaration#Left export { TokenType , Token } ; AST#export_declaration#Right | export { TokenType, Token }; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/token.ets#L23-L23 | f754c9c746f2a2678694dcd86cd176d19710ffae | github |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/http/request.ets | arkts | 基础响应体 | export interface BaseResponse {
errorCode: number
errorMsg: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface BaseResponse AST#object_type#Left { AST#type_member#Left errorCode : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left errorMsg : AST#type_annotatio... | export interface BaseResponse {
errorCode: number
errorMsg: string
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/http/request.ets#L88-L91 | 2ab9dc33671118abfa2cc44d90aac14d377ca33b | github | |
JinnyWang-Space/guanlanwenjuan.git | 601c4aa6c427e643d7bf42bc21945f658738e38c | common/src/main/ets/database/DistributedDB.ets | arkts | deleteSurvey | 根据 id 删除问卷 | async deleteSurvey(surveyId: number, permanent: boolean = false, isSync = true): Promise<boolean> {
if (!this.rdbStore) {
Logger.info('[deleteSurvey]', 'deleteSurvey() has no callback!');
return false;
}
try {
// 永久删除
if (permanent) {
const questionPredicates: relationalStore... | AST#method_declaration#Left async deleteSurvey AST#parameter_list#Left ( AST#parameter#Left surveyId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left permanent : AST#type_annotation#Left AST#primary_type#Left boolean AST#pr... | async deleteSurvey(surveyId: number, permanent: boolean = false, isSync = true): Promise<boolean> {
if (!this.rdbStore) {
Logger.info('[deleteSurvey]', 'deleteSurvey() has no callback!');
return false;
}
try {
if (permanent) {
const questionPredicates: relationalStore.RdbPre... | https://github.com/JinnyWang-Space/guanlanwenjuan.git/blob/601c4aa6c427e643d7bf42bc21945f658738e38c/common/src/main/ets/database/DistributedDB.ets#L178-L216 | d3946aa34bd8eeae58c7699fb0f55ba89cd8651c | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | HTTP请求头接口 | export type HttpHeader = Record<string, string>; | AST#export_declaration#Left export AST#type_declaration#Left type HttpHeader = AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_annotation#Left AST#prima... | export type HttpHeader = Record<string, string>; | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L116-L116 | 56e844d82134a70ab21390b05b20290a30d2d699 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/settings/SettingsService.ets | arkts | createDefaultSettings | 创建默认设置
@returns 默认设置 | private createDefaultSettings(): AppSettings {
const now: string = new Date().toISOString();
const defaultThemeSettings: ThemeSettings = {
mode: ThemeMode.AUTO,
primaryColor: '#007AFF',
accentColor: '#FF9500',
customColors: {},
animationEnabled: true,
animationDuration: 300,... | AST#method_declaration#Left private createDefaultSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_decl... | private createDefaultSettings(): AppSettings {
const now: string = new Date().toISOString();
const defaultThemeSettings: ThemeSettings = {
mode: ThemeMode.AUTO,
primaryColor: '#007AFF',
accentColor: '#FF9500',
customColors: {},
animationEnabled: true,
animationDuration: 300,... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/settings/SettingsService.ets#L643-L871 | 31e484306fa07428f043f973c0ba2c4b03e69d0c | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets | arkts | headBuilder | 标题 | @Builder
headBuilder() {
Column() {
Text(this.options.title)
.fontSize(14)
.fontColor(this.options.titleFontColor ?? $r('app.color.harmony_dialog_title_color'))
.align(Alignment.Center)
.textAlign(TextAlign.Center)
.padding({ left: 10, right: 10, bottom: 15, top: 15 }... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right headBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_elem... | @Builder
headBuilder() {
Column() {
Text(this.options.title)
.fontSize(14)
.fontColor(this.options.titleFontColor ?? $r('app.color.harmony_dialog_title_color'))
.align(Alignment.Center)
.textAlign(TextAlign.Center)
.padding({ left: 10, right: 10, bottom: 15, top: 15 }... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/component/ActionSheetDialogView.ets#L123-L144 | 21da1d81045b093a4a3a738c8c9a39bcae8a4d6c | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/Functions.ets | arkts | 获取 图片地址
@param { TabMenusInterfaceIRequired } item - menu 选项
@param { number } index - 当前图片下标
@returns { PixelMap | ResourceStr | DrawableDescriptor } | export function getImageUrl(item: TabMenusInterfaceIRequired, index: number,
selectIndex: number): PixelMap | ResourceStr | DrawableDescriptor {
if (index === selectIndex) {
if (item.selectImage) {
return item.selectImage
}
}
return item.image!
} | AST#export_declaration#Left export AST#function_declaration#Left function getImageUrl AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabMenusInterfaceIRequired AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_a... | export function getImageUrl(item: TabMenusInterfaceIRequired, index: number,
selectIndex: number): PixelMap | ResourceStr | DrawableDescriptor {
if (index === selectIndex) {
if (item.selectImage) {
return item.selectImage
}
}
return item.image!
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdrawtabbar/src/main/ets/utils/Functions.ets#L27-L35 | f12d2adf3c461bda762530620c7b8091f0d761db | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/common/CommonConstants.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants{
static readonly MAX_AMPLITUDE: number = 15000;
static readonly MIN_AMPLITUDE: number = 2000;
static readonly COLUMN_HEIGHT: number = 100;
static readonly SET_INTERVAL_TIME: number = 100;
static readonly OPACITY_FALSE: number = 0;
static readonly OPACITY_TRUE: number = 1;
stat... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { AST#property_declaration#Left static readonly MAX_AMPLITUDE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 15000 AST#expression#Right ... | export class CommonConstants{
static readonly MAX_AMPLITUDE: number = 15000;
static readonly MIN_AMPLITUDE: number = 2000;
static readonly COLUMN_HEIGHT: number = 100;
static readonly SET_INTERVAL_TIME: number = 100;
static readonly OPACITY_FALSE: number = 0;
static readonly OPACITY_TRUE: number = 1;
stat... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/common/CommonConstants.ets#L16-L37 | e8b6d86a5336bc55a619cfef31783fcca85705d0 | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets | arkts | registerDataChangeListener | 注册消息监听函数 | public registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
console.info('add listener');
this.listeners.push(listener);
}
} | AST#method_declaration#Left public registerDataChangeListener AST#parameter_list#Left ( AST#parameter#Left listener : AST#type_annotation#Left AST#primary_type#Left DataChangeListener AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_t... | public registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
console.info('add listener');
this.listeners.push(listener);
}
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/XiaoXunAI/entry/src/main/ets/model/ChatDataSource.ets#L68-L73 | e3c91523f62413282a7cda6bc317bd1917bf052e | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/PieDataSet.ets | arkts | getHighlightColor | Gets the color for the highlighted sector @Override @Nullable | public getHighlightColor(): number | null {
return this.mHighlightColor;
} | AST#method_declaration#Left public getHighlightColor AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_statem... | public getHighlightColor(): number | null {
return this.mHighlightColor;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/PieDataSet.ets#L264-L266 | f110ef1099e0652ede21e49b7630a6dc70c9cc7b | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | getDisplayPhone | 获取展示手机号
@returns {ResourceStr} 展示手机号 | getDisplayPhone(): ResourceStr {
const phone: string = this.userState.getUserInfo().phone?.trim() ?? "";
return phone.length > 0 ? phone : $r("app.string.user_profile_phone_empty");
}
/**
* 执行退出登录
* @returns {void} 无返回值
*/
logout(): void {
this.userState.logout();
navigateBack();
} | AST#method_declaration#Left getDisplayPhone AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left ph... | getDisplayPhone(): ResourceStr {
const phone: string = this.userState.getUserInfo().phone?.trim() ?? "";
return phone.length > 0 ? phone : $r("app.string.user_profile_phone_empty");
}
logout(): void {
this.userState.logout();
navigateBack();
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L38-L50 | e4374e78c41cd3695f2ceaeb7e4642ed543a6da1 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.router.d.ets | arkts | @typedef RouterState
@syscap SystemCapability.ArkUI.ArkUI.Full
@since 8
@typedef RouterState
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 10
@typedef RouterState
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 11 | export interface RouterState {
/**
* Index of the current page in the stack.
* NOTE: The index starts from 1 from the bottom to the top of the stack.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 8
*/
/**
* Index of the current page in the stac... | AST#export_declaration#Left export AST#interface_declaration#Left interface RouterState AST#object_type#Left { /**
* Index of the current page in the stack.
* NOTE: The index starts from 1 from the bottom to the top of the stack.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | export interface RouterState {
index: number;
name: string;
path: string;
params: Object;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.router.d.ets#L215-L307 | 76fa8678575ea8ace3dac4f6c42cc37efec6ff09 | gitee | |
wcmzllx/axis-render | 34a330085691968cf1c132095e5ce078aa7ee933 | AxisRenderLibrary/src/main/ets/common/AxisRender.ets | arkts | 指示器位置 | export enum IndicatorPosition {
START = 0, // 最左边
CENTER = 1,// 中间
END = 2 // 最右边
} | AST#export_declaration#Left export AST#enum_declaration#Left enum IndicatorPosition AST#enum_body#Left { AST#enum_member#Left START = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , // 最左边 AST#enum_member#Left CENTER = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , // 中间 AST#enum_... | export enum IndicatorPosition {
START = 0,
CENTER = 1,
END = 2
} | https://github.com/wcmzllx/axis-render/blob/34a330085691968cf1c132095e5ce078aa7ee933/AxisRenderLibrary/src/main/ets/common/AxisRender.ets#L89-L93 | 2a17fe2a1b3cf8c41a5fe8c8c2192d8c171d0008 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | toUpper | 将整个字符串转换为大写
@param str 要转换的字符串
@returns 返回小写的字符串 | static toUpper(str: string = ''): string {
return str.toUpperCase();
} | AST#method_declaration#Left static toUpper 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#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST... | static toUpper(str: string = ''): string {
return str.toUpperCase();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L196-L198 | 80986c237dcea9a8af21fbfef4d2b5cde4cf9ce7 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebClient.ets | arkts | 默认的ArkWebClient | export class ArkWebClient implements BaseArkWebClient {
controller?: webview.WebviewController;
setWebviewController(controller: webview.WebviewController): void {
this.controller = controller;
}
/**
* 异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScript需要在loadUrl完成后,比如onPageEnd中调用。
* @param scri... | AST#export_declaration#Left export AST#class_declaration#Left class ArkWebClient AST#implements_clause#Left implements BaseArkWebClient AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left controller ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left webview . WebviewC... | export class ArkWebClient implements BaseArkWebClient {
controller?: webview.WebviewController;
setWebviewController(controller: webview.WebviewController): void {
this.controller = controller;
}
async runJavaScript(script: string): Promise<string> {
if (this.controller) {
return ArkWebHel... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebClient.ets#L8-L57 | cb84868a4fe64036e36403c876292431fd922421 | gitee | |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/utils/MqttUtil.ets | arkts | createConnect | 创建连接 | private async createConnect(): Promise<void> {
if (this.mqttClient === null) {
console.warn('客户端未创建');
return;
}
await this.mqttClient.connect({
userName: this.mqttConfig.userName,
password: this.mqttConfig.password,
connectTimeout: this.mqttConfig.connectTimeout,
MQTTVe... | AST#method_declaration#Left private async createConnect AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST... | private async createConnect(): Promise<void> {
if (this.mqttClient === null) {
console.warn('客户端未创建');
return;
}
await this.mqttClient.connect({
userName: this.mqttConfig.userName,
password: this.mqttConfig.password,
connectTimeout: this.mqttConfig.connectTimeout,
MQTTVe... | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/utils/MqttUtil.ets#L79-L100 | d69041588c0ac7d648e0bdf339128576f5df2072 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/dialog/ActionParameter.ets | arkts | initPrimarySecondaryButton | 左侧按钮,右侧按钮,初始化参数
@param options | static initPrimarySecondaryButton(options: HmDialogOptions) {
//当PrimaryButton和SecondaryButton同时为空时,使用默认按钮
if (!options.primaryButton && !options.secondaryButton) {
options.primaryButton = ActionParameter.config.primaryButton
options.secondaryButton = ActionParameter.config.secondaryButton
}
... | AST#method_declaration#Left static initPrimarySecondaryButton AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left HmDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { //当PrimaryB... | static initPrimarySecondaryButton(options: HmDialogOptions) {
if (!options.primaryButton && !options.secondaryButton) {
options.primaryButton = ActionParameter.config.primaryButton
options.secondaryButton = ActionParameter.config.secondaryButton
}
if (options.primaryButton) {
if (Help... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/dialog/ActionParameter.ets#L343-L407 | 337296e45a3b9b8acf87f888d22065fad3a1f8ee | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets | arkts | buildRequest | 构建请求对象
@param url 请求url
@param method 请求方式
@param headers 请求头
@param cookies 自定义cookie
@param isSecurity 是否开启证书加密
@param loadingTxt 是否覆写loading文本
@param loading 是否开启全局加载框
@param loadingColor loading加载框的背景颜色 默认为 #aa000000
@returns | private static async buildRequest(url: string, method: string, headers?: Record<string, string>,
cookies?: Record<string, string>, loadingTxt?: string, baseURL?: string, loading?: boolean,
loadingColor?: string): Promise<rcp.Request> {
//是否开启全局loading
if (loading ? loading : loading == false ? loading :... | AST#method_declaration#Left private static async buildRequest AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left method : AST#type_annotation#Left AST#primary_type#Left string ... | private static async buildRequest(url: string, method: string, headers?: Record<string, string>,
cookies?: Record<string, string>, loadingTxt?: string, baseURL?: string, loading?: boolean,
loadingColor?: string): Promise<rcp.Request> {
if (loading ? loading : loading == false ? loading : efRcpConfig.lo... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_rcp/src/main/ets/rcp/EfRcpClientApi.ets#L127-L147 | 553f376a5e1db662e35d787d9f46ee9954872877 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/NavigationResultPage.ets | arkts | NavigationResultPage | @file 结果回传示例页视图
@author Joker.X | @ComponentV2
export struct NavigationResultPage {
/**
* 结果回传示例页 ViewModel
*/
@Local
private vm: NavigationResultViewModel = new NavigationResultViewModel();
/**
* 构建结果回传示例页
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: $r("app.string.demo_navigation_result_title"),
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct NavigationResultPage 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#Lef... | @ComponentV2
export struct NavigationResultPage {
@Local
private vm: NavigationResultViewModel = new NavigationResultViewModel();
build() {
AppNavDestination({
title: $r("app.string.demo_navigation_result_title"),
viewModel: this.vm
}) {
this.NavigationResultContent();
}
}
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/NavigationResultPage.ets#L10-L87 | 5d9b2463c2dfd2470d0b97106f730b7dddce2502 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/AESSync.ets | arkts | decodeGCM | 解密-GCM模式
@param str 加密的字符串
@param aesKey AES密钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 | static decodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
//转换密钥
let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding);
// 初始化加解密操作环境:开始解密
let mode = crypto.CryptoMode.DECRYPT_MODE;
//创建解密器
... | AST#method_declaration#Left static decodeGCM AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left aesKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | static decodeGCM(str: string, aesKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): string {
let symKey = CryptoSyncUtil.convertKeyFromStr(aesKey, 'AES256', 256, keyCoding);
let mode = crypto.CryptoMode.DECRYPT_MODE;
let cipher = crypto.createCip... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/AESSync.ets#L203-L219 | cffd4bfae267f71bc3e2cc10d45c614ab6f6a1bf | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | decryptSync | 解密,同步
@param data 加密或者解密的数据。data不能为null。
@param priKey 指定解密私钥。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(RSA1024|PKCS1、RSA2048|PKCS1、等)。 | static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, priKey, null, transformation);
} | AST#method_declaration#Left static decryptSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey :... | static decryptSync(data: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey,
transformation: crypto.RSA_TRAN = 'RSA1024|PKCS1'): cryptoFramework.DataBlob {
return CryptoUtil.decryptSync(data, priKey, null, transformation);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L69-L72 | 18ce53ff57707a6c673cb445117a4bfa51164db4 | gitee |
softfatgay/harmony-netease.git | 5f3d226b72ba8579cacfbd229e4eb0054d63abef | entry/src/main/ets/base/Api.ets | arkts | /好评率 | export const COMMENT_PRAISE = baseUrl + '/xhr/comment/itemGoodRates.json'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMMENT_PRAISE = AST#expression#Left AST#binary_expression#Left AST#expression#Left baseUrl AST#expression#Right + AST#expression#Left '/xhr/comment/itemGoodRates.json' AST#expression#Right AST#binary_expression#Right AS... | export const COMMENT_PRAISE = baseUrl + '/xhr/comment/itemGoodRates.json'; | https://github.com/softfatgay/harmony-netease.git/blob/5f3d226b72ba8579cacfbd229e4eb0054d63abef/entry/src/main/ets/base/Api.ets#L55-L55 | dbdc3d592612c6f628f77a8be453b81b32b53f09 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/AppUtil.ets | arkts | getConfiguration | 获取应用的Configuration
@returns | static getConfiguration(): Configuration {
return AppUtil.getContext().config;
} | AST#method_declaration#Left static getConfiguration AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left Configuration AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#... | static getConfiguration(): Configuration {
return AppUtil.getContext().config;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/AppUtil.ets#L114-L116 | 5412a45a8f55b63b1c6766d608e74e0861863fd7 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | touchInRightThumb | 判断右边滑块滑动 | touchInRightThumb(event?: GestureEvent): boolean {
logger.info(TAG, ' touchInRightThumb');
let pointX: number = this.clearUndefined(event?.fingerList[0].localX)
let pointY: number = this.clearUndefined(event?.fingerList[0].localY)
return this.pointInArea(pointX, pointY, this.rightThumbRect);
} | AST#method_declaration#Left touchInRightThumb AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent 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#pr... | touchInRightThumb(event?: GestureEvent): boolean {
logger.info(TAG, ' touchInRightThumb');
let pointX: number = this.clearUndefined(event?.fingerList[0].localX)
let pointY: number = this.clearUndefined(event?.fingerList[0].localY)
return this.pointInArea(pointX, pointY, this.rightThumbRect);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L450-L456 | 848b64bf1bb91407d9141d0d95d4c23f60907a3e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/model/DrawerOptions.ets | arkts | 自定义DrawerLayout弹框 | export interface DrawerOptions extends BaseDialogOptions {
width: number; //宽度
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DrawerOptions AST#extends_clause#Left extends BaseDialogOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left width : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ... | export interface DrawerOptions extends BaseDialogOptions {
width: number;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/model/DrawerOptions.ets#L4-L7 | 9dae7db76eb0f4ad05b950f7d071ed065b23651a | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | buildEmptyView | 空状态视图 | @Builder
buildEmptyView(title: string, message: string) {
Column() {
Text('🎧')
.fontSize(80)
.opacity(0.3)
Text(title)
.fontSize(18)
.fontWeight(FontWeight.Medium)
.margin({ top: 20 })
Text(message)
.fontSize(14)
.fontColor($r('app.color... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildEmptyView AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left message : AST#type_annotation#L... | @Builder
buildEmptyView(title: string, message: string) {
Column() {
Text('🎧')
.fontSize(80)
.opacity(0.3)
Text(title)
.fontSize(18)
.fontWeight(FontWeight.Medium)
.margin({ top: 20 })
Text(message)
.fontSize(14)
.fontColor($r('app.color... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L1384-L1404 | 921cb872f39d6d0320aa575d0af61f0bcb536f47 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/result/src/main/ets/RequestHelper.ets | arkts | runInternal | 内部执行重载:true 返回响应,false 返回 data | private async runInternal(returnFull: true): Promise<NetworkResponse<T>>; | AST#method_declaration#Left private async runInternal AST#parameter_list#Left ( AST#parameter#Left returnFull : AST#type_annotation#Left AST#primary_type#Left true 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... | private async runInternal(returnFull: true): Promise<NetworkResponse<T>>; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/result/src/main/ets/RequestHelper.ets#L94-L94 | fb404bd4e36a1ca6e86135f4dfbc15f3cbc3a753 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/RSA.ets | arkts | encode2048PKCS1 | 2048位加密
@param encodeStr 待加密的字符串
@param pubKey 2048位RSA公钥 | static async encode2048PKCS1(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsym(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048);
} | AST#method_declaration#Left static async encode2048PKCS1 AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pubKey : AST#type_annotation#Left AST#primary_type#Left string AST#p... | static async encode2048PKCS1(str: string, pubKey: string): Promise<string> {
return CryptoUtil.encodeAsym(str, pubKey, 'RSA2048', 'RSA2048|PKCS1', 2048);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/RSA.ets#L69-L71 | 11edd4b1bfa0a158f319977fbb1d8054bbc59ea5 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DisplayUtil.ets | arkts | isFoldable | 检查设备是否可折叠。
@returns | static isFoldable(): boolean {
return display.isFoldable();
} | AST#method_declaration#Left static isFoldable AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_express... | static isFoldable(): boolean {
return display.isFoldable();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DisplayUtil.ets#L133-L135 | 7379dbfe952044a329ff75ccc48d3c941aa867e1 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 数据设置接口 | export interface DataSettings {
autoBackup: boolean;
backupFrequency: BackupFrequency;
backupLocation: BackupLocation;
maxBackupFiles: number;
syncEnabled: boolean;
dataRetention: number;
syncConfig: SyncConfig;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface DataSettings AST#object_type#Left { AST#type_member#Left autoBackup : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left backupFrequency : AST#typ... | export interface DataSettings {
autoBackup: boolean;
backupFrequency: BackupFrequency;
backupLocation: BackupLocation;
maxBackupFiles: number;
syncEnabled: boolean;
dataRetention: number;
syncConfig: SyncConfig;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L216-L224 | ad719e8d99890c4733a7fbb3809a2731b59e0472 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imagecomment/src/main/ets/components/utils/CameraUtils.ets | arkts | TODO:知识点:通过context.startAbilityForResult接口拉起相机拍照,并通过result返回照片地址 | export async function cameraCapture(context: common.UIAbilityContext): Promise<string> {
// 通过context.startAbilityForResult拉起相机
const result: common.AbilityResult = await context.startAbilityForResult({
action: Constants.ACTION_PICKER_CAMERA, // 拉起相机的action
parameters: {
'supportMultiMode': false, // ... | AST#export_declaration#Left export AST#function_declaration#Left async function cameraCapture AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right ... | export async function cameraCapture(context: common.UIAbilityContext): Promise<string> {
const result: common.AbilityResult = await context.startAbilityForResult({
action: Constants.ACTION_PICKER_CAMERA,
parameters: {
'supportMultiMode': false,
'callBundleName': context.abilityInfo.bundleName... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imagecomment/src/main/ets/components/utils/CameraUtils.ets#L20-L40 | c307e1e2f6ab02fe2327c9da840a24545f0cbd3b | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/model/ConnectModel.ets | arkts | sendMessageToRemoteService | 连接成功后发送消息 传入code | async sendMessageToRemoteService(dataList, code) {
console.log('[handle]connectRemoteService sendMessageToRemoteService:')
if (this.mRemote == null) {
console.log('[handle]connectRemoteService mRemote == null')
prompt.showToast({
message: "mRemote is null",
duration: 30000
});
... | AST#method_declaration#Left async sendMessageToRemoteService AST#parameter_list#Left ( AST#parameter#Left dataList AST#parameter#Right , AST#parameter#Left code AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#... | async sendMessageToRemoteService(dataList, code) {
console.log('[handle]connectRemoteService sendMessageToRemoteService:')
if (this.mRemote == null) {
console.log('[handle]connectRemoteService mRemote == null')
prompt.showToast({
message: "mRemote is null",
duration: 30000
});
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/RemoteControllerETS/entry/src/main/ets/MainAbility/model/ConnectModel.ets#L69-L87 | b5ca111c0ee5ce07838dabe848a301f53817c46f | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.