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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/datasource/BasicDataSource.ets | arkts | 抽象类BasicDataSource,使用泛型T,实现接口IDataSource | export abstract class BasicDataSource<T> implements IDataSource {
// 监听器数组
private listeners: Array<DataChangeListener> = new Array<DataChangeListener>();
// 数据源,支持泛型的数组
private dataSource: Array<T> = new Array<T>();
// 构造函数,接收一个泛型数组作为参数,用于初始化数据源
constructor(dataSource: Array<T>) {
// 初始化数据源
this.d... | AST#export_declaration#Left export AST#class_declaration#Left abstract class BasicDataSource AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#implements_clause#Left implements IDataSource AST#implements_clause#Right AST#class_body#Left { // 监听器数组 AST#property... | export abstract class BasicDataSource<T> implements IDataSource {
private listeners: Array<DataChangeListener> = new Array<DataChangeListener>();
private dataSource: Array<T> = new Array<T>();
constructor(dataSource: Array<T>) {
this.dataSource = dataSource;
}
totalCount(): number {
... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/datasource/BasicDataSource.ets#L4-L112 | e71002f844128600726582b76292eea32c9d854f | github | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/pages/IntroductionPage.ets | arkts | controlImageScale | Control the image scale.
@param this
@param offset
@param state
@returns real list offset. | controlImageScale(offset: number, state: ScrollState): number {
if (offset > 0 && this.imageHeight > Const.MIN_IMAGE_HEIGHT) {
// Scale down the image by offset.
let offsetHeight = (Math.abs(offset) * Const.FULL_PERCENT_NUMBER) / Number(this.screenHeight);
let heightOffset = this.imageHeight - Con... | AST#method_declaration#Left controlImageScale AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left state : AST#type_annotation#Left AST#primary_type#Left ScrollState AST#prima... | controlImageScale(offset: number, state: ScrollState): number {
if (offset > 0 && this.imageHeight > Const.MIN_IMAGE_HEIGHT) {
let offsetHeight = (Math.abs(offset) * Const.FULL_PERCENT_NUMBER) / Number(this.screenHeight);
let heightOffset = this.imageHeight - Const.MIN_IMAGE_HEIGHT > offsetHeight... | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L340-L367 | 34c897a0ab0ed3233f32db483463d8400d576c1a | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/DynamicSyncUtil.ets | arkts | @Author csx
@DateTime 2024/3/20 21:19
@TODO DynamicUtil 动态协商工具类 | export class DynamicSyncUtil {
/**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @param keyCoding 密钥编码方式(utf8/hex/base64)
* @param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
* @returns 共享密钥
*/
static... | AST#export_declaration#Left export AST#class_declaration#Left class DynamicSyncUtil AST#class_body#Left { /**
* 动态协商密钥
* @param pubKey 符合格式的非对称密钥的公钥字符串或Uint8Array字节流
* @param priKey 符合格式的非对称密钥的私钥字符串或Uint8Array字节流
* @param symAlgName 秘钥规格
* @param keyCoding 密钥编码方式(utf8/hex/base64)
* @param resultCod... | export class DynamicSyncUtil {
static dynamicKey(pubKey: string | Uint8Array, priKey: string | Uint8Array, symAlgName: string,
keyName: number, keyCoding: buffer.BufferEncoding,
resultCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
let pubKeyArray: Uint8Array = new Uint8Array();
... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/DynamicSyncUtil.ets#L29-L106 | 5e67950f3aa101f58ff4450b93bb454cd09c049e | gitee | |
yiyefangzhou24/hmwechat | 27d11056003843c7e331e683478720d8efa49d17 | entry/src/main/ets/default/common/components/emojiLayout.ets | arkts | emojiTabContent | emoji表情标签
Tab_item | @Builder emojiTabContent(){
Grid(){
ForEach(this.emojiItems , item=>{
GridItem() {
Image($rawfile(item.file))
.height(30)
.width(30)
}
},item => item.tag)
}
.columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr')
.width('100%')
.height(200)
.... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right emojiTabContent 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 Grid ( ) AST#container_content_body#Left { AST#ui_control_... | @Builder emojiTabContent(){
Grid(){
ForEach(this.emojiItems , item=>{
GridItem() {
Image($rawfile(item.file))
.height(30)
.width(30)
}
},item => item.tag)
}
.columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr')
.width('100%')
.height(200)
.... | https://github.com/yiyefangzhou24/hmwechat/blob/27d11056003843c7e331e683478720d8efa49d17/entry/src/main/ets/default/common/components/emojiLayout.ets#L79-L97 | 110ee698eea81dd4bd3c3c35389bbcb68661e8ca | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/ContactsPage.ets | arkts | loadContacts | 加载联系人数据 | private async loadContacts(): Promise<void> {
try {
this.loading = true;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Starting to load contacts from ContactService...');
const contacts = await this.contactService.getAllContacts();
hilog.info(LogConstants.DOMAIN_APP, LogConstan... | AST#method_declaration#Left private async loadContacts 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 loadContacts(): Promise<void> {
try {
this.loading = true;
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'Starting to load contacts from ContactService...');
const contacts = await this.contactService.getAllContacts();
hilog.info(LogConstants.DOMAIN_APP, LogConstan... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/ContactsPage.ets#L55-L79 | 73a49d90cc7021d579a3f15c4a6f17c8e9b2bb16 | github |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/index.ets | arkts | Copyright (c) 2022-2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | export * from "./generated" | AST#export_declaration#Left export * from "./generated" AST#export_declaration#Right | export * from "./generated" | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/index.ets#L15-L15 | bfa6511e3fbd4d8ce8cc2f634fd8a09535471fed | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets | arkts | getValues | /** * This method is deprecated. * Use getEntries() instead. * * @return @Deprecated | public getValues(): JArrayList<T> {
return this.mEntries;
} | AST#method_declaration#Left public getValues AST#parameter_list#Left ( ) AST#parameter_list#Right : 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 T AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | public getValues(): JArrayList<T> {
return this.mEntries;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets#L144-L146 | 17d1f9657b602db79d48ea70092e7fb7407c816a | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/managers/SystemSizeManager.ets | arkts | SystemSizeManager | 系统栏与可用区域管理工具
功能:动态计算排除系统栏后的可用区域尺寸 | @ObservedV2
export class SystemSizeManager {
private static instance: SystemSizeManager;
private windowObj: window.Window | null = null;
// 系统栏高度(像素单位)
@Trace private _statusBarHeightPx: number = 0;
@Trace private _bottomNavBarHeightPx: number = 0;
@Trace private _indicatorHeightPx: number = 0;
// 窗口原始尺... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export class SystemSizeManager AST#class_body#Left { AST#property_declaration#Left private static instance : AST#type_annotation#Left AST#primary_type#Left SystemSizeManager AST#primary_type#Right AST#type_annotation#Right ; AST#p... | @ObservedV2
export class SystemSizeManager {
private static instance: SystemSizeManager;
private windowObj: window.Window | null = null;
@Trace private _statusBarHeightPx: number = 0;
@Trace private _bottomNavBarHeightPx: number = 0;
@Trace private _indicatorHeightPx: number = 0;
@Trace private _win... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/managers/SystemSizeManager.ets#L7-L118 | 3fd755a4fc0550ac574590c71f4bb9681c189fd3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | getErrorMsg | 获取错误msg
@param code
@param defaultMsg | public static getErrorMsg(code: number, defaultMsg: string) {
if (201 == code) {
return '权限校验失败!'
} else if (202 == code) {
return '系统API权限校验失败!'
} else if (401 == code) {
return '参数检查失败!'
} else if (801 == code) {
return '该设备不支持此API!'
} else if (1600001 == code) {
retu... | AST#method_declaration#Left public static getErrorMsg AST#parameter_list#Left ( AST#parameter#Left code : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left defaultMsg : AST#type_annotation#Left AST#primary_type#Left string AST... | public static getErrorMsg(code: number, defaultMsg: string) {
if (201 == code) {
return '权限校验失败!'
} else if (202 == code) {
return '系统API权限校验失败!'
} else if (401 == code) {
return '参数检查失败!'
} else if (801 == code) {
return '该设备不支持此API!'
} else if (1600001 == code) {
retu... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L555-L593 | 782b5299705fe0349622c9ca1eb0d9bbe9a45bab | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceNavigation.d.ets | arkts | AtomicServiceNavigation | Defines AtomicServiceNavigation.
@struct { AtomicServiceNavigation }
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | @Component
export declare struct AtomicServiceNavigation {
/**
* the information of route page.Providers methods for controlling destination page in the stack.
*
* @type { ?NavPathStack }.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
@State
navPathStack?: NavPat... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right struct AtomicServiceNavigation AST#component_body#Left { /**
* the information of route page.Providers methods for controlling destination page in the stack.
*
* @type { ?NavPa... | @Component
export declare struct AtomicServiceNavigation {
@State
navPathStack?: NavPathStack;
@BuilderParam
navigationContent?: Callback<void>;
@Prop
title?: ResourceStr;
@Prop
titleOptions?: TitleOptions;
@Prop
gradientBackground?: GradientBackground;
@Prop
hideTitleBar?: b... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceNavigation.d.ets#L145-L308 | 0d39fb39e9ba5be7af1dd332e8d26cbc98484148 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/component/TipLayout.ets | arkts | TipLayout | 自定义底部菜单组件 | @Preview
@ComponentV2
export struct TipLayout {
@Require @Param options: TipOptions;
aboutToAppear(): void {
this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background');
this.options.backgroundBlurStyle = this.options.backgroundBlurStyle ?? BlurStyle.COMPONENT_ULTRA_THICK... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct TipLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right opti... | @Preview
@ComponentV2
export struct TipLayout {
@Require @Param options: TipOptions;
aboutToAppear(): void {
this.options.backgroundColor = this.options.backgroundColor ?? $r('app.color.main_background');
this.options.backgroundBlurStyle = this.options.backgroundBlurStyle ?? BlurStyle.COMPONENT_ULTRA_THICK... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/component/TipLayout.ets#L13-L64 | a5692baa915afdf5ab0b907426201c0d0592801f | gitee |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets | arkts | SelectComponent | 保存或重置书籍编辑内容组件 | @Builder SelectComponent() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Button(){
Text('重置')
.fontSize(16)
.fontColor(this.BtnConfirmColor)
}
.backgroundColor(this.BtnCancelColor)
.width(152)
.height(38)
.onClick(()=>{
})
Button(){
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right SelectComponent 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 Flex ( AST#component_parameters#Left { AST#component_param... | @Builder SelectComponent() {
Flex({justifyContent: FlexAlign.SpaceBetween}){
Button(){
Text('重置')
.fontSize(16)
.fontColor(this.BtnConfirmColor)
}
.backgroundColor(this.BtnCancelColor)
.width(152)
.height(38)
.onClick(()=>{
})
Button(){
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookEditor/BookEditorPage.ets#L77-L105 | 16c824b953d2951d4de6942e06375e3a85f0df85 | github |
1lck/MindFlow.git | f05fab0891716cb852946ac02ed08dd2c0b9155a | front/entry/src/main/ets/pages/tabs/MineTab.ets | arkts | getIconColor | 获取图标背景色 | getIconColor(index: number): string {
const colors = [
Theme.primary,
Theme.secondary,
Theme.accent,
'#4FC3F7',
'#9F85FF',
'#FFB74D'
];
return colors[index % colors.length];
} | AST#method_declaration#Left getIconColor AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | getIconColor(index: number): string {
const colors = [
Theme.primary,
Theme.secondary,
Theme.accent,
'#4FC3F7',
'#9F85FF',
'#FFB74D'
];
return colors[index % colors.length];
} | https://github.com/1lck/MindFlow.git/blob/f05fab0891716cb852946ac02ed08dd2c0b9155a/front/entry/src/main/ets/pages/tabs/MineTab.ets#L239-L249 | 3b5660fd1e013dd8f24146caf6bffc3ee0b207af | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets | arkts | clear | 清空数据 | public clear(){
this.originDataArray = [];
this.notifyDataReload();
} | AST#method_declaration#Left public clear 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 . originDataArray AST#member_expression... | public clear(){
this.originDataArray = [];
this.notifyDataReload();
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/common/LazyIDataSource/BasicDataSource.ets#L25-L28 | fe5d547a1adc56df8b9392c28bc9713c615f8004 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/view/ExpandPage.ets | arkts | 构建扩展页面
@returns {void} 无返回值 | build() {
AppNavDestination({
title: $r("app.string.expand"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ExpandContent();
}... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left title : AST#expression#Left AST#resource_expression#Left $r ( AST#expression#Left "app.string.expand" ... | build() {
AppNavDestination({
title: $r("app.string.expand"),
viewModel: this.vm,
paddingValue: {
top: this.windowSafeAreaState.topInset,
left: this.windowSafeAreaState.leftInset,
right: this.windowSafeAreaState.rightInset,
}
}) {
this.ExpandContent();
}... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/view/ExpandPage.ets#L29-L41 | 0b96198bdeb2938e0236a9f621ee2321b5d17a37 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Define LocalStorage.
@since 9 | export class LocalStorage {
private static shared?: LocalStorage
/** @internal */ readonly map: StorageMap
/**
* Constructor.
* @since 9
*/
constructor | AST#export_declaration#Left export AST#ERROR#Left class LocalStorage { AST#property_declaration#Left private static shared ? : AST#type_annotation#Left AST#primary_type#Left LocalStorage AST#primary_type#Right AST#type_annotation#Right /** @internal */ AST#property_declaration#Right readonly map : StorageMap AST#ERROR... | export class LocalStorage {
private static shared?: LocalStorage
readonly map: StorageMap
constructor | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L429-L437 | 1715c96983dc43576f6f806ab59d6edc2f915df2 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets | arkts | 获取任务的进度记录
@param taskId 任务ID
@returns 进度记录列表 | export function getTaskProgress(taskId: number): Promise<Progress[]> {
try {
return request<Progress[]>(
RequestMethod.GET,
`/progress/task/${taskId}`
);
} catch (error) {
console.error(`获取任务进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取任务进度记录失败:... | AST#export_declaration#Left export AST#function_declaration#Left function getTaskProgress AST#parameter_list#Left ( AST#parameter#Left taskId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left... | export function getTaskProgress(taskId: number): Promise<Progress[]> {
try {
return request<Progress[]>(
RequestMethod.GET,
`/progress/task/${taskId}`
);
} catch (error) {
console.error(`获取任务进度记录失败: ${error instanceof Error ? error.message : String(error)}`);
throw new Error(`获取任务进度记录失败:... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/TaskService.ets#L120-L130 | 9fe616ecc212874951e947e0ff96e866266a2198 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkListDataSource.ets | arkts | addData | 在指定索引位置增加一个元素
@param index | public addData(index: number, data: WorkItem): void {
this.dataList.splice(index, 0, data);
this.notifyDataAdd(index);
} | AST#method_declaration#Left public addData 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 data : AST#type_annotation#Left AST#primary_type#Left WorkItem AST#primary_type#... | public addData(index: number, data: WorkItem): void {
this.dataList.splice(index, 0, data);
this.notifyDataAdd(index);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/model/WorkListDataSource.ets#L42-L45 | 4b103e4d54c2c6a7894d9fa2616ed3c14156c88c | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets | arkts | @memo | export function hookSelectContentModifier(
receiver: ArkSelectComponent, value?: ContentModifier<MenuItemConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const menuItemBuilder = (parentNode: KPointer, config: MenuItemConfiguration): KPointer => {... | AST#export_declaration#Left export AST#function_declaration#Left function hookSelectContentModifier AST#parameter_list#Left ( AST#parameter#Left receiver : AST#type_annotation#Left AST#primary_type#Left ArkSelectComponent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value ? ... | export function hookSelectContentModifier(
receiver: ArkSelectComponent, value?: ContentModifier<MenuItemConfiguration>) {
const wrappedBuilder = value?.applyContent()
if (!wrappedBuilder) {
return
}
const menuItemBuilder = (parentNode: KPointer, config: MenuItemConfiguration): KPointer => {... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/handwritten/ContentModifierHooks.ets#L194-L207 | 6ba940325f45561f975c04860b15937193b8f9b3 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/image/Avatar.ets | arkts | Avatar | @file 头像组件(基于 IBestAvatar 封装)
@author Joker.X | @ComponentV2
export struct Avatar {
/**
* 头像地址
*/
@Param
src: ResourceStr | PixelMap | DrawableDescriptor = "";
/**
* 头像大小(单位:vp)
*/
@Param
avatarSize: number = 40;
/**
* 点击回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建头像组件
* @returns {void} 无返回值
*/
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct Avatar AST#component_body#Left { /**
* 头像地址
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right src : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ResourceStr ... | @ComponentV2
export struct Avatar {
@Param
src: ResourceStr | PixelMap | DrawableDescriptor = "";
@Param
avatarSize: number = 40;
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
IBestAvatar({
src: this.src,
shape: "circle",
avatarSize: this.avatarSize... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/image/Avatar.ets#L7-L47 | 9c97223627b9fea8def6e03768994f0c9912422a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationService.ets | arkts | requestPermission | 请求通知权限 | public async requestPermission(): Promise<boolean> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Requesting notification permission...');
// 模拟权限请求
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[Noti... | AST#method_declaration#Left public async requestPermission 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 boolean AST#primary_type#Right AST#type_annotation#Right... | public async requestPermission(): Promise<boolean> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[NotificationService] Requesting notification permission...');
return true;
} catch (error) {
hilog.error(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `[NotificationS... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationService.ets#L128-L138 | ad2d2320c8af3715648b0661467707b93e5cdcc1 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/prompt/ConfirmUtil.ets | arkts | ConfirmUtil | @Author csx
@DateTime 2024/3/27 19:56
@TODO ConfirmUtil
@Use 详细使用方法以及文档详见ohpm官网,地址https://ohpm.openharmony.cn/#/cn/detail/@yunkss%2Fef_ui | @Component
export struct ConfirmUtil {
@Prop @Watch("change") options: ConfirmOptions = new ConfirmOptions();
private isChecked: boolean = false;
/**
* 自定义Tips
*/
private dialogControllerProgress: CustomDialogController = new CustomDialogController({
builder: ConfirmDialog({
title: this.options.... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ConfirmUtil AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Prop AST#decorator#Right AST#decorator#Left @ Watch ( AST#expression#Left "change" AST#expression#Right ) AST#decorator#Right op... | @Component
export struct ConfirmUtil {
@Prop @Watch("change") options: ConfirmOptions = new ConfirmOptions();
private isChecked: boolean = false;
private dialogControllerProgress: CustomDialogController = new CustomDialogController({
builder: ConfirmDialog({
title: this.options.title,
content: ... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/prompt/ConfirmUtil.ets#L26-L80 | 14bf90e5ce976c537746ffd7bcb352339dd1a943 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/FormatUtil.ets | arkts | getPhoneFormat | 对电话号码进行格式化
@param phone
country string 表示电话号码所属国家或地区代码。
options PhoneNumberFormatOptions 电话号码格式化对象的相关选项。默认值:NATIONAL。
@returns | static getPhoneFormat(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): string {
const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option);
return phoneNumberFormat.format(phone);
} | AST#method_declaration#Left static getPhoneFormat AST#parameter_list#Left ( AST#parameter#Left phone : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left country : AST#type_annotation#Left AST#primary_type#Left string AST#prima... | static getPhoneFormat(phone: string, country: string = "CN", option?: i18n.PhoneNumberFormatOptions): string {
const phoneNumberFormat: i18n.PhoneNumberFormat = new i18n.PhoneNumberFormat(country, option);
return phoneNumberFormat.format(phone);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/FormatUtil.ets#L50-L53 | 3cf63d3b09c078a4bb2eeeb27eef7abc5a3568a4 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | AtomicServiceWebController | Provides methods for controlling the AtomicServiceWeb controller.
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | @Observed
export declare class AtomicServiceWebController {
/**
* Gets the default user agent.
*
* @returns { string } Return user agent information.
* @throws { BusinessError } 17100001 - Init error. The AtomicServiceWebController must be associated with a
* AtomicServiceWeb component.
* @syscap... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export AST#ERROR#Left declare AST#ERROR#Right class AtomicServiceWebController AST#class_body#Left { /**
* Gets the default user agent.
*
* @returns { string } Return user agent information.
* @throws { BusinessError } 1... | @Observed
export declare class AtomicServiceWebController {
getUserAgent(): string;
getCustomUserAgent(): string;
setCustomUserAgent(userAgent: string): void;
refresh(): void;
forward(): void;
backward(): void;
accessForward(): boolean;
accessBackward(): boolean;
acc... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L343-L471 | 5792a31f4971b7d370ea8774bb23fc2fa79f7fcb | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets | arkts | popToName | [Start static_popToName] 直接跳转到指定路由 | public static popToName(routerName: string, builderName: string): void {
RouterModule.getRouter(routerName).popToName(builderName);
} | AST#method_declaration#Left public static popToName AST#parameter_list#Left ( AST#parameter#Left routerName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left builderName : AST#type_annotation#Left AST#primary_type#Left strin... | public static popToName(routerName: string, builderName: string): void {
RouterModule.getRouter(routerName).popToName(builderName);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/NavigationRouter/RouterModule/src/main/ets/utils/RouterModule.ets#L76-L78 | 74049b9b93ba079058ef2fd388f1e9e44c5cade6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | onRangeValueChanged | 选取时间变动事件 | onRangeValueChanged() {
let x0: number = this.scroller.currentOffset().xOffset;
let start: number = x0 + this.leftThumbRect[2] - this.leftThumbWidth;
let end: number = start + this.transparentWidth;
let startTime: number = start * CommonConstants.US_ONE_SECOND / this.msPxAvg;
this.leftText = this.s... | AST#method_declaration#Left onRangeValueChanged AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left x0 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = ... | onRangeValueChanged() {
let x0: number = this.scroller.currentOffset().xOffset;
let start: number = x0 + this.leftThumbRect[2] - this.leftThumbWidth;
let end: number = start + this.transparentWidth;
let startTime: number = start * CommonConstants.US_ONE_SECOND / this.msPxAvg;
this.leftText = this.s... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/RangeSeekBarView.ets#L361-L374 | cbe1afe3f8c239c75045918ef9a03782948ece9a | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | OptimizationAppDelay/entry/src/main/ets/pages/TabsNegativeExample.ets | arkts | [EndExclude tabs_negative_example] | build() {
Column() {
// [StartExclude tabs_negative_example]
Row({ space: 10 }) {
ForEach(this.list, (item: string, index: number) => {
Text(item)
.textAlign(TextAlign.Center)
.fontSize(16)
.height(32)
.layoutWeight(1)
.fontCo... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // [StartExclude tabs_negative_example] AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( AST#compo... | build() {
Column() {
Row({ space: 10 }) {
ForEach(this.list, (item: string, index: number) => {
Text(item)
.textAlign(TextAlign.Center)
.fontSize(16)
.height(32)
.layoutWeight(1)
.fontColor(this.currentIndex === index ? Color... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/OptimizationAppDelay/entry/src/main/ets/pages/TabsNegativeExample.ets#L42-L92 | 98b3abb1436f1eca7cff60443e0b43132e3ef0fd | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets | arkts | getData | 获取索引对应的数据
@param index 数组索引
@returns | public getData(index: number): SceneModuleInfo {
return this.dataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left SceneModuleInfo AST#prima... | public getData(index: number): SceneModuleInfo {
return this.dataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/functionalscenes/src/main/ets/model/WaterFlowDataSource.ets#L36-L38 | d733404f72a3eafaa6b71c101d650ff0b85ae140 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Share page url. | export const SHARE_PAGE_URL = 'pages/SharePage'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left SHARE_PAGE_URL = AST#expression#Left 'pages/SharePage' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const SHARE_PAGE_URL = 'pages/SharePage'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L120-L120 | 699c0a4359b722025f05a23a53d74c165273bd50 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/SM3.ets | arkts | digest | SM3摘要
@param str 带摘要的字符串
@returns 摘要后的字符串 | static async digest(str: string): Promise<OutDTO<string>> {
return CryptoUtil.digest(str, 'SM3');
} | AST#method_declaration#Left static async digest AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | static async digest(str: string): Promise<OutDTO<string>> {
return CryptoUtil.digest(str, 'SM3');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/SM3.ets#L32-L34 | 77d950825d35dfd77266912bfdb7c693d4c4f845 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets | arkts | pop | overwrite and overload function of NavPathStack | pop(animated?: boolean | undefined): NavPathInfo | undefined
pop(result: Object, animated?: boolean | undefined): NavPathInfo | undefined
pop(result?: Object, animated?: boolean | undefined): NavPathInfo | undefined {
console.log('[derive-test] reached DerivedNavPathStack\'s pop');
return super.pop(result, ... | AST#method_declaration#Left pop AST#parameter_list#Left ( AST#parameter#Left animated ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left boolean AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#pa... | pop(animated?: boolean | undefined): NavPathInfo | undefined
pop(result: Object, animated?: boolean | undefined): NavPathInfo | undefined
pop(result?: Object, animated?: boolean | undefined): NavPathInfo | undefined {
console.log('[derive-test] reached DerivedNavPathStack\'s pop');
return super.pop(result, ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template10/Index.ets#L42-L47 | 1b8560565ff75f5f1586b37415f6612803dd2f63 | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets | arkts | Class that contains information about the charts current viewport settings, including offsets, scale & translation
levels, ...
@author Philipp Jahoda | export default class ViewPortHandler {
/**
* matrix used for touch events
*/
public mMatrixTouch: Matrix = new Matrix();
/**
* this rectangle defines the area in which graph values can be drawn
*/
protected mContentRect = new MyRect();
protected mChartWidth: number = 0;
protected mChartHeight: ... | AST#export_declaration#Left export default AST#ERROR#Left class ViewPortHandler { /**
* matrix used for touch events
*/ AST#property_declaration#Left public mMatrixTouch : AST#type_annotation#Left AST#primary_type#Left Matrix AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#call_expressi... | export default class ViewPortHandler {
public mMatrixTouch: Matrix = new Matrix();
protected mContentRect = new MyRect();
protected mChartWidth: number = 0;
protected mChartHeight: number = 0;
private mMinScaleY: number = 1;
private mMaxScaleY: number = Number.MAX_VALUE;
private mMinSca... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets#L28-L387 | 3f732e10425c87db6365b00f94e67c3563c249ac | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/subscription/SubscriptionInfoManager.ets | arkts | loadPreference | 加载本地配置 | private loadPreference(): void {
try {
const prefs = SubscriptionInfoPrefKeys._getPrefs();
this._isWaitingRefreshToServer = prefs.getSync(SubscriptionInfoPrefKeys.kWaitingRefresh, false) as boolean;
} catch (err) {
DebugLog.d(`SubscriptionInfoManager.loadPreference error: ${err}`);
this.... | AST#method_declaration#Left private loadPreference 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 { AST#statement... | private loadPreference(): void {
try {
const prefs = SubscriptionInfoPrefKeys._getPrefs();
this._isWaitingRefreshToServer = prefs.getSync(SubscriptionInfoPrefKeys.kWaitingRefresh, false) as boolean;
} catch (err) {
DebugLog.d(`SubscriptionInfoManager.loadPreference error: ${err}`);
this.... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/subscription/SubscriptionInfoManager.ets#L67-L75 | 3598a74081e64de41535c1f6ac478e4c2ca607ee | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets | arkts | doHttpRequest | 发起http请求 | doHttpRequest() {
let rcpCfg = this.buildRcpCfg()
let rcpSession: rcp.Session = rcp.createSession(rcpCfg)
rcpSession.get(this.httpsUrl).then((response) => {
if (response.body != undefined) {
let result = buf2String(response.body)
this.msgHistory += '请求响应信息: ' + result + "\r\n";
}... | AST#method_declaration#Left doHttpRequest AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left rcpCfg = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#... | doHttpRequest() {
let rcpCfg = this.buildRcpCfg()
let rcpSession: rcp.Session = rcp.createSession(rcpCfg)
rcpSession.get(this.httpsUrl).then((response) => {
if (response.body != undefined) {
let result = buf2String(response.body)
this.msgHistory += '请求响应信息: ' + result + "\r\n";
}... | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/rcp/RCPCertVerify/entry/src/main/ets/pages/Index.ets#L183-L194 | bcc72dd6a760ef4178fbdb7ff9d7a35875a5f21a | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/gesture.d.ets | arkts | Defines RotationGesture.
@extends Gesture
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export declare class RotationGesture extends Gesture {
/**
* Set the value.
*
* @param { function } factory
* @param { RotationGestureHandlerOptions } value
* @returns { RotationGesture }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
*
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class RotationGesture extends AST#type_annotation#Left AST#primary_type#Left Gesture AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* Set the value.
*
* @param { function } fac... | export declare class RotationGesture extends Gesture {
static $_instantiate(factory: () => RotationGesture, value?: RotationGestureHandlerOptions): RotationGesture;
onActionStart(event: Callback<GestureEvent>): RotationGesture;
onActionUpdate(event: Callback<GestureEvent>): RotationGesture;
... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/gesture.d.ets#L652-L715 | 36f0af699da023ed0add5f459c515f795cb8fe85 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/SettingsTypes.ets | arkts | 通知渠道配置接口 | export interface NotificationChannelConfig {
enabled: boolean;
importance: NotificationImportance;
showBadge: boolean;
sound: boolean;
vibration: boolean;
lightColor?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface NotificationChannelConfig AST#object_type#Left { AST#type_member#Left enabled : 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 importance : AS... | export interface NotificationChannelConfig {
enabled: boolean;
importance: NotificationImportance;
showBadge: boolean;
sound: boolean;
vibration: boolean;
lightColor?: string;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/SettingsTypes.ets#L300-L307 | 8c1547c05a3d9751bc0a4b8cee90d5438c498b1e | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/core/DialogHub.ets | arkts | 弹窗中心DialogHub
@author pll
@create 2025-05-20
@modify 2025-05-30 | export class DialogHub {
private static isInit = false;
/**
* 默认配置
*/
static config: DialogConfig = new DialogConfig();
/**
* 设置默认统一样式
* @param configs 配置
*/
static init(configs: (config: DialogConfig) => void): void {
if (DialogHub.isInit) {
// 后续有监听,这边要开启,如:多端适配监听屏幕变化xs、md、lg等
... | AST#export_declaration#Left export AST#class_declaration#Left class DialogHub AST#class_body#Left { AST#property_declaration#Left private static isInit = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right ; AST#property_declaration#Right /**
* 默认配置
*/ AST#property_de... | export class DialogHub {
private static isInit = false;
static config: DialogConfig = new DialogConfig();
static init(configs: (config: DialogConfig) => void): void {
if (DialogHub.isInit) {
return
}
configs(DialogHub.config);
DialogHub.isInit = true
}
static ge... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/core/DialogHub.ets#L32-L275 | 37edb1d3719bdb7f165e3b421346857697d7f127 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_ui/src/main/ets/ui/base/PreviewUtil.ets | arkts | openPreview | 打开预览
@param type 预览类型
@param uri 预览uri
@returns | private static async openPreview(type: string, uri: string): Promise<void> {
//获取上下文
let uiContext = getContext() as common.UIAbilityContext;
//预览格式判断
let result = PreviewUtil.rightFileSuffix(type, uri);
if (result.getSuccess()) {
//获取文件信息
let fileUriObject = new fileUri.FileUri(uri);
... | AST#method_declaration#Left private static async openPreview AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST... | private static async openPreview(type: string, uri: string): Promise<void> {
let uiContext = getContext() as common.UIAbilityContext;
let result = PreviewUtil.rightFileSuffix(type, uri);
if (result.getSuccess()) {
let fileUriObject = new fileUri.FileUri(uri);
let fileName... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_ui/src/main/ets/ui/base/PreviewUtil.ets#L77-L105 | 0d06c6a18d2ad5ddbb1d9caa6d5cc7daaf8efa67 | gitee |
EL233/WeChat-HarmonyOS.git | b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e | entry/src/main/ets/view/component/Dialog.ets | arkts | updateDialog | 更新自定义对话框 | updateDialog(options: object) {
if (this.contentNode !== null && this.contentNode !== undefined) {
this.ctx?.getPromptAction()
.updateCustomDialog(this.contentNode, options)
.then(() => {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'UpdateCustomDialog complete'); // 记录日志,... | AST#method_declaration#Left updateDialog AST#parameter_list#Left ( AST#parameter#Left options : 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#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statem... | updateDialog(options: object) {
if (this.contentNode !== null && this.contentNode !== undefined) {
this.ctx?.getPromptAction()
.updateCustomDialog(this.contentNode, options)
.then(() => {
hilog.info(0xFF00, 'PersonalInformation', '%{public}s', 'UpdateCustomDialog complete');
... | https://github.com/EL233/WeChat-HarmonyOS.git/blob/b5fa65556eb5f5698a92ec289ffd9ebe4cc5bb3e/entry/src/main/ets/view/component/Dialog.ets#L65-L79 | 2fca4d8c9c95a5f1e79ba8c3a980ffaa8d6d8b42 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/IsolatedComponent/Isolated.ets | arkts | sampleVerifyAbc | 对abc文件进行校验,并拷贝到指定沙箱路径下 | function sampleVerifyAbc(abcPaths: Array<string>, deleteOriginalFiles: boolean) {
try {
bundleManager.verifyAbc(abcPaths, deleteOriginalFiles, (err) => {
if (err) {
console.error('VerifyAbc failed, error message: ' + err.message);
} else {
console.info('VerifyAbc successfully.');
... | AST#function_declaration#Left function sampleVerifyAbc AST#parameter_list#Left ( AST#parameter#Left abcPaths : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right > AST... | function sampleVerifyAbc(abcPaths: Array<string>, deleteOriginalFiles: boolean) {
try {
bundleManager.verifyAbc(abcPaths, deleteOriginalFiles, (err) => {
if (err) {
console.error('VerifyAbc failed, error message: ' + err.message);
} else {
console.info('VerifyAbc successfully.');
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/UIExtensionAndAccessibility/entry/src/main/ets/pages/IsolatedComponent/Isolated.ets#L21-L34 | 8553cdd67000fe82b81d7ae6f375b3bd39cdcede | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/component/DatePickerDialogView.ets | arkts | onChangeData | 更新数据源
@param type 1-年、2-月、3-日、4-时、5-分、6-秒 | onChangeData(type: number) {
if (type <= 2 && this.containMonth) {
this.day = DateHelper.getResetDay(this.year, this.month, this.day);
}
this.selectDate = DateHelper.getDateByStr(this.containYear, this.containMonth, this.containDay, this.containHour,
this.containMinute, this.containSecond, this.... | AST#method_declaration#Left onChangeData AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement... | onChangeData(type: number) {
if (type <= 2 && this.containMonth) {
this.day = DateHelper.getResetDay(this.year, this.month, this.day);
}
this.selectDate = DateHelper.getDateByStr(this.containYear, this.containMonth, this.containDay, this.containHour,
this.containMinute, this.containSecond, this.... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/component/DatePickerDialogView.ets#L91-L132 | 3541debf88f466aeaf825774b3427dc8055e0b54 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/array/ArrayStringUtils.ets | arkts | containsWords | 判断是否含有词语 | static containsWords(str: string): boolean {
return str.includes(" ")
? str.split(" ").filter(item => item.length > 1).length > 0
: false;
} | AST#method_declaration#Left static containsWords AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_t... | static containsWords(str: string): boolean {
return str.includes(" ")
? str.split(" ").filter(item => item.length > 1).length > 0
: false;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L103-L107 | 640096deb62f8850f91fe5dca33a25164e332dcb | github |
CMoments/HarmonOS-arkTS-YunShangChuanDa.git | 895985b9b6013c906bf88eaea6e32e03ddf2a9db | project code/entry/src/main/ets/pages/HealthIndexPage.ets | arkts | tabBar | 当前选中的tab是第几个 | @Builder
tabBar(item:TabModel){
Column(){
Image(this.tabModels[this.currentSelect].name == item.name ? item.activeImg : item.img)
.width(24)
.height(24)
Text(item.name).fontColor(this.tabModels[this.currentSelect].name == item.name ? "#027CFF" :"#A2A2A2")
.fontSize(12)
}
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBar AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left TabModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left {... | @Builder
tabBar(item:TabModel){
Column(){
Image(this.tabModels[this.currentSelect].name == item.name ? item.activeImg : item.img)
.width(24)
.height(24)
Text(item.name).fontColor(this.tabModels[this.currentSelect].name == item.name ? "#027CFF" :"#A2A2A2")
.fontSize(12)
}
... | https://github.com/CMoments/HarmonOS-arkTS-YunShangChuanDa.git/blob/895985b9b6013c906bf88eaea6e32e03ddf2a9db/project code/entry/src/main/ets/pages/HealthIndexPage.ets#L27-L36 | 2b1740be0e577f0442c0ce1ebc2424174ad67ae1 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets | arkts | generateAudioData | 生成音频数据(核心方法)
@param text 音频资源URI | private async generateAudioData(text: string): Promise<AudioData | null> {
const csound = await CSoundHelper.startDownloadOrGenerateSound(text)
if (!csound || csound.data === null || csound.idxx === null) {
return null
}
const idxx = csound.idxx;
// 使用AudioTool创建播放器
const avPlayer = awa... | AST#method_declaration#Left private async generateAudioData AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#gener... | private async generateAudioData(text: string): Promise<AudioData | null> {
const csound = await CSoundHelper.startDownloadOrGenerateSound(text)
if (!csound || csound.data === null || csound.idxx === null) {
return null
}
const idxx = csound.idxx;
const avPlayer = await AudioTool.create... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Player/CAudioPlayer.ets#L103-L130 | 12b166528ba5b0d4cbde0d0d0c112c720192ce61 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/storage/StorageManager.ets | arkts | setNumber | 设置数字值 | static async setNumber(key: string, value: number): Promise<void> {
const instance = StorageManager.getInstance();
if (!instance.dataPreferences) {
await instance.init();
}
try {
await instance.dataPreferences?.put(key, value);
await instance.dataPreferences?.flush();
} catch (e) {... | AST#method_declaration#Left static async setNumber 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 value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_... | static async setNumber(key: string, value: number): Promise<void> {
const instance = StorageManager.getInstance();
if (!instance.dataPreferences) {
await instance.init();
}
try {
await instance.dataPreferences?.put(key, value);
await instance.dataPreferences?.flush();
} catch (e) {... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/storage/StorageManager.ets#L108-L119 | a6ae3fa3ca6ed92a52ce101df71cabc659b07c3a | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.PhotoPickerComponent.d.ets | arkts | ClickType. include SELECTED and DESELECTED
@enum { number } ClickType
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum ClickType {
/**
* SELECTED. click to select photos or videos, if click camera item, the clickType is SELECTED.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
SELECTED = 0,
/**
* DESELECTED. click to deselect photos or vi... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ClickType AST#enum_body#Left { /**
* SELECTED. click to select photos or videos, if click camera item, the clickType is SELECTED.
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @ato... | export declare enum ClickType {
SELECTED = 0,
DESELECTED = 1
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.PhotoPickerComponent.d.ets#L917-L935 | 97f93dadd02df48c05ba4414a24e2f58789e8a56 | gitee | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/JList.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 JList<T> {
public dataSouce: Array<T>;
public listSize: number; // 列表的大小
public pos: number; // 列表中当前的位置
constructor() {
this.dataSouce = [];
this.listSize = 0; // 列表的大小
this.pos = 0; // 列表中当前的位置
}
/**
* 在列表的末尾添加新元素
* @param {*} element 要添加的元素
*/
append(element: T) {
... | AST#export_declaration#Left export AST#class_declaration#Left class JList AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#class_body#Left { AST#property_declaration#Left public dataSouce : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left ... | export class JList<T> {
public dataSouce: Array<T>;
public listSize: number;
public pos: number;
constructor() {
this.dataSouce = [];
this.listSize = 0;
this.pos = 0;
}
append(element: T) {
this.dataSouce[this.listSize++] = element;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/JList.ets#L16-L34 | cbd0145bd817c676eed015733615c2d93cec2d6c | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/SimpleAIService.ets | arkts | splitTextIntoChunks | 将文本分割为合适的显示块 | private splitTextIntoChunks(text: string, mode: StreamMode): string[] {
if (mode === StreamMode.TYPING) {
// 打字模式:按词分割
return text.split(/(\s+|[,。!?;:])/).filter(chunk => chunk.length > 0);
} else {
// 流式模式:按短语分割(每3-8个字符一组)
const chunks: string[] = [];
let currentChunk = '';
... | AST#method_declaration#Left private splitTextIntoChunks AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left mode : AST#type_annotation#Left AST#primary_type#Left StreamMode AST... | private splitTextIntoChunks(text: string, mode: StreamMode): string[] {
if (mode === StreamMode.TYPING) {
return text.split(/(\s+|[,。!?;:])/).filter(chunk => chunk.length > 0);
} else {
const chunks: string[] = [];
let currentChunk = '';
for (const char of text) {
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/SimpleAIService.ets#L388-L413 | fbb67c9baef043c7e4fef689e73ada404784112b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/AIAssistantService.ets | arkts | clearConversationHistory | 清除对话历史 | clearConversationHistory(sessionId?: string): void {
const currentSessionId = sessionId || this.currentSessionId;
const context = this.conversations.get(currentSessionId);
if (context) {
context.history = [];
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Conversation histor... | AST#method_declaration#Left clearConversationHistory AST#parameter_list#Left ( AST#parameter#Left sessionId ? : 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 void AST#... | clearConversationHistory(sessionId?: string): void {
const currentSessionId = sessionId || this.currentSessionId;
const context = this.conversations.get(currentSessionId);
if (context) {
context.history = [];
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP,
`Conversation histor... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/AIAssistantService.ets#L439-L447 | e5ee4e3d0af96a305acba77255662047b5e61730 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/NotificationUtil.ets | arkts | addSlot | 创建指定类型的通知渠道。
@param type 要创建的通知渠道的类型 | static async addSlot(type: notificationManager.SlotType) {
return notificationManager.addSlot(type);
} | AST#method_declaration#Left static async addSlot AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . SlotType AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Ri... | static async addSlot(type: notificationManager.SlotType) {
return notificationManager.addSlot(type);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/NotificationUtil.ets#L362-L364 | 135afa68516879ca4160106d8f7af6e3959216da | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/word/WordDetail.ets | arkts | WordDetail
单词详情数据模型(继承 Word) | export class WordDetail extends Word {
// pronEn : string | null = null;
// pronUs : string | null = null;
// titleCn2 : string | null = null;
// titleCn3 : string | null = null;
wordImage : string | null = null;
wordChange : string | null = null;
synWor... | AST#export_declaration#Left export AST#class_declaration#Left class WordDetail extends AST#type_annotation#Left AST#primary_type#Left Word AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // pronEn : string | null = null; // pronUs : string | null = null; // titleCn2 : ... | export class WordDetail extends Word {
wordImage : string | null = null;
wordChange : string | null = null;
synWords : string | null = null;
asynWords : string | null = null;
exampleEn2 : string | null = null;
exampleCn2 : string | null = null;
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/word/WordDetail.ets#L12-L160 | 35a1b40ee253326d4fb0ee1544a6d7f195d307ee | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/SimpleOfflineManager.ets | arkts | 网络状态枚举 | export enum NetworkStatus {
ONLINE = 'online',
OFFLINE = 'offline',
UNKNOWN = 'unknown'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum NetworkStatus AST#enum_body#Left { AST#enum_member#Left ONLINE = AST#expression#Left 'online' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left OFFLINE = AST#expression#Left 'offline' AST#expression#Right AST#enum_member#Right , AST#enum_... | export enum NetworkStatus {
ONLINE = 'online',
OFFLINE = 'offline',
UNKNOWN = 'unknown'
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/SimpleOfflineManager.ets#L6-L10 | 42326723e75c08a6568fc2426db138c5a6734cae | github | |
YueHua46/ArkTS_Learn.git | 5c08d3016421c69c299f7cb757df686f277889ac | entry/src/main/ets/pages/RankPage.ets | arkts | onPageHide | 4.onPageHide(页面消失) | onPageHide() {} | AST#method_declaration#Left onPageHide AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { } AST#builder_function_body#Right AST#method_declaration#Right | onPageHide() {} | https://github.com/YueHua46/ArkTS_Learn.git/blob/5c08d3016421c69c299f7cb757df686f277889ac/entry/src/main/ets/pages/RankPage.ets#L31-L31 | e06c9e2ddb81798cecf7f123c7b05a3caed1639b | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/utils/Logger.ets | arkts | Common log for all features. | export class Logger {
private domain: number;
private prefix: string;
private format: string = '%{public}s, %{public}s';
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
}
... | AST#export_declaration#Left export AST#class_declaration#Left class Logger AST#class_body#Left { AST#property_declaration#Left private domain : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left private pr... | export class Logger {
private domain: number;
private prefix: string;
private format: string = '%{public}s, %{public}s';
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: string[]): void {
hilog.debug(this.domain, this.prefix, this.format, args);
}
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SuperFeature/DistributedAppDev/DistributedFilemanager/Library/src/main/ets/utils/Logger.ets#L20-L53 | 0327fe03f1c8e4b074f28593dbc88ebe573d5d6a | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoTrimmerView.ets | arkts | watchVideoTrimmerOption | 裁剪选项变动时停止播放刷新界面 | watchVideoTrimmerOption() {
this.configUIInfo();
this.isPausePreview = true;
this.waitLoadedInitAVPlayer();
} | AST#method_declaration#Left watchVideoTrimmerOption AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . configUIInfo... | watchVideoTrimmerOption() {
this.configUIInfo();
this.isPausePreview = true;
this.waitLoadedInitAVPlayer();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videotrimmer/src/main/ets/videotrimmer/VideoTrimmerView.ets#L45-L49 | 8cd16c2cd630ee612375dce2af7d88f8b26975fb | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/components/devicemanager/InputDeviceDataDialog.ets | arkts | InputDeviceDataDialog | 输入设备详情弹窗 | @CustomDialog
export struct InputDeviceDataDialog {
@Link mDeviceInfo: InputDeviceInfo
mController?: CustomDialogController;
cancel?: () => void
build() {
Scroll() {
Column() {
Text(this.mDeviceInfo.name)
.fontColor($r('sys.color.ohos_id_color_text_primary'))
.fontSize($r(... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export struct InputDeviceDataDialog AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right mDeviceInfo : AST#type_annotation#Left AST#primary_type#Left InputDeviceInfo AST#primary_t... | @CustomDialog
export struct InputDeviceDataDialog {
@Link mDeviceInfo: InputDeviceInfo
mController?: CustomDialogController;
cancel?: () => void
build() {
Scroll() {
Column() {
Text(this.mDeviceInfo.name)
.fontColor($r('sys.color.ohos_id_color_text_primary'))
.fontSize($r(... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/components/devicemanager/InputDeviceDataDialog.ets#L20-L125 | e8e4c7f6c0a10664a0283a785edc7c20ee74f572 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | entry/src/main/ets/navigation/NavigationHost.ets | arkts | 导航目标构建器
@returns 路由构建器 | build() {
Navigation(this.navPathStack) {
MainPage()
}
.hideTitleBar(true)
.mode(NavigationMode.Stack)
.navDestination(this.PagesMap)
} | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Navigation ( AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . navPathStack AST#member_expression#Right AST#expression#Right ) AST#contain... | build() {
Navigation(this.navPathStack) {
MainPage()
}
.hideTitleBar(true)
.mode(NavigationMode.Stack)
.navDestination(this.PagesMap)
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/entry/src/main/ets/navigation/NavigationHost.ets#L36-L43 | 8efde986b173c856ec99dacffdd9188a5da4c5bd | github | |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | custom_dialog/src/main/ets/model/style/ITextStyle.ets | arkts | 文本样式 | export interface ITextStyle {
/**
* 自定义样式标识(用来区分样式 ID)
* @description 如果已设置 ID,还设置其他样式,如:borderRadius、height、fontWeight、fontSize等,将以当前对象字段优先
*/
customStyleId?: string
/**
* 字体颜色
*/
fontColor?: ResourceColor;
/**
* 字体粗细
*/
fontWeight?: FontWeight;
/**
* 字号
*/
fontSize?: numbe... | AST#export_declaration#Left export AST#interface_declaration#Left interface ITextStyle AST#object_type#Left { /**
* 自定义样式标识(用来区分样式 ID)
* @description 如果已设置 ID,还设置其他样式,如:borderRadius、height、fontWeight、fontSize等,将以当前对象字段优先
*/ AST#type_member#Left customStyleId ? : AST#type_annotation#Left AST#primary_type#Left s... | export interface ITextStyle {
customStyleId?: string
fontColor?: ResourceColor;
fontWeight?: FontWeight;
fontSize?: number;
lineHeight?: Length
maxLines?: number
textOverflow?: TextOverflow
margin?: Margin
padding?: Padding | Length
textAlign?: TextAlign
width?:... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/custom_dialog/src/main/ets/model/style/ITextStyle.ets#L4-L72 | 25612133acdc3881ac22ceb394f0b46f1d88933c | github | |
Puiching-Memory/HOMOAPP_Q5.git | 53e36a21984de7bf41b6fafc840fde013236b9d2 | entry/src/main/ets/components/MusicPlayerBar.ets | arkts | MusicPlayerBar | 音乐播放控制条
提供进度显示、控制以及简单的响度可视化动画 | @ComponentV2
export struct MusicPlayerBar {
private globalMusic: GlobalMusic = AppStorageV2.connect(GlobalMusic, 'GlobalMusic', () => new GlobalMusic())!;
// 增加频域可视化的数据点数量
@Local private barHeights: number[] = new Array(24).fill(6);
private timerId: number = -1;
aboutToAppear() {
this.startAnimation()... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct MusicPlayerBar AST#component_body#Left { AST#property_declaration#Left private globalMusic : AST#type_annotation#Left AST#primary_type#Left GlobalMusic AST#primary_type#Right AST#type_annotation#Right = AST#expressi... | @ComponentV2
export struct MusicPlayerBar {
private globalMusic: GlobalMusic = AppStorageV2.connect(GlobalMusic, 'GlobalMusic', () => new GlobalMusic())!;
@Local private barHeights: number[] = new Array(24).fill(6);
private timerId: number = -1;
aboutToAppear() {
this.startAnimation();
}
aboutTo... | https://github.com/Puiching-Memory/HOMOAPP_Q5.git/blob/53e36a21984de7bf41b6fafc840fde013236b9d2/entry/src/main/ets/components/MusicPlayerBar.ets#L9-L258 | a5cf77230a16a5a28a1ad1bff1eb4a8061db59a5 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | isBlank | 判断字符串是否为空和空白符(空白符包括空格、制表符、全角空格和不间断空格)。true为空,否则false
@param str
@returns | static isBlank(str: string | undefined | null): boolean {
if ((str === undefined) || (str === null)) {
return true;
}
let trimStr = StrUtil.trimAll(str);
return trimStr.length === 0;
} | AST#method_declaration#Left static isBlank AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right... | static isBlank(str: string | undefined | null): boolean {
if ((str === undefined) || (str === null)) {
return true;
}
let trimStr = StrUtil.trimAll(str);
return trimStr.length === 0;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L73-L79 | 4cfce26e50447e0b624e6f5e1e6fadf552a1705d | gitee |
Million-mo/tree-sitter-arkts.git | 2fd0ad75e2d848709edcf4be038f27b178114ef6 | examples/decorators_complete.ets | arkts | onLocalStateChange | @Computed装饰器通常用于getter方法,这里暂时注释 @Computed get displayValue(): string { return this.localState + this.inputValue; } | @Monitor('localState')
onLocalStateChange() { // @Monitor - 状态变量修改监听
console.log('Local state changed');
} | AST#method_declaration#Left AST#decorator#Left @ Monitor ( AST#expression#Left 'localState' AST#expression#Right ) AST#decorator#Right onLocalStateChange AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // @Monitor - 状态变量修改监听 AST#expression_statement#Left AST#expression#Left AST#cal... | @Monitor('localState')
onLocalStateChange() {
console.log('Local state changed');
} | https://github.com/Million-mo/tree-sitter-arkts.git/blob/2fd0ad75e2d848709edcf4be038f27b178114ef6/examples/decorators_complete.ets#L110-L113 | 1c569a9772be0b564d17c1e58fb47bca38f41240 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SearchPage.ets | arkts | getStyleLabel | 获取样式标签 | private getStyleLabel(style: string): string {
switch (style) {
case 'warm':
return '温馨';
case 'formal':
return '正式';
case 'humorous':
return '幽默';
case 'poetic':
return '诗意';
case 'simple':
return '简洁';
default:
return '简洁';
}
... | AST#method_declaration#Left private getStyleLabel AST#parameter_list#Left ( AST#parameter#Left style : 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#primary... | private getStyleLabel(style: string): string {
switch (style) {
case 'warm':
return '温馨';
case 'formal':
return '正式';
case 'humorous':
return '幽默';
case 'poetic':
return '诗意';
case 'simple':
return '简洁';
default:
return '简洁';
}
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SearchPage.ets#L656-L671 | a2c3f38253d7d5db3ee7ba3c8335543637b06a35 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/SnapshotUtil.ets | arkts | getSync | 获取已加载的组件的截图,传入组件的组件id,找到对应组件进行截图。
@param id 目标组件的组件标识,组件的唯一标识id
@param options 截图相关的自定义参数。
@returns | static getSync(id: string, options?: componentSnapshot.SnapshotOptions): image.PixelMap {
return componentSnapshot.getSync(id, options);
} | AST#method_declaration#Left static getSync AST#parameter_list#Left ( AST#parameter#Left id : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left ... | static getSync(id: string, options?: componentSnapshot.SnapshotOptions): image.PixelMap {
return componentSnapshot.getSync(id, options);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/SnapshotUtil.ets#L44-L46 | 3ec196c20f90d7bcde0f8992ab432f8f81359853 | gitee |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/utils/PreferenceModel.ets | arkts | getPreference | 获取key对应的value | async getPreference(key:string){
let value = ""
if (preference === null) {
await this.getPreferencesFromStorage()
}
try {
value = <string> await preference.get(key, null)
} catch (err) {
console.error(err)
}
return value;
} | AST#method_declaration#Left async getPreference AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#... | async getPreference(key:string){
let value = ""
if (preference === null) {
await this.getPreferencesFromStorage()
}
try {
value = <string> await preference.get(key, null)
} catch (err) {
console.error(err)
}
return value;
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/utils/PreferenceModel.ets#L40-L51 | 07508494db84f1a54b836fdac81b1d1a468012ba | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Weather/common/src/main/ets/mock/RequestData.ets | arkts | getHeaderDate | 获取首页顶部显示信息 | function getHeaderDate(cityIndex: number, city?: City) {
// 生成空气质量对象
let air: AirData | undefined = undefined;
let headerData: HeaderData | undefined = undefined;
try {
air = new AirData(weather[cityIndex].aqi.air,
resourceManager!.getStringSync((weather[cityIndex].aqi.airLevel as Resource).id));
... | AST#function_declaration#Left function getHeaderDate AST#parameter_list#Left ( AST#parameter#Left cityIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left city ? : AST#type_annotation#Left AST#primary_type#Left City AST#p... | function getHeaderDate(cityIndex: number, city?: City) {
let air: AirData | undefined = undefined;
let headerData: HeaderData | undefined = undefined;
try {
air = new AirData(weather[cityIndex].aqi.air,
resourceManager!.getStringSync((weather[cityIndex].aqi.airLevel as Resource).id));
headerData ... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/mock/RequestData.ets#L86-L104 | 57a08d31323fe1398ffb2bb8e13a103ef6a8234e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/AES.ets | arkts | encryptGCMSync | 加密(GCM模式),同步
@param data 加密或者解密的数据。data不能为null。
@param symKey 指定加密或解密的密钥。
@param gcmParams 指定加密或解密的参数,对于ECB等没有参数的算法模式,可以传入null。API 10之前只支持ParamsSpec, API 10之后增加支持null。
@param transformation 待生成Cipher的算法名称(含密钥长度)、加密模式以及填充方法的组合(AES256|GCM|PKCS7、AES192|GCM|PKCS7、AES128|GCM|PKCS7)。
@returns | static encryptGCMSync(data: cryptoFramework.DataBlob, symKey: cryptoFramework.SymKey,
gcmParams: cryptoFramework.GcmParamsSpec, transformation: string = 'AES256|GCM|PKCS7'): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCRY... | 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 = 'AES256|GCM|PKCS7'): cryptoFramework.DataBlob {
let cipher = cryptoFramework.createCipher(transformation);
cipher.initSync(cryptoFramework.CryptoMode.ENCRY... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/AES.ets#L54-L62 | 306dd96d8340f7ecd0ddbdbe2d9f92dcd0fe81e1 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildOccasionChip | 构建场合标签 | @Builder
buildOccasionChip(label: string, occasion: GreetingOccasion) {
Button(label)
.type(ButtonType.Capsule)
.fontSize(14)
.fontColor(this.selectedOccasion === occasion ? '#ffffff' : '#666666')
.backgroundColor(this.selectedOccasion === occasion ? '#007AFF' : '#f0f0f0')
.height(32... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildOccasionChip AST#parameter_list#Left ( AST#parameter#Left label : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left occasion : AST#type_annotati... | @Builder
buildOccasionChip(label: string, occasion: GreetingOccasion) {
Button(label)
.type(ButtonType.Capsule)
.fontSize(14)
.fontColor(this.selectedOccasion === occasion ? '#ffffff' : '#666666')
.backgroundColor(this.selectedOccasion === occasion ? '#007AFF' : '#f0f0f0')
.height(32... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L557-L569 | 82aca5b86d7322b637df2b329ded0bac914eb21f | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhDialog.ets | arkts | showCustomDialog | 中间自定义弹框
@param options | public static showCustomDialog(options: JhDialogOptions) {
DialogHelper.showCustomContentDialog({
title: options.title ?? _title,
contentBuilder: options.contentBuilder,
contentAreaPadding: options.contentAreaPadding,
autoCancel: false, // 点击遮障层时,是否关闭弹窗,true表示关闭弹窗。
backCancel: false, /... | AST#method_declaration#Left public static showCustomDialog AST#parameter_list#Left ( AST#parameter#Left options : AST#type_annotation#Left AST#primary_type#Left JhDialogOptions AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression... | public static showCustomDialog(options: JhDialogOptions) {
DialogHelper.showCustomContentDialog({
title: options.title ?? _title,
contentBuilder: options.contentBuilder,
contentAreaPadding: options.contentAreaPadding,
autoCancel: false,
backCancel: false,
actionCancel: options.... | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhDialog.ets#L277-L305 | 7075097f85ea5699a9726c66e723b51e79f2782b | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/constants/AppTheme.ets | arkts | 绿色主题 | export class ThemeGreen implements Theme {
color: ColorPalette = new ColorGreen()
} | AST#export_declaration#Left export AST#class_declaration#Left class ThemeGreen AST#implements_clause#Left implements Theme AST#implements_clause#Right AST#class_body#Left { AST#property_declaration#Left color : AST#type_annotation#Left AST#primary_type#Left ColorPalette AST#primary_type#Right AST#type_annotation#Right ... | export class ThemeGreen implements Theme {
color: ColorPalette = new ColorGreen()
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/constants/AppTheme.ets#L56-L58 | 2ed2201b79e75f6202208ab449cacae6a1d10645 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | getNumberSync | 获取number类型的缓存值
@param key
@returns | static getNumberSync(key: string, defValue: number = 0,
preferenceName: string = PreferencesUtil.defaultPreferenceName): number {
return PreferencesUtil.getSync(key, defValue, preferenceName) as number;
} | AST#method_declaration#Left static getNumberSync 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 defValue : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | static getNumberSync(key: string, defValue: number = 0,
preferenceName: string = PreferencesUtil.defaultPreferenceName): number {
return PreferencesUtil.getSync(key, defValue, preferenceName) as number;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L151-L154 | 20d879f558adf74e4476ce52991d1e5cd289008e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PreferencesUtil.ets | arkts | clear | 清除缓存的Preferences实例中的所有数据
@param preferenceName
@returns | static async clear(preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<void> {
let preferences = await PreferencesUtil.getPreferences(preferenceName); //获取实例
await preferences.clear();
return preferences.flush() //此处一定要flush,要不然不能永久序列化到本地
} | AST#method_declaration#Left static async clear AST#parameter_list#Left ( AST#parameter#Left preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left PreferencesUtil AST#expression#Right . ... | static async clear(preferenceName: string = PreferencesUtil.defaultPreferenceName): Promise<void> {
let preferences = await PreferencesUtil.getPreferences(preferenceName);
await preferences.clear();
return preferences.flush()
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PreferencesUtil.ets#L251-L255 | 1b32b38240ef4ef902ee74ab9948253c679d1462 | gitee |
openharmony-tpc/ImageKnife | bc55de9e2edd79ed4646ce37177ad94b432874f7 | library/src/main/ets/key/DefaultEngineKey.ets | arkts | generateMemoryKey | 生成内存缓存key | generateMemoryKey(loadSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,
imageKnifeOption: ImageKnifeOption,isAnimator?: boolean, width?: number, height?: number): string {
let key = (isAnimator == true ? 'Animator=' : 'loadSrc==') + (typeof loadSrc == 'string' ? loadSrc : JSON.stringify... | AST#method_declaration#Left generateMemoryKey AST#parameter_list#Left ( AST#parameter#Left loadSrc : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left PixelMap AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_... | generateMemoryKey(loadSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,
imageKnifeOption: ImageKnifeOption,isAnimator?: boolean, width?: number, height?: number): string {
let key = (isAnimator == true ? 'Animator=' : 'loadSrc==') + (typeof loadSrc == 'string' ? loadSrc : JSON.stringify... | https://github.com/openharmony-tpc/ImageKnife/blob/bc55de9e2edd79ed4646ce37177ad94b432874f7/library/src/main/ets/key/DefaultEngineKey.ets#L25-L31 | 51403fc8e529af2d6407c1a81a914fb398827244 | gitee |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/path_sensitive/explicit_jump_control/break_001_T.ets | arkts | Introduction 显式跳转控制-break | export function break_001_T(taint_src : string) {
let res = ''
for (let i = 0; i < 10; i++) {
if (i === 3) {
res = taint_src
}
taint.Sink(res)
}
} | AST#export_declaration#Left export AST#function_declaration#Left function break_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#Left { ... | export function break_001_T(taint_src : string) {
let res = ''
for (let i = 0; i < 10; i++) {
if (i === 3) {
res = taint_src
}
taint.Sink(res)
}
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/path_sensitive/explicit_jump_control/break_001_T.ets#L6-L14 | cd947f75f6c30cd651de5a93a68a1e599ac047c4 | github | |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/review/ReviewToolbar.ets | arkts | ReviewToolbar | 工具栏组件 | @Builder
export function ReviewToolbar(
onRefresh: () => void,
onTestTask: () => void
) {
Row({ space: 12 }) {
// 测试按钮:添加模拟任务
Button() {
Row({ space: 6 }) {
SymbolGlyph($r('sys.symbol.plus_circle'))
.fontSize(18)
Text('测试任务')
.fontSize(14)
.fontColor('#f... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ReviewToolbar AST#parameter_list#Left ( AST#parameter#Left onRefresh : AST#type_annotation#Left AST#function_type#Left AST#parameter_list#Left ( ) AST#parameter_list#Right => AST#type_annotation#Left AST#primary_type#... | @Builder
export function ReviewToolbar(
onRefresh: () => void,
onTestTask: () => void
) {
Row({ space: 12 }) {
Button() {
Row({ space: 6 }) {
SymbolGlyph($r('sys.symbol.plus_circle'))
.fontSize(18)
Text('测试任务')
.fontSize(14)
.fontColor('#ff34c759')
... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/review/ReviewToolbar.ets#L11-L55 | 7401003f34121e9a60b702171cb5440fb5e88b98 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/XAxisRenderer.ets | arkts | computeAxisValues | @Override | protected computeAxisValues(min: number, max: number) {
super.computeAxisValues(min, max);
this.computeSize();
} | AST#method_declaration#Left protected computeAxisValues AST#parameter_list#Left ( AST#parameter#Left min : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left max : AST#type_annotation#Left AST#primary_type#Left number AST#prima... | protected computeAxisValues(min: number, max: number) {
super.computeAxisValues(min, max);
this.computeSize();
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/renderer/XAxisRenderer.ets#L76-L79 | c6f97e5e630617ea1f10dac13dabedec4a33da5f | gitee |
goldbrown/pomodora-clock-app.git | 6e2aef2d9517624a11c299930f6dda052421fd18 | entry/src/main/ets/constant/RoutePath.ets | arkts | 路由表管理 | export class RoutePath {
static readonly SplashPage = "pages/SplashPage"
static readonly MainPage = "pages/MainPage"
static readonly CategoryPage = "pages/CategoryPage"
static readonly ContainerPage = "pages/container/ContainerPage"
static readonly TopicDetailPage = "pages/topicDetail/TopicDetailPage"
stati... | AST#export_declaration#Left export AST#class_declaration#Left class RoutePath AST#class_body#Left { AST#property_declaration#Left static readonly SplashPage = AST#expression#Left "pages/SplashPage" AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly MainPage = AST#expressi... | export class RoutePath {
static readonly SplashPage = "pages/SplashPage"
static readonly MainPage = "pages/MainPage"
static readonly CategoryPage = "pages/CategoryPage"
static readonly ContainerPage = "pages/container/ContainerPage"
static readonly TopicDetailPage = "pages/topicDetail/TopicDetailPage"
stati... | https://github.com/goldbrown/pomodora-clock-app.git/blob/6e2aef2d9517624a11c299930f6dda052421fd18/entry/src/main/ets/constant/RoutePath.ets#L4-L18 | c1ff60643d9311027ffe4d2662fdc4ff318df4d7 | github | |
queueit/harmony-sdk.git | ba7b4b38c03730bfbe305789acba6db0012d5f5c | entry/src/main/ets/pages/DemoWithProtectedAPIPage.ets | arkts | createQueueListener | --- QueueListener Implementation --- | private createQueueListener(): QueueListener {
return {
onQueuePassed: (info: QueuePassedInfo) => {
this.queueViewManager?.hideQueue();
promptAction.showToast({ message: "Passed queue! Retrying product fetch..." });
// Add the new token to the reposito... | AST#method_declaration#Left private createQueueListener AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left QueueListener AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left ... | private createQueueListener(): QueueListener {
return {
onQueuePassed: (info: QueuePassedInfo) => {
this.queueViewManager?.hideQueue();
promptAction.showToast({ message: "Passed queue! Retrying product fetch..." });
this.productReposit... | https://github.com/queueit/harmony-sdk.git/blob/ba7b4b38c03730bfbe305789acba6db0012d5f5c/entry/src/main/ets/pages/DemoWithProtectedAPIPage.ets#L56-L87 | 2e297c49a926f10e8bcf3794c8aa24c1d05f0faf | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/url_tools.ets | arkts | Translates a link with meow:// to resource://
@param link The link.
@returns The translated link. | export function url_meow_to_resource(url: string) {
let result: string = url;
if (!url) {
return result;
}
// No process for empty inputs
if (url.length > 7) {
if (url.substring(0, 7) == "meow://") {
// if is meow:// scheme
let index = built_ins.indexOf(url);
if (index != -1) {
... | AST#export_declaration#Left export AST#function_declaration#Left function url_meow_to_resource 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_list#Right AST#block_statement#Left... | export function url_meow_to_resource(url: string) {
let result: string = url;
if (!url) {
return result;
}
if (url.length > 7) {
if (url.substring(0, 7) == "meow://") {
let index = built_ins.indexOf(url);
if (index != -1) {
result = urls[index];
} else {
... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/url_tools.ets#L248-L269 | a62494c69fab0083a734e5925fa8574950a89b80 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/LinkView.ets | arkts | 在系统浏览器中打开链接 | export function openInSystemBrowser(url: string): void {
try {
let want: Want = {
action: 'ohos.want.action.viewData',
uri: url,
parameters: {
// 可选:传递额外参数
}
};
let context = getContext(getAppContext()) as common.UIAbilityContext;
context.startAbility(want).catch(()=> {... | AST#export_declaration#Left export AST#function_declaration#Left function openInSystemBrowser 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_list#Right : AST#type_annotation#Lef... | export function openInSystemBrowser(url: string): void {
try {
let want: Want = {
action: 'ohos.want.action.viewData',
uri: url,
parameters: {
}
};
let context = getContext(getAppContext()) as common.UIAbilityContext;
context.startAbility(want).catch(()=> {
conso... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/LinkView.ets#L120-L137 | 23df0d63dc1571b1e3a181d5a940c153331d053a | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/share/SharePage.ets | arkts | initializePage | 初始化页面 | async initializePage() {
try {
// 获取可用的分享平台
this.availablePlatforms = await this.socialShareService.getAvailableSharePlatforms();
// 获取分享模板
this.shareTemplates = this.socialShareService.getShareTemplates();
// 生成默认分享内容
this.generateShareContent();
} catch... | AST#method_declaration#Left async initializePage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { // 获取可用的分享平台 AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#m... | async initializePage() {
try {
this.availablePlatforms = await this.socialShareService.getAvailableSharePlatforms();
this.shareTemplates = this.socialShareService.getShareTemplates();
this.generateShareContent();
} catch (error) {
console.error('... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/share/SharePage.ets#L39-L53 | 3cb5ce06b0ebd2540ff87b5771825c87ed5d384a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/CommonTypes.ets | arkts | 颜色配置接口 | export interface ColorConfig {
primary: string;
secondary: string;
accent: string;
background: string;
surface: string;
error: string;
warning: string;
success: string;
info: string;
text: TextColorConfig;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ColorConfig AST#object_type#Left { AST#type_member#Left primary : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left secondary : AST#type_annotatio... | export interface ColorConfig {
primary: string;
secondary: string;
accent: string;
background: string;
surface: string;
error: string;
warning: string;
success: string;
info: string;
text: TextColorConfig;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/CommonTypes.ets#L222-L233 | b83135caedf26528f6bde5c106bde3ede5702355 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/GlobalContext.ets | arkts | clear | 清除缓存数据 | public clear() {
return this._objects.clear();
} | AST#method_declaration#Left public clear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expr... | public clear() {
return this._objects.clear();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/GlobalContext.ets#L75-L77 | 4ad18d82517d55b6a31e4d1b53f3c334556a047f | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/CustomScan/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | restartCustomScan | 重新启动扫码
@returns {void} | async restartCustomScan(): Promise<void> {
logger.info('restartCustomScan');
// 关闭存在的扫描结果对话框
this.closeScanResult();
// 根据窗口尺寸调整展示组件尺寸
await this.updateCameraCompSize();
// 调整相机surface尺寸
this.cameraCompSizeUpdateCb(this.cameraCompWidth,
this.cameraCompHeight,
... | AST#method_declaration#Left async restartCustomScan AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#typ... | async restartCustomScan(): Promise<void> {
logger.info('restartCustomScan');
this.closeScanResult();
await this.updateCameraCompSize();
this.cameraCompSizeUpdateCb(this.cameraCompWidth,
this.cameraCompHeight,
this.cameraCompO... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/CustomScan/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L374-L389 | 41f35094c6af964d2abb826d8ff5d6e4a95403c7 | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | example/BasicUsage.ets | arkts | rtsp | ============================================================ 网络流 ============================================================ RTSP 录制 | rtsp(): void {
const cmd = FFmpegFactory.downloadRtsp('rtsp://192.168.1.100/stream', '/record.mp4', 60);
this.run(cmd);
} | AST#method_declaration#Left rtsp AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left cmd = AST#expression... | rtsp(): void {
const cmd = FFmpegFactory.downloadRtsp('rtsp://192.168.1.100/stream', '/record.mp4', 60);
this.run(cmd);
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/example/BasicUsage.ets#L71-L74 | f5bb5a53e5bfeb96e79e6238379b1678450f33e1 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Border radius of row. | export const BORDER_RADIUS = 32; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left BORDER_RADIUS = AST#expression#Left 32 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const BORDER_RADIUS = 32; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L125-L125 | 5cac13d23b0d4f83119c7249a35f979f9c6eb09e | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/Index.ets | arkts | initAndCheckLogin | 初始化并检查登录状态 | private async initAndCheckLogin() {
try {
console.info('Index页面: 开始检查登录状态');
// 1. 先检查用户会话是否已初始化
if (!this.userSession.isInitialized()) {
console.info('Index页面: 会话未初始化,进行初始化');
try {
// 使用await等待初始化完成
await this.userSession.init();
console.info('Index页... | AST#method_declaration#Left private async initAndCheckLogin AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expressio... | private async initAndCheckLogin() {
try {
console.info('Index页面: 开始检查登录状态');
if (!this.userSession.isInitialized()) {
console.info('Index页面: 会话未初始化,进行初始化');
try {
await this.userSession.init();
console.info('Index页面: 会话初始化完成');
} catch (error... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/Index.ets#L35-L70 | 669c24ea6bcad8d1fd03b6c164626b864477ba5e | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets | arkts | getPreferencesFromStorage | 调用getPreferences方法读取指定首选项持久化文件, 将数据加载到Preferences实例,用于数据操作 | async getPreferencesFromStorage() {
await preferences.getPreferences(context, options).then((data) => {
this.dataPreferences = data;
console.info(`Succeeded in getting preferences`);
}).catch((err: BusinessError) => {
console.error(`Failed to get preferences, Cause:` + err);
});
} | AST#method_declaration#Left async getPreferencesFromStorage AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#exp... | async getPreferencesFromStorage() {
await preferences.getPreferences(context, options).then((data) => {
this.dataPreferences = data;
console.info(`Succeeded in getting preferences`);
}).catch((err: BusinessError) => {
console.error(`Failed to get preferences, Cause:` + err);
});
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSPreferences/entry/src/main/ets/common/PreferencesUtil.ets#L16-L23 | f4ffcb042ec4b33ab9f8766615de77b9ac879e35 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/dialog/DialogHelper.ets | arkts | defaultKnowDialog | 默认提示弹框
@param title 标题
@param message 内容
@param operator 回调 | function defaultKnowDialog(title: string | Resource, message: string | Resource, operator ?: DialogOperator): void {
showDialog(title, message, $r('app.string.button_know'), operator);
} | AST#function_declaration#Left function defaultKnowDialog AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parame... | function defaultKnowDialog(title: string | Resource, message: string | Resource, operator ?: DialogOperator): void {
showDialog(title, message, $r('app.string.button_know'), operator);
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/dialog/DialogHelper.ets#L144-L146 | d94025dc3af5f06eef9ede71673104905eb1997c | gitee |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/RabinKarp.ets | arkts | findAllMatches | 在文本中查找模式串的所有出现位置
@param text 文本字符串
@param pattern 模式串
@returns 所有匹配位置的数组 | static findAllMatches(text: string, pattern: string): number[] {
return RabinKarp.findAll(text, pattern);
} | AST#method_declaration#Left static findAllMatches AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findAllMatches(text: string, pattern: string): number[] {
return RabinKarp.findAll(text, pattern);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/RabinKarp.ets#L139-L141 | 2001457341fe7ab746fa96eecc3ac1f78fa94043 | github |
tomorrowKreswell/Ledger.git | 1f2783ae70b8540d677af8a27f29db1b4089ea69 | ledger/entry/src/main/ets/common/utils/DateUtils.ets | arkts | 获取本年的日期范围 | export function getDateRangeOfThisYear(date: Date | number) {
// 获取本年的第一天和下一年的第一天
const beginDate = getFirstDateOfThisYear(date)
const nextYear = new Date(beginDate.getTime())
nextYear.setFullYear(nextYear.getFullYear() + 1)
// 返回日期范围对象
return { beginDate: beginDate.getTime(), endDate: nextYear.getTime() - ... | AST#export_declaration#Left export AST#function_declaration#Left function getDateRangeOfThisYear AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left Date AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right A... | export function getDateRangeOfThisYear(date: Date | number) {
const beginDate = getFirstDateOfThisYear(date)
const nextYear = new Date(beginDate.getTime())
nextYear.setFullYear(nextYear.getFullYear() + 1)
return { beginDate: beginDate.getTime(), endDate: nextYear.getTime() - 1 };
} | https://github.com/tomorrowKreswell/Ledger.git/blob/1f2783ae70b8540d677af8a27f29db1b4089ea69/ledger/entry/src/main/ets/common/utils/DateUtils.ets#L136-L143 | eb2c44c8c9e283cee07c1f35010c6078a915b014 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/analytics/AdvancedAnalyticsService.ets | arkts | trackEvent | 记录用户行为事件 | async trackEvent(
eventType: string,
eventCategory: string,
properties: Record<string, any> = {},
userId: string = 'anonymous',
duration?: number
): Promise<void> {
try {
if (!this.collectBehaviorData) return;
const event: UserBehaviorEvent = {
id: `event_${Date.now()}_${M... | AST#method_declaration#Left async trackEvent AST#parameter_list#Left ( AST#parameter#Left eventType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventCategory : AST#type_annotation#Left AST#primary_type#Left string AST#... | async trackEvent(
eventType: string,
eventCategory: string,
properties: Record<string, any> = {},
userId: string = 'anonymous',
duration?: number
): Promise<void> {
try {
if (!this.collectBehaviorData) return;
const event: UserBehaviorEvent = {
id: `event_${Date.now()}_${M... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/analytics/AdvancedAnalyticsService.ets#L334-L370 | a41068981904aa9711b1143b00edb3a3c09aabf4 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/ScatterChartModel.ets | arkts | getScatterData | @Override | public getScatterData(): ScatterData | null {
if (this.mData) {
return this.mData;
} else {
return null;
}
} | AST#method_declaration#Left public getScatterData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left ScatterData AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#block_stat... | public getScatterData(): ScatterData | null {
if (this.mData) {
return this.mData;
} else {
return null;
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/ScatterChartModel.ets#L78-L84 | 8e65d2240f9403aef9d448b278fdbf89f348f6d3 | gitee |
iichen-bycode/ArkTsWanandroid.git | ad128756a6c703d9a72cf7f6da128c27fc63bd00 | entry/src/main/ets/event/EventKeys.ets | arkts | 事件的EventNum | export class EventKeys {
//展示loading的事件处理EventID
static readonly LOADING_DIALOG_EVENT = 0x10000
static readonly ON_MAIN_PAGE_HIDE = 0x10001
static readonly ON_MAIN_PAGE_SHOW = 0x10002
static readonly LOGIN_OUT = 0x10003
static readonly LOGIN_IN = 0x10004
} | AST#export_declaration#Left export AST#class_declaration#Left class EventKeys AST#class_body#Left { //展示loading的事件处理EventID AST#property_declaration#Left static readonly LOADING_DIALOG_EVENT = AST#expression#Left 0x10000 AST#expression#Right AST#property_declaration#Right AST#property_declaration#Left static readonly ... | export class EventKeys {
static readonly LOADING_DIALOG_EVENT = 0x10000
static readonly ON_MAIN_PAGE_HIDE = 0x10001
static readonly ON_MAIN_PAGE_SHOW = 0x10002
static readonly LOGIN_OUT = 0x10003
static readonly LOGIN_IN = 0x10004
} | https://github.com/iichen-bycode/ArkTsWanandroid.git/blob/ad128756a6c703d9a72cf7f6da128c27fc63bd00/entry/src/main/ets/event/EventKeys.ets#L4-L11 | 96c70d6c6e59bd4092dfd2dadedf0f93ba5ff2cc | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/KMP.ets | arkts | findFirstMatch | 查找模式串在文本中的第一个出现位置
@param text 文本字符串
@param pattern 模式串
@returns 第一个匹配位置,如果未找到则返回 -1 | static findFirstMatch(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return -1;
}
const lps = KMP.computeLPS(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
let j = 0;
while (i < n) {
if (pattern[j] === text[i... | AST#method_declaration#Left static findFirstMatch AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static findFirstMatch(text: string, pattern: string): number {
if (!text || !pattern || pattern.length === 0) {
return -1;
}
const lps = KMP.computeLPS(pattern);
const m = pattern.length;
const n = text.length;
let i = 0;
let j = 0;
while (i < n) {
if (pattern[j] === text[i... | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/KMP.ets#L190-L219 | c9155671e3e5a7f34e31bb28f5b01221839f81d2 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationContentUtil.ets | arkts | initNotificationMultiLineContent | init multiline notification content
@param basicContent
@param notificationBriefText
@param notificationLongTitle
@param notificationLines
@return return the created NotificationContent | initNotificationMultiLineContent(basicContent: notificationManager.NotificationBasicContent, notificationBriefText: string, notificationLongTitle: string, notificationLines: Array<string>): notificationManager.NotificationContent {
return {
contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE,... | AST#method_declaration#Left initNotificationMultiLineContent AST#parameter_list#Left ( AST#parameter#Left basicContent : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left notificationManager . NotificationBasicContent AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#par... | initNotificationMultiLineContent(basicContent: notificationManager.NotificationBasicContent, notificationBriefText: string, notificationLongTitle: string, notificationLines: Array<string>): notificationManager.NotificationContent {
return {
contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE,... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/validator/acts_validator/entry/src/main/ets/pages/Notification/CustomNotification/notificationUtil/NotificationContentUtil.ets#L67-L79 | 7b14ef9f558d8d0739b9591b8b23a6cdc758ffad | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Card/MovieCard/entry/src/main/ets/viewmodel/FormBean.ets | arkts | Database form entity class. | export default class FormBean {
/**
* Form ID
*/
formId: string = '';
/**
* Form name
*/
formName: string = '';
/**
* Card dimension
*/
dimension: number = 0;
/**
* Get inserted form data.
*
* @return Return form data
*/
toValuesBucket(): relationalStore.ValuesBucket {
... | AST#export_declaration#Left export default AST#class_declaration#Left class FormBean AST#class_body#Left { /**
* Form ID
*/ AST#property_declaration#Left formId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right ; ... | export default class FormBean {
formId: string = '';
formName: string = '';
dimension: number = 0;
toValuesBucket(): relationalStore.ValuesBucket {
return {
'formId': this.formId,
'formName': this.formName,
'dimension': this.dimension
};
}
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Card/MovieCard/entry/src/main/ets/viewmodel/FormBean.ets#L21-L47 | 3968a7385dfcbd5508c13e7eaeca12e56b4c68f1 | gitee | |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | Progress change event when the page loading progress changes.
@typedef OnProgressChangeEvent
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface OnProgressChangeEvent {
/**
* The new progress of the page.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
newProgress: number;
} | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface OnProgressChangeEvent AST#object_type#Left { /**
* The new progress of the page.
*
* @type { number }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
... | export declare interface OnProgressChangeEvent {
newProgress: number;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L301-L311 | bf558f0abb4d5bd92b496539dfaef63d86e53491 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets | arkts | removeRecordSound | MARK: - 删除操作
根据文本删除录音
@param text - 要删除的录音文本 | async removeRecordSound(text: string): Promise<void> {
if (!this.db) return;
const sql = `DELETE FROM ${Tables.Record.name}
WHERE SUBSTR(${Tables.Record.Col.text}, ${DB.salt} + 1,
LENGTH(${Tables.Record.Col.text}) - ${DB.salt}) = ?`;
const textEncoded = StringEncoder.encodedToBase6... | AST#method_declaration#Left async removeRecordSound AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#... | async removeRecordSound(text: string): Promise<void> {
if (!this.db) return;
const sql = `DELETE FROM ${Tables.Record.name}
WHERE SUBSTR(${Tables.Record.Col.text}, ${DB.salt} + 1,
LENGTH(${Tables.Record.Col.text}) - ${DB.salt}) = ?`;
const textEncoded = StringEncoder.encodedToBase6... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Recorder/SpeechRecordDbAccessor.ets#L156-L166 | be2d7edaf303b4cfe958e27c91a8020c858b29d5 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/util/src/main/ets/notification/NotificationUtil.ets | arkts | 通知工具类(按功能场景拆分命名空间) | export namespace NotificationUtil {
/**
* 通知权限管理
*/
export namespace Permission {
/**
* 查询当前应用通知使能状态
* @returns {boolean} 返回true,表示允许发布通知;返回false,表示禁止发布通知
*/
export function isEnabled(): boolean {
return notificationManager.isNotificationEnabledSync();
} | AST#export_declaration#Left export AST#ERROR#Left namespace Not if icationUtil { /**
* 通知权限管理
*/ export namespace Permission { /**
* 查询当前应用通知使能状态
* @returns {boolean} 返回true,表示允许发布通知;返回false,表示禁止发布通知
*/ export AST#ERROR#Right AST#function_declaration#Left function isEnabled AST#parameter_list#Left ... | export namespace NotificationUtil {
export namespace Permission {
export function isEnabled(): boolean {
return notificationManager.isNotificationEnabledSync();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/util/src/main/ets/notification/NotificationUtil.ets#L10-L21 | 185a66f453cbb0a8ebf2481a92b9f8913f5377dc | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | eventbus/src/main/ets/EventBusCore.ets | arkts | postApp | 发布跨App消息
@param eventName 事件名
@param data 发送的数据 | postApp(eventName: string, data: EventAllType) {
let options: commonEventManager.CommonEventPublishData = {
data: eventName,
parameters: { data: data }
};
commonEventManager.publish('event', options, (err) => {
if (err) {
console.error(`Failed to publish common event. Code is ${err... | AST#method_declaration#Left postApp AST#parameter_list#Left ( AST#parameter#Left eventName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left EventAllType AST#primary_type... | postApp(eventName: string, data: EventAllType) {
let options: commonEventManager.CommonEventPublishData = {
data: eventName,
parameters: { data: data }
};
commonEventManager.publish('event', options, (err) => {
if (err) {
console.error(`Failed to publish common event. Code is ${err... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/eventbus/src/main/ets/EventBusCore.ets#L117-L127 | 94f4455c615014e0545bff43b1a103fcf6cb43a7 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.