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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets | arkts | 从收藏的数组中移除 | export function cancelColl(content: string) {
let baiShiArr: PoemFromApi[] = getColl(Constants.baiShi)
//当前数组中肯定有该对象 filter 函数用来过滤数组。去除掉符合规则的数据。
let newArr: PoemFromApi[] = baiShiArr.filter((item: PoemFromApi) => item.content !== content)
// API9
// AppStorage.SetOrCreate(Constants.baiShi, newArr)
// next
... | AST#export_declaration#Left export AST#function_declaration#Left function cancelColl AST#parameter_list#Left ( AST#parameter#Left content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST... | export function cancelColl(content: string) {
let baiShiArr: PoemFromApi[] = getColl(Constants.baiShi)
let newArr: PoemFromApi[] = baiShiArr.filter((item: PoemFromApi) => item.content !== content)
AppStorage.setOrCreate(Constants.baiShi,newArr)
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/LightRed/entry/src/main/ets/viewModel/MyUtils.ets#L53-L61 | 19843604119104632655722941fba5dc564c81fe | gitee | |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/PatternLock/entry/src/main/ets/common/TitleBar.ets | arkts | TitleBar | 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... | @Component
export default struct TitleBar {
private title: Resource = $r('app.string.EntryAbility_label')
build() {
Row() {
Text(this.title)
.fontColor(Color.White)
.fontSize(28)
}
.width('100%')
.height('8%')
.constraintSize({ minHeight: 70 })
.padding({ left: 10, rig... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct TitleBar AST#component_body#Left { AST#property_declaration#Left private title : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left A... | @Component
export default struct TitleBar {
private title: Resource = $r('app.string.EntryAbility_label')
build() {
Row() {
Text(this.title)
.fontColor(Color.White)
.fontSize(28)
}
.width('100%')
.height('8%')
.constraintSize({ minHeight: 70 })
.padding({ left: 10, rig... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/PatternLock/entry/src/main/ets/common/TitleBar.ets#L16-L32 | 47cae5e74bb9e4b136bf1dbe61032bd0723af38d | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/skeletondiagram/src/main/ets/common/CommonEnums.ets | arkts | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export enum LoadingStatus {
OFF = 'off',
LOADING = 'loading',
SUCCESS = 'success',
FAILED = 'failed'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum LoadingStatus AST#enum_body#Left { AST#enum_member#Left OFF = AST#expression#Left 'off' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left LOADING = AST#expression#Left 'loading' AST#expression#Right AST#enum_member#Right , AST#enum_member... | export enum LoadingStatus {
OFF = 'off',
LOADING = 'loading',
SUCCESS = 'success',
FAILED = 'failed'
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/skeletondiagram/src/main/ets/common/CommonEnums.ets#L16-L21 | d87f5c072ab33e26c52b0cd1d28b26ed5f5f3430 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/ChatListDataSource.ets | arkts | indexOf | 查找列表中对象的index | public indexOf(data: ChatModel): number {
Logger.info(TAG, `indexOf data , id = ${data.user.userId} , name = ${data.user.userName}`);
return this.chatList.indexOf(data);
} | AST#method_declaration#Left public indexOf AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left ChatModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | public indexOf(data: ChatModel): number {
Logger.info(TAG, `indexOf data , id = ${data.user.userId} , name = ${data.user.userName}`);
return this.chatList.indexOf(data);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/IM/Chat/features/chatlist/src/main/ets/viewmodel/ChatListDataSource.ets#L44-L47 | 7fba902899812f199160c216472c01305cac2c09 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets | arkts | get | / 获取纯主文件名(第一个点之前的内容) / - "Book.sqlite" → "Book" / - "Book.sqlite.zip" → "Book" | get baseName(): string | null {
return this.fileName !== null ? CMetaInfoHelper.baseName(this.fileName) : null;
} | AST#method_declaration#Left get AST#ERROR#Left b as eName AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Right AST#type_annotation#R... | get baseName(): string | null {
return this.fileName !== null ? CMetaInfoHelper.baseName(this.fileName) : null;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/Download/CMetaInfo_CFile/CMetaInfo.ets#L21-L23 | 3fc3170bc1afbc10da061b25ee30ac85b6a921c8 | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/common/DxinConstants.ets | arkts | 朝代拼音和朝代中文 映射 | export const POETRY_TYPE_ARR: POETRY_TYPE_MAP[] = [
{ type: 'chuCi', typeName: '楚辞' },
{ type: 'lunYu', typeName: '论语' },
{ type: 'shiJing', typeName: '诗经' },
{ type: 'songCi', typeName: '宋词' },
{ type: 'tangShi', typeName: '唐诗' },
{ type: 'yuanQu', typeName: '元曲' },
] | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left POETRY_TYPE_ARR : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left POETRY_TYPE_MAP [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#array_literal#Left ... | export const POETRY_TYPE_ARR: POETRY_TYPE_MAP[] = [
{ type: 'chuCi', typeName: '楚辞' },
{ type: 'lunYu', typeName: '论语' },
{ type: 'shiJing', typeName: '诗经' },
{ type: 'songCi', typeName: '宋词' },
{ type: 'tangShi', typeName: '唐诗' },
{ type: 'yuanQu', typeName: '元曲' },
] | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/common/DxinConstants.ets#L4-L11 | 2afc64fd7d9b702af84daf1ea3647123be128e41 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/timeto/TimeToManager.ets | arkts | clearSavedTime | 清空指定 type 的保存时间和结果 | public static clearSavedTime(type: TimeToType): void {
TimeToManager.clearSavedTimeByName(type);
} | AST#method_declaration#Left public static clearSavedTime AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TimeToType AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST... | public static clearSavedTime(type: TimeToType): void {
TimeToManager.clearSavedTimeByName(type);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/timeto/TimeToManager.ets#L59-L61 | 189ad22e52ab0f0eb9c15001721808db6aec3ad6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildActionItem | 操作项 | @Builder
buildActionItem(title: string, description: string, onAction: () => void, titleColor?: string) {
Row({ space: 12 }) {
Column({ space: 4 }) {
Text(title)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor(titleColor || this.COLORS.textPrimary)
Text... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildActionItem AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left description : AST#type_annotat... | @Builder
buildActionItem(title: string, description: string, onAction: () => void, titleColor?: string) {
Row({ space: 12 }) {
Column({ space: 4 }) {
Text(title)
.fontSize(16)
.fontWeight(FontWeight.Medium)
.fontColor(titleColor || this.COLORS.textPrimary)
Text... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L3863-L3888 | e989600805935c0bf632f64466cd3ae0db9e9613 | github |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/ui/picker/BasePicker.ets | arkts | 基础选择器组件 | export interface PickerOption {
label: string;
value: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface PickerOption AST#object_type#Left { AST#type_member#Left label : 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 value : AST#type_annotation#Lef... | export interface PickerOption {
label: string;
value: string;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/ui/picker/BasePicker.ets#L4-L7 | 8a4522f9dd82b3a6c19a98e0f4dcfb1e499709d1 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Component transition scale. | export const COMPONENT_TRANSITION_SCALE: CustomTransition = { x: 0.5, y: 0.5 }; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left COMPONENT_TRANSITION_SCALE : AST#type_annotation#Left AST#primary_type#Left CustomTransition AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left A... | export const COMPONENT_TRANSITION_SCALE: CustomTransition = { x: 0.5, y: 0.5 }; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L53-L53 | 764f3ff62645ed0d978eb6f92654e7ccad1ab362 | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/managers/SystemSizeManager.ets | arkts | registerListeners | 注册窗口变化监听器 | private registerListeners(): void {
// 监听窗口尺寸变化
this.windowObj?.on('windowSizeChange', (rect) => {
this._windowWidthPx = rect.width;
this._windowHeightPx = rect.height;
});
// 监听避让区域(系统栏)变化
this.windowObj?.on('avoidAreaChange', (data: window.AvoidAreaOptions) => {
if (data.type ==... | AST#method_declaration#Left private registerListeners AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { // 监听窗口尺寸变化 AST#expression_statement#Left AST#expression#Left AST#call_expres... | private registerListeners(): void {
this.windowObj?.on('windowSizeChange', (rect) => {
this._windowWidthPx = rect.width;
this._windowHeightPx = rect.height;
});
this.windowObj?.on('avoidAreaChange', (data: window.AvoidAreaOptions) => {
if (data.type === window.AvoidAreaType.TYPE... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/managers/SystemSizeManager.ets#L101-L117 | 7e47b3a5a4a56673f6d90301147b863f8d63943f | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Multi_device_V2/common/src/main/ets/constants/CommonConstants.ets | arkts | Constants for components. | export class CommonConstants {
/**
* Numeric constant: 1.
*/
static readonly NUM_1: number = 1;
/**
* Numeric constant: 2.
*/
static readonly NUM_2: number = 2;
/**
* Numeric constant: 3.
*/
static readonly NUM_3: number = 3;
/**
* Numeric constant: 4.
*/
static readonly NUM_4... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* Numeric constant: 1.
*/ AST#property_declaration#Left static readonly NUM_1 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left... | export class CommonConstants {
static readonly NUM_1: number = 1;
static readonly NUM_2: number = 2;
static readonly NUM_3: number = 3;
static readonly NUM_4: number = 4;
static readonly GRID_4: number = 4;
static readonly GRID_6: number = 6;
static readonly GRID_8: number = 8;
... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Multi_device_V2/common/src/main/ets/constants/CommonConstants.ets#L19-L214 | de25ef5b4b4d3859be42aa49ae70978dc8583a27 | gitee | |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/builder/Builder0050.ets | arkts | funBuilder0050 | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
function funBuilder0050() {
Text('Hello, Builder')
.id('tvFunBuilder0050')
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function funBuilder0050 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 Text ( AST#expression#Left 'Hello, Bui... | @Builder
function funBuilder0050() {
Text('Hello, Builder')
.id('tvFunBuilder0050')
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_module_noui/ace_ets_module_StateMangagement/ace_ets_module_StateMangagement02_api12/entry/src/main/ets/MainAbility/pages/builder/Builder0050.ets#L16-L20 | 12b90d70fc3af72a4da16d679bad1e416c63d255 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/demo/DemoNavigator.ets | arkts | toNetworkRequest | 跳转到通用网络请求示例页
@returns {void} 无返回值 | static toNetworkRequest(): void {
navigateTo(DemoRoutes.NetworkRequest);
} | AST#method_declaration#Left static toNetworkRequest AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_component_statement#Left navigateTo ( AST#expression#Left AST#mem... | static toNetworkRequest(): void {
navigateTo(DemoRoutes.NetworkRequest);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/demo/DemoNavigator.ets#L55-L57 | 98c000c9652b178ef72fe77dca4d36a6b82e5b75 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/arkui/component/lazyForEach.d.ets | arkts | Defines type to operation data source.
@enum { string }
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 20 | export enum DataOperationType {
/**
* Add data.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/
ADD = 'add',
/**
* Delete data.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomics... | AST#export_declaration#Left export AST#enum_declaration#Left enum DataOperationType AST#enum_body#Left { /**
* Add data.
*
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 20
*/ AST#enum_member#Left ADD = AST#expression#Left 'add' AST#expression#R... | export enum DataOperationType {
ADD = 'add',
DELETE = 'delete',
EXCHANGE = 'exchange',
MOVE = 'move',
CHANGE = 'change',
RELOAD = 'reload'
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/arkui/component/lazyForEach.d.ets#L36-L91 | 6d3c1f0299a123bf3b8966c463cd23f3dec2f748 | gitee | |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets | arkts | getRelativeDateDescription | 获取相对日期描述(如"今天"、"明天"、"3天后"等)
@param date 需要描述的日期
@returns 相对日期描述 | static getRelativeDateDescription(date: Date): string {
const today = new Date();
const days = TimeUtils.daysBetween(today, date);
if (TimeUtils.isToday(date)) {
return '今天';
} else if (days === 1 && date > today) {
return '明天';
} else if (days === 2 && date > today) {
return ... | AST#method_declaration#Left static getRelativeDateDescription AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AS... | static getRelativeDateDescription(date: Date): string {
const today = new Date();
const days = TimeUtils.daysBetween(today, date);
if (TimeUtils.isToday(date)) {
return '今天';
} else if (days === 1 && date > today) {
return '明天';
} else if (days === 2 && date > today) {
return ... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/utils/TimeUtils.ets#L218-L233 | c484425f2846c39b515f1363c6a97f6601425e3e | github |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/OptionDialogComponent.ets | arkts | OptionDialogComponent | @description: 修改新别弹窗
@date: 2024-01-14 21:47
@author wuwenqiang | @CustomDialog
export default struct OptionDialogComponent {
controller: CustomDialogController
cancel: () => void
confirm: (value: string) => void
options: Array<string>
build() {
Column() {
Column() {
ForEach(this.options, (item: string, index: number) => {
Text(item)
... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct OptionDialogComponent AST#component_body#Left { AST#method_declaration#Left controller AST#ERROR#Left : AST#ERROR#Left CustomDialogController cancel : AST#ERROR#Right AST#type_annotation#Left AST#function_t... | @CustomDialog
export default struct OptionDialogComponent {
controller: CustomDialogController
cancel: () => void
confirm: (value: string) => void
options: Array<string>
build() {
Column() {
Column() {
ForEach(this.options, (item: string, index: number) => {
Text(item)
... | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/OptionDialogComponent.ets#L9-L56 | e046d013de9d96b659a710016fc6cd0cfc5e1b0e | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componetsmodel/NoteVO.ets | arkts | Copyright (C), 2024-05-13
@author LinXun
@date 2024/5/13 15:25
@version 1.0
@description: 笔记显示模型 | export class NoteVO {
// id
id: number;
// 笔记引用内容
noteContent: string;
// 笔记内容
note?: string;
// 创建时间
createTime: string;
/**
* 构造方法
* @param noteContent
* @param note
* @param createTime
*/
constructor(id: number, noteContent: string, createTime: string, note?: string) {
this.id ... | AST#export_declaration#Left export AST#class_declaration#Left class NoteVO AST#class_body#Left { // id AST#property_declaration#Left id : 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 noteCo... | export class NoteVO {
id: number;
noteContent: string;
note?: string;
createTime: string;
constructor(id: number, noteContent: string, createTime: string, note?: string) {
this.id = id;
this.noteContent = noteContent;
this.note = note;
this.createTime = createTime;
}
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/componetsmodel/NoteVO.ets#L8-L29 | f0db09fe69dc8923125f5c2a7b7a345cba10cc9b | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | spinkit/src/main/ets/components/SpinS.ets | arkts | SpinS | TODO SpinKit动画组件
author: 桃花镇童长老
since: 2024/05/01 | @ComponentV2
export struct SpinS {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local scale1: number = 1;
@Local scale2: number = 0.3;
@Local scale3: number = 0.4;
@Local scale4: number = 0.5;
@Local scale5: number = 0.6;
... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct SpinS AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right spinSize : AST#type_annotation#Left AST#primary_type#Left... | @ComponentV2
export struct SpinS {
@Require @Param spinSize: number = 36;
@Require @Param spinColor: ResourceColor;
@Local round1: number = this.spinSize * 0.2
@Local scale1: number = 1;
@Local scale2: number = 0.3;
@Local scale3: number = 0.4;
@Local scale4: number = 0.5;
@Local scale5: number = 0.6;
... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/spinkit/src/main/ets/components/SpinS.ets#L23-L138 | 90591114af8a4193d06deb7a1661d3ff25c2786e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SettingsPage.ets | arkts | buildSettingsItem | 构建设置项 | @Builder
buildSettingsItem(item: SettingsItem, isLast: boolean) {
Row({ space: 16 }) {
// 图标
Image(item.icon)
.width('24vp')
.height('24vp')
.fillColor('#666666')
// 标题和描述
Column({ space: 2 }) {
Text(item.title)
.fontSize(16)
.font... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSettingsItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left SettingsItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left isLast : AST#type_annot... | @Builder
buildSettingsItem(item: SettingsItem, isLast: boolean) {
Row({ space: 16 }) {
Image(item.icon)
.width('24vp')
.height('24vp')
.fillColor('#666666')
Column({ space: 2 }) {
Text(item.title)
.fontSize(16)
.fontColor('#33333... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L492-L558 | 838f388da4ad442ab03b0233ee7317314ab1c592 | github |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets | arkts | onVodTotalDuration | @description 监听资源播放资源的时长,单位为毫秒(ms),用于刷新进度条长度
@param duration 回放时长,单位为毫秒(ms)。 | onVodTotalDuration(duration: number) {
this.totalDuration = duration;
if(this.webinars?.record?.preview_paas_record_id != undefined && this.webinars?.record?.preview_paas_record_id.length > 0){
let s = duration / 1000; // 秒
let m = 0; // 分
if (s > 59) {
m = Math.floor(s / 60);
}... | AST#method_declaration#Left onVodTotalDuration AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#... | onVodTotalDuration(duration: number) {
this.totalDuration = duration;
if(this.webinars?.record?.preview_paas_record_id != undefined && this.webinars?.record?.preview_paas_record_id.length > 0){
let s = duration / 1000;
let m = 0;
if (s > 59) {
m = Math.floor(s / 60);
}
... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchVodPlayerComponent.ets#L381-L393 | d65a8a5cd0d460d7f519041916de14d5275473b4 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/datas/model/SearchManager.ets | arkts | initialize | MARK: - 初始化方法 | private initialize(): void {
this.loadWords();
DebugLog.d('SearchManager: 初始化完成');
} | AST#method_declaration#Left private initialize AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expre... | private initialize(): void {
this.loadWords();
DebugLog.d('SearchManager: 初始化完成');
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/datas/model/SearchManager.ets#L77-L80 | 5e0306da52e148b4dc4c176ff70722f1ef0a65ed | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | restoreData | 恢复数据 | private restoreData(): void {
AlertDialog.show({
title: '恢复数据',
message: '恢复数据将覆盖当前所有数据,确定要继续吗?',
primaryButton: {
value: '取消',
action: () => {}
},
secondaryButton: {
value: '确认恢复',
fontColor: Color.Red,
action: () => {
promptAction.sho... | AST#method_declaration#Left private restoreData AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expr... | private restoreData(): void {
AlertDialog.show({
title: '恢复数据',
message: '恢复数据将覆盖当前所有数据,确定要继续吗?',
primaryButton: {
value: '取消',
action: () => {}
},
secondaryButton: {
value: '确认恢复',
fontColor: Color.Red,
action: () => {
promptAction.sho... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L6189-L6208 | d6537879c0e3e0f35428900025fcf7da30b4968f | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets | arkts | GridObjectSortComponentOptions of GridObjectSortComponent.
@interface GridEditOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@since 11
GridObjectSortComponentOptions of GridObjectSortComponent.
@interface GridEditOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since ... | export interface GridObjectSortComponentOptions {
/**
* Configuration GridObjectSortComponent type.
* @type { GridObjectSortComponentType }
* @default GridObjectSortComponentType.TEXT
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @since 11
*/
/**
* Configuration GridObjectS... | AST#export_declaration#Left export AST#interface_declaration#Left interface GridObjectSortComponentOptions AST#object_type#Left { /**
* Configuration GridObjectSortComponent type.
* @type { GridObjectSortComponentType }
* @default GridObjectSortComponentType.TEXT
* @syscap SystemCapability.ArkUI.ArkUI.Full
... | export interface GridObjectSortComponentOptions {
type?: GridObjectSortComponentType;
imageSize?: number | Resource;
normalTitle?: ResourceStr;
editTitle?: ResourceStr;
showAreaTitle?: ResourceStr;
addAreaTitle?: ResourceStr;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets#L197-L301 | 3351a7ea9c4ad7c4dd7727eed712f59acc498efa | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setDrawRoundedSlices | Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled
and if the slices are not drawn under the hole.
@param enabled draw curved ends of slices | public setDrawRoundedSlices(enabled: boolean): void {
this.mDrawRoundedSlices = enabled;
} | AST#method_declaration#Left public setDrawRoundedSlices AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#... | public setDrawRoundedSlices(enabled: boolean): void {
this.mDrawRoundedSlices = enabled;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/charts/PieChartModel.ets#L751-L753 | 9cd4e230d423a455a542ccb5ce21489ef2de15e6 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/view/AddressListPage.ets | arkts | AddressActionSlot | 渲染地址操作区域
@param {Address} item - 地址数据
@returns {void} 无返回值 | @Builder
private AddressActionSlot(item: Address): void {
Row({ space: 8 }) {
AddressActionButton({
iconResId: $r("app.media.ic_edit_fill"),
onTap: (): void => this.vm.onEditAddress(item.id)
});
AddressActionButton({
iconResId: $r("app.media.ic_delete_fill"),
onT... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private AddressActionSlot AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left Address AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_ann... | @Builder
private AddressActionSlot(item: Address): void {
Row({ space: 8 }) {
AddressActionButton({
iconResId: $r("app.media.ic_edit_fill"),
onTap: (): void => this.vm.onEditAddress(item.id)
});
AddressActionButton({
iconResId: $r("app.media.ic_delete_fill"),
onT... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/view/AddressListPage.ets#L125-L138 | 1da98aaa4e42c31e58ebf138eb8854c81a798bdf | github |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/ThemeManager.ets | arkts | registerPageController | 注册页面主题控制器 | registerPageController(controller: PageThemeController): void {
this.pageControllers.set(controller.pageName, controller);
// 立即应用当前主题
controller.applyTheme(this.getCurrentTheme());
} | AST#method_declaration#Left registerPageController AST#parameter_list#Left ( AST#parameter#Left controller : AST#type_annotation#Left AST#primary_type#Left PageThemeController AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | registerPageController(controller: PageThemeController): void {
this.pageControllers.set(controller.pageName, controller);
controller.applyTheme(this.getCurrentTheme());
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/ThemeManager.ets#L225-L229 | 99d42a0834dc052555b73ac5b3dc02ec3c68fa13 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/scenes/agency/src/main/ets/agency/components/PlanTimeSetting.ets | arkts | PlanTimeSetting | 待办任务 | @ComponentV2
export struct PlanTimeSetting {
@Consumer() planDatetime: string = '';
@Consumer() planTime: DateTimeElement | undefined;
@Event onDateChange: (d: DateTimeElement) => void = (d: DateTimeElement) => {
};
build() {
Row() {
Row() {
Row() {
Text($r('app.string.select_plan... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct PlanTimeSetting AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Consumer ( ) AST#decorator#Right planDatetime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | @ComponentV2
export struct PlanTimeSetting {
@Consumer() planDatetime: string = '';
@Consumer() planTime: DateTimeElement | undefined;
@Event onDateChange: (d: DateTimeElement) => void = (d: DateTimeElement) => {
};
build() {
Row() {
Row() {
Row() {
Text($r('app.string.select_plan... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/scenes/agency/src/main/ets/agency/components/PlanTimeSetting.ets#L7-L59 | 86d65edfefffdf148ae6d9a987bb02d965240910 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | setupDailyReminder | 设置每日定时提醒 | private async setupDailyReminder(): Promise<void> {
try {
if (!this.birthdayReminderEnabled) {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Birthday reminder is disabled, skipping daily reminder setup');
return;
}
// 解析提醒时间
const timeParts = this.r... | AST#method_declaration#Left private async setupDailyReminder 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 ... | private async setupDailyReminder(): Promise<void> {
try {
if (!this.birthdayReminderEnabled) {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, '[TestSimple] Birthday reminder is disabled, skipping daily reminder setup');
return;
}
const timeParts = this.reminderTi... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L912-L931 | f6db2ee9e300da7fc7d58f70817b6c12e5f15422 | github |
openharmony-sig/knowledge_demo_smart_home | 6cdf5d81ef84217f386c4200bfc4124a0ded5a0d | FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets | arkts | deleteDevice | 根据设备ID获取设备信息 | static async deleteDevice(deviceId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
... | AST#method_declaration#Left static async deleteDevice AST#parameter_list#Left ( AST#parameter#Left deviceId : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left string AST... | static async deleteDevice(deviceId: string, userId: string) {
let httpRequest = http.createHttp();
let data = await httpRequest.request(
`${DistScheduleService.distScheduleServer}/device/${deviceId}`,
{
method: RequestMethod.DELETE,
header: {
'userId': `${userId}`
... | https://github.com/openharmony-sig/knowledge_demo_smart_home/blob/6cdf5d81ef84217f386c4200bfc4124a0ded5a0d/FA/DistScheduleEts/entry/src/main/ets/common/service/distScheduleService.ets#L220-L242 | 475dbc35192cf353537b844691bf16ea34ffafbc | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/notification/NotificationManager.ets | arkts | generateGreetingSuggestions | 生成祝福语准备建议 | private async generateGreetingSuggestions(): Promise<SmartSuggestion[]> {
const suggestions: SmartSuggestion[] = [];
const upcomingBirthdays = await this.getUpcomingBirthdays();
for (const item of upcomingBirthdays) {
if (item.daysUntil <= 3) {
suggestions.push({
id: `greeting_${ite... | AST#method_declaration#Left private async generateGreetingSuggestions AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SmartSuggestion [ ] AST#a... | private async generateGreetingSuggestions(): Promise<SmartSuggestion[]> {
const suggestions: SmartSuggestion[] = [];
const upcomingBirthdays = await this.getUpcomingBirthdays();
for (const item of upcomingBirthdays) {
if (item.daysUntil <= 3) {
suggestions.push({
id: `greeting_${ite... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/notification/NotificationManager.ets#L377-L398 | baf8b34e20f702ae5ecabc85593594db0a1f60a4 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/contacts/ContactEditPage.ets | arkts | buildSolarBirthdayInput | 构建公历生日录入 | @Builder
buildSolarBirthdayInput() {
Column({ space: 16 }) {
// 是否包含年份
Row() {
Toggle({ type: ToggleType.Switch, isOn: this.hasYear })
.selectedColor('#4ECDC4')
.onChange((isOn: boolean) => {
this.hasYear = isOn;
})
Text('包含出生年份')
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildSolarBirthdayInput AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( AST#component_parameters#Left { AST#compo... | @Builder
buildSolarBirthdayInput() {
Column({ space: 16 }) {
Row() {
Toggle({ type: ToggleType.Switch, isOn: this.hasYear })
.selectedColor('#4ECDC4')
.onChange((isOn: boolean) => {
this.hasYear = isOn;
})
Text('包含出生年份')
.fo... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/contacts/ContactEditPage.ets#L576-L659 | 16027c2552f7cd13fa24e788fcd514b5bd0f52f8 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List/entry/src/main/ets/common/CommonConstants.ets | arkts | margin | export const REFRESH_ICON_MARGIN_RIGHT: number = 20; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left REFRESH_ICON_MARGIN_RIGHT : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 20 AST#expression#Right AST#variable_declarator#Right ; AST#variabl... | export const REFRESH_ICON_MARGIN_RIGHT: number = 20; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List/entry/src/main/ets/common/CommonConstants.ets#L31-L31 | a415647ab4a2d3d5a32c6bf83a57636b8fb54780 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/view/OrderPayPage.ets | arkts | PriceSection | 支付金额展示区域
@returns {void} 无返回值 | @Builder
private PriceSection(): void {
ColumnCenter({ widthValue: P100 }) {
IBestPrice({
value: this.vm.payPrice,
symbolFontSize: 22,
integerFontSize: 42,
decimalPointFontSize: 22,
decimalFontSize: 22
});
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private PriceSection AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_... | @Builder
private PriceSection(): void {
ColumnCenter({ widthValue: P100 }) {
IBestPrice({
value: this.vm.payPrice,
symbolFontSize: 22,
integerFontSize: 42,
decimalPointFontSize: 22,
decimalFontSize: 22
});
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/view/OrderPayPage.ets#L91-L102 | 7d2cc6a2315def02b4501353d96b781a459546f1 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets | arkts | generateAESKey128 | 生成AES的对称密钥-128位
@returns AES密钥-128位 | static async generateAESKey128(): Promise<OutDTO<string>> {
return CryptoUtil.generateSymKey('AES128');
} | AST#method_declaration#Left static async generateAESKey128 AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left OutDTO AST#type_arguments#Left < A... | static async generateAESKey128(): Promise<OutDTO<string>> {
return CryptoUtil.generateSymKey('AES128');
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/AES.ets#L74-L76 | 6735e9d97566a000892d7ac20601486974688006 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets | arkts | query | Query dayInfo.
@param date
@param callback | query(date: string, callback: Function): void {
let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates(Const.DAY_INFO.tableName ? Const.DAY_INFO.tableName : '');
predicates.equalTo('date', date);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count ... | AST#method_declaration#Left query AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right ... | query(date: string, callback: Function): void {
let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates(Const.DAY_INFO.tableName ? Const.DAY_INFO.tableName : '');
predicates.equalTo('date', date);
RdbUtils.query(predicates).then(resultSet => {
let count = resultSet.rowCount;
if (count ... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets#L60-L79 | 9a4ad511312275bbd2f98e03336b3c12b05932ff | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | getConvertKeyPair | 获取转换的非对称密钥KeyPair,异步
@param pubKey 公钥字符串
@param priKey 私钥字符串
@param keyCoding 秘钥的编码方式(base64/hex/utf8/utf-8)
@param algName 待生成对称密钥生成器的算法名称
@returns | static async getConvertKeyPair(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: crypto.RSA_AlG = 'RSA1024|PRIMES_2'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.getConvertKeyPair(algN... | AST#method_declaration#Left static async getConvertKeyPair AST#parameter_list#Left ( AST#parameter#Left pubKey : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Uint8Array AST#primary_type#Right | AST#primary_type#Left AST#qualified_type#Left cryp... | static async getConvertKeyPair(pubKey: string | Uint8Array | cryptoFramework.DataBlob | null,
priKey: string | Uint8Array | cryptoFramework.DataBlob | null, keyCoding: crypto.BhuCoding,
algName: crypto.RSA_AlG = 'RSA1024|PRIMES_2'): Promise<cryptoFramework.KeyPair> {
return CryptoUtil.getConvertKeyPair(algN... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L209-L213 | e3c49565c38ced030d6910e65909a32c0b1faaab | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToStream.ets | arkts | releaseFD | [End create_file_fd2] [Start release_fd2] | async releaseFD() {
if (this.file?.fd != undefined && this.file.fd?.valueOf() > 0) {
// 关闭文件
try {
fs.close(this.file.fd);
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `close fail. code = ${err.code}, message = ${err.message}`);
}... | AST#method_declaration#Left async releaseFD AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#express... | async releaseFD() {
if (this.file?.fd != undefined && this.file.fd?.valueOf() > 0) {
try {
fs.close(this.file.fd);
} catch (error) {
let err = error as BusinessError;
hilog.error(0x0000, 'testTag', `close fail. code = ${err.code}, message = ${err.message}`);
}
}
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/avscreen-capture-screen-record-master/entry/src/main/ets/pages/CAVScreenCaptureToStream.ets#L77-L87 | e8d85fe8813506e4f0b151fe3c5c016af5cc863b | gitee |
jjjjjjava/ffmpeg_tools.git | 6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161 | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | videoToImages | 视频批量截图
@param input 输入视频路径
@param outputPattern 输出图片路径模式,如 "/path/frame_%04d.jpg"
@param fps 每秒截取帧数,默认 1(每秒1张) | public static videoToImages(input: string, outputPattern: string, fps: number = 1): string[] {
return [
'ffmpeg',
'-i', input,
'-vf', `fps=${fps}`,
'-q:v', '2',
'-y', outputPattern
];
} | AST#method_declaration#Left public static videoToImages AST#parameter_list#Left ( AST#parameter#Left input : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left outputPattern : AST#type_annotation#Left AST#primary_type#Left stri... | public static videoToImages(input: string, outputPattern: string, fps: number = 1): string[] {
return [
'ffmpeg',
'-i', input,
'-vf', `fps=${fps}`,
'-q:v', '2',
'-y', outputPattern
];
} | https://github.com/jjjjjjava/ffmpeg_tools.git/blob/6c73f7540bc7ca3f0d5b3edd7a6c10cb84a26161/src/main/ets/ffmpeg/FFmpegFactory.ets#L261-L269 | 529c4d1fe71305b1c4f3bcf9743e421db92fe520 | github |
Tianpei-Shi/MusicDash.git | 4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5 | src/pages/LoginPage.ets | arkts | switchToLogin | 切换到登录视图 | switchToLogin(): void {
this.isRegistering = false;
} | AST#method_declaration#Left switchToLogin AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#memb... | switchToLogin(): void {
this.isRegistering = false;
} | https://github.com/Tianpei-Shi/MusicDash.git/blob/4db7ea82fb9d9fa5db7499ccdd6d8d51a4bb48d5/src/pages/LoginPage.ets#L127-L129 | b5c25316f864a07c3241ac172602913694dd86bb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets | arkts | paintTask | 绘制模拟时钟任务 | private paintTask() {
// 1.先将绘制原点转到画布中央
this.renderContext.translate(this.clockRadius, this.clockRadius);
// 2.监听时间变化,每秒重新绘制一次
this.timeListener = new TimeChangeListener(
(hour: number, minute: number, second: number) => {
this.renderContext.clearRect(-this.clockRadius, -this.clockRadius,... | AST#method_declaration#Left private paintTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 1.先将绘制原点转到画布中央 AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left A... | private paintTask() {
this.renderContext.translate(this.clockRadius, this.clockRadius);
this.timeListener = new TimeChangeListener(
(hour: number, minute: number, second: number) => {
this.renderContext.clearRect(-this.clockRadius, -this.clockRadius, this.canvasSize, this.canvasSize);
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/analogclock/src/main/ets/pages/AnalogClockComponent.ets#L160-L173 | 94e843e7de3048b0b010dae65f8826764057a88f | gitee |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/components/DialogComponent.ets | arkts | DialogComponent | @description: 退出登录弹窗
@date: 2024-01-14 21:47
@author wuwenqiang | @CustomDialog
export default struct DialogComponent {
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
};
title: string = ""
build() {
Column() {
Text(this.title)
.padding(size.pagePadding * 2)
Row() {
Text('取消')
.on... | AST#decorated_export_declaration#Left AST#decorator#Left @ CustomDialog AST#decorator#Right export default struct DialogComponent AST#component_body#Left { AST#property_declaration#Left controller : AST#ERROR#Left CustomDialogController cancel : AST#ERROR#Right AST#type_annotation#Left AST#function_type#Left AST#parame... | @CustomDialog
export default struct DialogComponent {
controller: CustomDialogController
cancel: () => void = () => {
}
confirm: () => void = () => {
};
title: string = ""
build() {
Column() {
Text(this.title)
.padding(size.pagePadding * 2)
Row() {
Text('取消')
.on... | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/components/DialogComponent.ets#L9-L64 | b992fbe6d1192bf1f6e9976d594dc0e42810029c | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/Focusable.ets | arkts | FocusableExample | [Start dynamic_focus_control_manage] | @Entry
@Component
export struct FocusableExample {
@State textFocusable: boolean = true;
@State textEnabled: boolean = true;
@State color1: Color = Color.Yellow;
@State color2: Color = Color.Yellow;
@State color3: Color = Color.Yellow;
build() {
NavDestination() {
Column({ space: 12 }) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Entry AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct FocusableExample AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right textFocusable : AST#type_annotation#Left AST#prima... | @Entry
@Component
export struct FocusableExample {
@State textFocusable: boolean = true;
@State textEnabled: boolean = true;
@State color1: Color = Color.Yellow;
@State color2: Color = Color.Yellow;
@State color3: Color = Color.Yellow;
build() {
NavDestination() {
Column({ space: 12 }) {
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/focus/Focusable.ets#L19-L112 | 22c7e5ba279cabb70aaf8044419bc3a0fbd0e146 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets | arkts | 定义功能图标网格项的数据类型。
每个网格项包含一个图标 (icon) 和一个标题 (title)。 | export interface MyGridItem {
icon: Resource
title: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MyGridItem AST#object_type#Left { AST#type_member#Left icon : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right AST#type_member#Left title : AST#type_annotation#Left A... | export interface MyGridItem {
icon: Resource
title: string
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/model/DataModel.ets#L60-L63 | 1a84dae720bfb2acb2ed82c2f2552f82581f94f6 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/List_HDC/entry/src/main/ets/model/TaskInitList.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, softw... | export interface TaskListItem {
taskID: number;
taskName: Resource;
isOpen: boolean;
unit: string;
icon: Resource;
targetValue: string;
isAlarm: boolean;
startTime: string;
frequency: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TaskListItem AST#object_type#Left { AST#type_member#Left taskID : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left taskName : AST#type_annotation... | export interface TaskListItem {
taskID: number;
taskName: Resource;
isOpen: boolean;
unit: string;
icon: Resource;
targetValue: string;
isAlarm: boolean;
startTime: string;
frequency: string;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/List_HDC/entry/src/main/ets/model/TaskInitList.ets#L16-L26 | e3d8141d3e9c5444dafbba8f727af47fb8beebad | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | hardwareModel | 硬件版本号 | static hardwareModel(): string {
return deviceInfo.hardwareModel
} | AST#method_declaration#Left static hardwareModel AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_exp... | static hardwareModel(): string {
return deviceInfo.hardwareModel
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L71-L73 | 28c8da563fe031c1a99c625d97e4fc069f44330d | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | update_url | Asks the tab to update its link, usually called when the tab loads something new.
This automatically updates the web settings as well!
@param force_update_web_settings Set to true if you want to force refresh web settings and trigger UI update.
@returns The updated url. | update_url(force_update_web_settings: boolean = false) {
let url_got: string | undefined = this.url;
try {
url_got = this.controller?.getUrl();
} catch (e) {
console.error('[update_url] Failed: ' + e);
}
if (url_got) {
this.url = url_resource_to_meow(url_got);
if (force_updat... | AST#method_declaration#Left update_url AST#parameter_list#Left ( AST#parameter#Left force_update_web_settings : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#... | update_url(force_update_web_settings: boolean = false) {
let url_got: string | undefined = this.url;
try {
url_got = this.controller?.getUrl();
} catch (e) {
console.error('[update_url] Failed: ' + e);
}
if (url_got) {
this.url = url_resource_to_meow(url_got);
if (force_updat... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L823-L843 | 6f96c1e46c2a8cbb437602861ef8d9b4336ef7c4 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoHelper.ets | arkts | uint8ArrayToStr | Uint8Array转字符串
@param arr Uint8Array
@param coding 编码方式(base64/hex/utf8/utf-8)。
@returns | static uint8ArrayToStr(arr: Uint8Array, coding: crypto.BhuCoding): string {
if (coding === 'base64') { //base64
return Base64Util.encodeToStrSync(arr);
} else if (coding === 'hex') { //hex-16进制类型
return StrUtil.hexToStr(arr);
} else {
return buffer.from(arr).toString(coding);
}
} | AST#method_declaration#Left static uint8ArrayToStr AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left coding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_... | static uint8ArrayToStr(arr: Uint8Array, coding: crypto.BhuCoding): string {
if (coding === 'base64') {
return Base64Util.encodeToStrSync(arr);
} else if (coding === 'hex') {
return StrUtil.hexToStr(arr);
} else {
return buffer.from(arr).toString(coding);
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoHelper.ets#L83-L91 | 215cbaca7f158e009fe2290775a2814cb2910ea1 | gitee |
robotzzh/AgricultureApp.git | 7b12c588dd1d07cc07a8b25577d785d30bd838f6 | entry/src/main/ets/models/MainViewModel.ets | arkts | refresh_data | public farmBean: FarmBean[] = []; 192.168.1.151 | public refresh_data(Index: number){
//TODO:将本地IP改成wifi解码
console.info("localIP change1 to "+this.localIP)
let tcp =new TCP(this.localIP,12345,this.farmBean[Index].sensor_IP, this.farmBean[Index].sensor_port);
tcp.connect(this.localIP);
tcp.subscribe();
connection.getAppNet(function(error, data) {
... | AST#method_declaration#Left public refresh_data 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#ERROR#Left { //TODO:将本地IP改成wifi解码 AST#statement#Left AST#expressi... | public refresh_data(Index: number){
console.info("localIP change1 to "+this.localIP)
let tcp =new TCP(this.localIP,12345,this.farmBean[Index].sensor_IP, this.farmBean[Index].sensor_port);
tcp.connect(this.localIP);
tcp.subscribe();
connection.getAppNet(function(error, data) {
console.log("in... | https://github.com/robotzzh/AgricultureApp.git/blob/7b12c588dd1d07cc07a8b25577d785d30bd838f6/entry/src/main/ets/models/MainViewModel.ets#L26-L69 | ce937a82d298566791011f90abb3f9e13ac80a5a | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 隐私设置接口 | export interface PrivacySettings {
dataEncryption: boolean;
biometricLock: boolean;
autoLockTimeout: number;
anonymousAnalytics: boolean;
crashReporting: boolean;
locationTracking: boolean;
contactSyncEnabled: boolean;
backupToCloud: boolean;
shareUsageData: boolean;
dataCollection: boolean;
analy... | AST#export_declaration#Left export AST#interface_declaration#Left interface PrivacySettings AST#object_type#Left { AST#type_member#Left dataEncryption : 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 biometricLock : AS... | export interface PrivacySettings {
dataEncryption: boolean;
biometricLock: boolean;
autoLockTimeout: number;
anonymousAnalytics: boolean;
crashReporting: boolean;
locationTracking: boolean;
contactSyncEnabled: boolean;
backupToCloud: boolean;
shareUsageData: boolean;
dataCollection: boolean;
analy... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L182-L196 | be601319af90d63ff6ead0bce12ddd36c94848f2 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | updateSpecCount | 更新商品规格数量
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@param {number} count 新数量
@returns {Promise<void>} Promise<void> | async updateSpecCount(goodsId: number, specId: number, count: number): Promise<void> {
await this.cartRepository.updateCartSpecCount(goodsId, specId, count);
// 更新本地数据
for (const cart of this.cartList) {
if (cart.goodsId === goodsId) {
for (const spec of cart.spec) {
if (spec.id === ... | AST#method_declaration#Left async updateSpecCount AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | async updateSpecCount(goodsId: number, specId: number, count: number): Promise<void> {
await this.cartRepository.updateCartSpecCount(goodsId, specId, count);
for (const cart of this.cartList) {
if (cart.goodsId === goodsId) {
for (const spec of cart.spec) {
if (spec.id === specId) {... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L168-L184 | 0b725f3912d559df6dbf361c3a3b2525ddf2f2e2 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets | arkts | onBackgroundUpdate | 应用前后台切换回调,进后台时需要释放扫码资源,进前台时需要重启扫码功能
@returns {void} | onBackgroundUpdate(): void {
if (this.subPageStack.size() > 0) {
return;
}
if (this.isBackground) {
this.customScanVM.stopCustomScan();
} else {
this.customScanVM.restartCustomScan();
}
} | AST#method_declaration#Left onBackgroundUpdate 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#if_statement#Left if ( AST#expression#Left AST#binary_expression#Le... | onBackgroundUpdate(): void {
if (this.subPageStack.size() > 0) {
return;
}
if (this.isBackground) {
this.customScanVM.stopCustomScan();
} else {
this.customScanVM.restartCustomScan();
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/pages/CustomScanPage.ets#L105-L115 | 5ae1e4c8e1b4eaf95bb6b64066befa96e66939c0 | gitee |
Musicys/ArktsShop.git | 1e2f77b90766f9dfd5ad94063aad7684befbbc07 | hwsc/entry/src/main/ets/pages/oder/index.ets | arkts | formatDate | 格式化 ISO 时间为本地可读格式(简化版) | private formatDate(isoString: string): string {
if (!isoString) return '';
const date = new Date(isoString);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).pad... | AST#method_declaration#Left private formatDate AST#parameter_list#Left ( AST#parameter#Left isoString : 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#primar... | private formatDate(isoString: string): string {
if (!isoString) return '';
const date = new Date(isoString);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).pad... | https://github.com/Musicys/ArktsShop.git/blob/1e2f77b90766f9dfd5ad94063aad7684befbbc07/hwsc/entry/src/main/ets/pages/oder/index.ets#L151-L160 | 100dbfc939fc1e1c65f8e75610c042ea4e3b6fbd | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement2.ets | arkts | updateSAB | [EndExclude updatesab] | @Concurrent
function updateSAB(args: Uint32Array) {
if (args[0] == 0) {
args[0] = 100;
return 100;
} else if (args[0] == 100) {
args[0] = 200;
return 200;
} else if (args[0] == 200) {
args[0] = 300;
return 300;
}
return 0;
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Concurrent AST#decorator#Right function updateSAB AST#parameter_list#Left ( AST#parameter#Left args : AST#type_annotation#Left AST#primary_type#Left Uint32Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AS... | @Concurrent
function updateSAB(args: Uint32Array) {
if (args[0] == 0) {
args[0] = 100;
return 100;
} else if (args[0] == 100) {
args[0] = 200;
return 200;
} else if (args[0] == 200) {
args[0] = 300;
return 300;
}
return 0;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/UseSendable/entry/src/main/ets/pages/ConcurrentTaskManagement2.ets#L29-L42 | 463c62e651189dd2c56ef17732341d417081487f | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | lunarToSolar | 农历转公历(用于生日计算)
@param lunarYear 农历年
@param lunarMonth 农历月
@param lunarDay 农历日
@param isLeapMonth 是否闰月
@returns 公历日期 | static lunarToSolar(lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean = false): SolarDate | null {
if (!ComprehensiveLunarDatabase.isSupportedYear(lunarYear)) {
return null;
}
// 验证农历日期有效性
if (!LunarCalendar.isValidLunarDate(lunarYear, lunarMonth, lunarDay, isLeapMonth... | AST#method_declaration#Left static lunarToSolar AST#parameter_list#Left ( AST#parameter#Left lunarYear : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left lunarMonth : AST#type_annotation#Left AST#primary_type#Left number AST#... | static lunarToSolar(lunarYear: number, lunarMonth: number, lunarDay: number, isLeapMonth: boolean = false): SolarDate | null {
if (!ComprehensiveLunarDatabase.isSupportedYear(lunarYear)) {
return null;
}
if (!LunarCalendar.isValidLunarDate(lunarYear, lunarMonth, lunarDay, isLeapMonth)) {
r... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L343-L387 | 4538a26afe0ed84ea6215ff4dd8b8fc283dd3aae | github |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/pages/MainPage.ets | arkts | startDownloadUpdateTimer | 开始下载更新定时器 | startDownloadUpdateTimer() {
if (this.downloadUpdateTimer === -1) {
this.downloadUpdateTimer = setInterval(() => {
this.loadDownloads();
}, 1000);
}
} | AST#method_declaration#Left startDownloadUpdateTimer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#exp... | startDownloadUpdateTimer() {
if (this.downloadUpdateTimer === -1) {
this.downloadUpdateTimer = setInterval(() => {
this.loadDownloads();
}, 1000);
}
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/pages/MainPage.ets#L136-L142 | dc6660366c3bf22f4937f6603481df3fc5829861 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/settings/LanguageSettingsPage.ets | arkts | buildHeader | 构建头部 | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width('24vp')
.height('24vp')
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element... | @Builder
buildHeader() {
Row() {
Button() {
Image($r('app.media.ic_back'))
.width('24vp')
.height('24vp')
.fillColor($r('app.color.text_primary'))
}
.type(ButtonType.Normal)
.backgroundColor(Color.Transparent)
.onClick(() => {
router.back... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/settings/LanguageSettingsPage.ets#L55-L91 | 9db9176df4447c36c53064819ba960eb7c887147 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | 完整农历系统设计.ets | arkts | runSystemTests | 🧪 系统完整性测试 | public static runSystemTests(): void {
console.log("=== 🧪 全新农历系统完整性测试 ===");
// 测试数据完整性
const supportedYears = AuthorityLunarDatabase.getSupportedYears();
console.log(`\n📊 支持年份: ${supportedYears.join(', ')}`);
// 验证每年数据配置
supportedYears.forEach(year => {
const config = Authorit... | AST#method_declaration#Left public static runSystemTests 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#expression_statement#Left AST#expression#Left AST#call_ex... | public static runSystemTests(): void {
console.log("=== 🧪 全新农历系统完整性测试 ===");
const supportedYears = AuthorityLunarDatabase.getSupportedYears();
console.log(`\n📊 支持年份: ${supportedYears.join(', ')}`);
supportedYears.forEach(year => {
const config = AuthorityLunarDatabase.getYea... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/完整农历系统设计.ets#L447-L484 | 98ad48d83a11274d120ec4b296b9a0916e62ffaa | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildHeader | 构建现代化头部
参考设计规范的头部导航样式 | @Builder
buildHeader() {
Row() {
// 应用标题
Text('🎂 生日提醒助手')
.fontSize(this.getFontSize(20))
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
// 头部操作按钮
Row({ space: 12 }) {
// 搜索按钮
Button() {
Text('🔍... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildHeader AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { // 应用标题 AST#arkts_ui... | @Builder
buildHeader() {
Row() {
Text('🎂 生日提醒助手')
.fontSize(this.getFontSize(20))
.fontWeight(FontWeight.Bold)
.fontColor(this.COLORS.textPrimary)
.layoutWeight(1)
Row({ space: 12 }) {
Button() {
Text('🔍')
.fontSiz... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L1197-L1262 | 827c9ade35ae3386786561fe1df61c8b435b2f6c | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Native/DecodeHEIFImage/decodeheifimage/src/main/ets/model/WaterFlowData.ets | arkts | 图片信息类 | export class ImageInfo {
public data: image.PixelMap | null = null;
public width: number = 0;
public height: number = 0;
public description: string | undefined = undefined;
constructor(data: image.PixelMap | null, width: number, height: number, description?: string) {
this.data = data;
this.width = w... | AST#export_declaration#Left export AST#class_declaration#Left class ImageInfo AST#class_body#Left { AST#property_declaration#Left public data : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#L... | export class ImageInfo {
public data: image.PixelMap | null = null;
public width: number = 0;
public height: number = 0;
public description: string | undefined = undefined;
constructor(data: image.PixelMap | null, width: number, height: number, description?: string) {
this.data = data;
this.width = w... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Native/DecodeHEIFImage/decodeheifimage/src/main/ets/model/WaterFlowData.ets#L21-L33 | 53e09c111dafd7281176967bf0e435c73d8651ef | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets | arkts | totalCount | 数据源的数据总量 | public totalCount(): number {
return this.dataArray.length;
} | AST#method_declaration#Left public totalCount AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expres... | public totalCount(): number {
return this.dataArray.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/miniplayeranimation/src/main/ets/model/HomePage.ets#L57-L59 | 3df2f379497da69038ade60c80377f5fd22fc00e | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/RSA.ets | arkts | signSync | 对数据进行签名,同步
@param dataBlob 待签名数据
@param priKey 私钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、等)。
@returns | static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256'): cryptoFramework.DataBlob {
return CryptoUtil.signSync(dataBlob, priKey, algName);
} | AST#method_declaration#Left static signSync AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey ... | static signSync(dataBlob: cryptoFramework.DataBlob, priKey: cryptoFramework.PriKey, algName: string = 'RSA1024|PKCS1|SHA256'): cryptoFramework.DataBlob {
return CryptoUtil.signSync(dataBlob, priKey, algName);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/RSA.ets#L249-L251 | dab04e8fff942a64a3b9b0236fe710c73db9b0e7 | gitee |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | hideNavBar | 标记Navigation是否是hideNavBar模式
@param hide true: Navigation根视图将会隐藏 | public static hideNavBar(hide: boolean, atBottomBackCallback: OnAtBottomBackCallback | null = null) {
ZRouter.getRouterMgr().hideNavbar = hide
if (atBottomBackCallback) {
ZRouter.getRouterMgr().onBackAtBottom = atBottomBackCallback
}
} | AST#method_declaration#Left public static hideNavBar AST#parameter_list#Left ( AST#parameter#Left hide : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left atBottomBackCallback : AST#type_annotation#Left AST#union_type#Left AS... | public static hideNavBar(hide: boolean, atBottomBackCallback: OnAtBottomBackCallback | null = null) {
ZRouter.getRouterMgr().hideNavbar = hide
if (atBottomBackCallback) {
ZRouter.getRouterMgr().onBackAtBottom = atBottomBackCallback
}
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L366-L372 | ef6d85d18fedd64c8b9f59d1e170f00dbaaef24c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/topCodeModuleOptimize.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export const dataOptimizeOne = 1; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left dataOptimizeOne = AST#expression#Left 1 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const dataOptimizeOne = 1; | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/TopCodeModification/topCodeModuleOptimize.ets#L16-L16 | 07133c97c7d27af4e9f84621a9a450a154df78bb | gitee | |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/types/player.ets | arkts | 用户属性存档 | export interface TAchiveUser {
name: string
attrs: TPersonAttr
items: TAchiveItem[]
mapIndex: number
exp: number
level: number
meditationPoint: number
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TAchiveUser AST#object_type#Left { AST#type_member#Left name : 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 attrs : AST#type_annotation#Left AS... | export interface TAchiveUser {
name: string
attrs: TPersonAttr
items: TAchiveItem[]
mapIndex: number
exp: number
level: number
meditationPoint: number
} | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/types/player.ets#L10-L18 | aa13d13930346e9cfe3baadc899fa83bc1f879aa | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/CommentDetailView.ets | arkts | TabBuilder | 设置tabBar样式的位置、未选中图片、选中图片及文字显示的参数 | @Builder
TabBuilder(text: Resource, index: number) {
Column() {
Text(text)
.fontSize($r('app.integer.layout_size_21'))
.fontColor(this.currentTabIndex === index ? $r('app.color.font_color_blue') : $r('app.color.font_color_datetime'))
.padding({ top: $r('app.integer.layout_size_10'), ... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right TabBuilder AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left index : AST#type_annotation#Left A... | @Builder
TabBuilder(text: Resource, index: number) {
Column() {
Text(text)
.fontSize($r('app.integer.layout_size_21'))
.fontColor(this.currentTabIndex === index ? $r('app.color.font_color_blue') : $r('app.color.font_color_datetime'))
.padding({ top: $r('app.integer.layout_size_10'), ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/Social/GrapeSquare/feature/authorizedControl/src/main/ets/view/CommentDetailView.ets#L208-L221 | b3c6e8fa9e040123ab66bf871a16bc9198af3fc5 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets | arkts | 遍历所有像素,并放到一个数组中
@param pixelMap 图片的PixelMap对象
@returns 包含图片所有像素的数组 | export async function traverseAllPixel(pixelMap: image.PixelMap): Promise<number[]> {
// PixelMap对象使用BGRA_8888格式,由4个字节表示一个像素,并且宽和高都设置为40,所以此处ArrayBuffer的length就是40*40*4
const pixelArrayBuffer: ArrayBuffer = new ArrayBuffer(40 * 40 * 4);
// 将PixelMap对象读入ArrayBuffer中
await pixelMap.readPixelsToBuffer(pixelArrayBu... | AST#export_declaration#Left export AST#function_declaration#Left async function traverseAllPixel AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left image . PixelMap AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#p... | export async function traverseAllPixel(pixelMap: image.PixelMap): Promise<number[]> {
const pixelArrayBuffer: ArrayBuffer = new ArrayBuffer(40 * 40 * 4);
await pixelMap.readPixelsToBuffer(pixelArrayBuffer);
const allPixels: number[] = [];
const unit8Pixels: Uint8Array = new Uint8Array(pixelArrayBuffer)... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ImageUtils.ets#L95-L120 | 5fae86f172cf093301b47b4e89b7512e55560d52 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | entry/src/main/ets/pages/crypto/SM2Page.ets | arkts | genConvertKeyPair | 生成非对称密钥 | genConvertKeyPair(){
let pubKeyStr = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEYIZ4YCxXfIKvy3Fzmpl43hk7ojUsZqoZyww1YYtw4bICcaD/KmKy+OO4bMTnbrjbjNfJQaVApDTOW9a+PvazXQ=="; //base64字符串公钥
let priKeyStr = "MDECAQEEIKu8PGHEU4Wxiw6xwb0loj0NVLlR7vGe5jYgan8u+hKboAoGCCqBHM9VAYIt"; //base64字符串私钥
this.keyPair = SM2.getConve... | AST#method_declaration#Left genConvertKeyPair AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left pubKeyStr = AST#expression#Left "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEYIZ4YCxXfIKvy3Fzmpl43hk7ojUsZqoZyww1YYtw4bI... | genConvertKeyPair(){
let pubKeyStr = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEYIZ4YCxXfIKvy3Fzmpl43hk7ojUsZqoZyww1YYtw4bICcaD/KmKy+OO4bMTnbrjbjNfJQaVApDTOW9a+PvazXQ==";
let priKeyStr = "MDECAQEEIKu8PGHEU4Wxiw6xwb0loj0NVLlR7vGe5jYgan8u+hKboAoGCCqBHM9VAYIt";
this.keyPair = SM2.getConvertKeyPairSync(pubKeyStr, p... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/entry/src/main/ets/pages/crypto/SM2Page.ets#L33-L37 | 27fd8d748fc38ec16db426047864d0c045f8e751 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | eftool/src/main/ets/device/PrefUtil.ets | arkts | getDefDataAll | 获取首选项 默认Store里的所有数据 | static getDefDataAll(): string[] {
console.info('PrefUtil delValue start')
const defStore = PrefUtil.getStore()
return defStore?.getAllSync() as string[]
} | AST#method_declaration#Left static getDefDataAll AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#expression_stateme... | static getDefDataAll(): string[] {
console.info('PrefUtil delValue start')
const defStore = PrefUtil.getStore()
return defStore?.getAllSync() as string[]
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/eftool/src/main/ets/device/PrefUtil.ets#L109-L113 | 3d19fb46a565947f8bcb31ce1d484bb42641feb9 | gitee |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/SettingsService.ets | arkts | getSettings | 获取当前设置 | getSettings(): AppSettings {
return this.settings;
} | AST#method_declaration#Left getSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AppSettings AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_express... | getSettings(): AppSettings {
return this.settings;
} | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/SettingsService.ets#L111-L113 | cbb619c2b425d6d66512d830852b1df2a8471d6a | github |
fengcreate/harmony-document | 798534b0f76399dc84e7940f5b14b3ae4e53c6a9 | BackupRestore/entry/src/main/ets/restore/fileMigrate/FileTransferManager.ets | arkts | transfer | Move HarmonyOS 4.0 files to the designated location of HarmonyOS NEXT.
@param context context. | transfer(context: common.Context): void {
if (this.moveFiles(context)) {
hilog.info(0x0000, 'BackupRestore FileTransferManager', 'transfer success');
return;
}
hilog.error(0x0000, 'BackupRestore FileTransferManager', 'transfer fail');
} | AST#method_declaration#Left transfer AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | transfer(context: common.Context): void {
if (this.moveFiles(context)) {
hilog.info(0x0000, 'BackupRestore FileTransferManager', 'transfer success');
return;
}
hilog.error(0x0000, 'BackupRestore FileTransferManager', 'transfer fail');
} | https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/fileMigrate/FileTransferManager.ets#L29-L35 | dc55097b4afa0b82af9f6fb4f49ac54e059dbf20 | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/SubscriptionManager.ets | arkts | setSubscriptionEnabled | 启用/禁用订阅 | setSubscriptionEnabled(id: string, enabled: boolean): boolean {
const subscription = this.subscriptions.get(id)
if (subscription) {
subscription.enabled = enabled
this.saveSubscriptions()
console.info(`✅ ${enabled ? '启用' : '禁用'}订阅:`, id)
return true
}
return false
} | AST#method_declaration#Left setSubscriptionEnabled 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 enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primar... | setSubscriptionEnabled(id: string, enabled: boolean): boolean {
const subscription = this.subscriptions.get(id)
if (subscription) {
subscription.enabled = enabled
this.saveSubscriptions()
console.info(`✅ ${enabled ? '启用' : '禁用'}订阅:`, id)
return true
}
return false
} | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/SubscriptionManager.ets#L90-L99 | 748a949cc38ce7a5e17ebc4f1d08e394c1f0c785 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/ElectronicAlbum/entry/src/main/ets/common/constants/Constants.ets | arkts | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License,Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | export default class Constants {
/**
* banner list
*/
static readonly BANNER_IMG_LIST: Array<Resource> = [
$r('app.media.ic_scene_1'),
$r('app.media.ic_food_0'),
$r('app.media.ic_life_0'),
$r('app.media.ic_men_0')
];
/**
* scene list
*/
static readonly SCENE_LIST: Array<Resource>... | AST#export_declaration#Left export default AST#class_declaration#Left class Constants AST#class_body#Left { /**
* banner list
*/ AST#property_declaration#Left static readonly BANNER_IMG_LIST : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#... | export default class Constants {
static readonly BANNER_IMG_LIST: Array<Resource> = [
$r('app.media.ic_scene_1'),
$r('app.media.ic_food_0'),
$r('app.media.ic_life_0'),
$r('app.media.ic_men_0')
];
static readonly SCENE_LIST: Array<Resource> = [
$r('app.media.ic_scene_1'),
$r('app.me... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/ElectronicAlbum/entry/src/main/ets/common/constants/Constants.ets#L16-L206 | 423335aae77d090c32a96a1b6d3ee17d94a26e6d | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/PasteboardUtil.ets | arkts | setDataSync | 将数据写入系统剪贴板。
@param mimeType 剪贴板数据对应的MIME类型,可以是常量中已定义的类型,包括HTML类型,WANT类型,纯文本类型,URI类型,PIXELMAP类型;也可以是自定义的MIME类型。
@param value 自定义数据内容。
@returns | static setDataSync(mimeType: string, value: pasteboard.ValueType) {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setDataSync(pasteData);
} | AST#method_declaration#Left static setDataSync AST#parameter_list#Left ( AST#parameter#Left mimeType : 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 AST#qualified_type... | static setDataSync(mimeType: string, value: pasteboard.ValueType) {
const pasteData: pasteboard.PasteData = pasteboard.createData(mimeType, value);
PasteboardUtil.getSystemPasteboard().setDataSync(pasteData);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/PasteboardUtil.ets#L82-L85 | a372864e8168a650501753b2c12b39038c01ee0b | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/constants/AppConstants.ets | arkts | 正则表达式常量 | export class RegexConstants {
// 手机号验证
static readonly PHONE_REGEX = /^1[3-9]\d{9}$/;
// 邮箱验证
static readonly EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
// 中文姓名验证
static readonly CHINESE_NAME_REGEX = /^[\u4e00-\u9fa5]{2,10}$/;
// 英文姓名验证
static readonly ENGLISH_NAME_REGEX = /^[a-zA-Z\s]{1,50}$/... | AST#export_declaration#Left export AST#class_declaration#Left class RegexConstants AST#class_body#Left { // 手机号验证 AST#property_declaration#Left static readonly PHONE_REGEX AST#ERROR#Left = AST#ERROR#Left / ^ AST#expression#Left AST#subscript_expression#Left AST#expression#Left 1 AST#expression#Right [ AST#expression#Le... | export class RegexConstants {
static readonly PHONE_REGEX = /^1[3-9]\d{9}$/;
static readonly EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
static readonly CHINESE_NAME_REGEX = /^[\u4e00-\u9fa5]{2,10}$/;
static readonly ENGLISH_NAME_REGEX = /^[a-zA-Z\s]{1,50}$/;
static readonly MIXED_N... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/constants/AppConstants.ets#L372-L399 | a4a05c426d1e47e6423d3eee5766198724388e7f | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/FeatureComponent.ets | arkts | CubeRotateAnimationPage | 仅用于项目调试,单独使用可删除代码内容 | @AppRouter({ name: 'cuberotateanimation/CubeRotateAnimationPage' })
@Component
export struct CubeRotateAnimationPage {
build() {
CubeRotateAnimationSamplePage()
.height($r('app.string.cube_animation_full_size'))
.width($r('app.string.cube_animation_full_size'))
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ AppRouter ( AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left name AST#property_name#Right : AST#expression#Left 'cuberotateanimation/CubeRotateAnimationPage' AST#expression#Right AST#property_assignment#Right } A... | @AppRouter({ name: 'cuberotateanimation/CubeRotateAnimationPage' })
@Component
export struct CubeRotateAnimationPage {
build() {
CubeRotateAnimationSamplePage()
.height($r('app.string.cube_animation_full_size'))
.width($r('app.string.cube_animation_full_size'))
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/cuberotateanimation/src/main/ets/FeatureComponent.ets#L21-L29 | 0b897ecc43530738f06e766dec8aaf4a45e0281d | gitee |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | getAuthHeader | 获取认证头 | static getAuthHeader(): AuthHeader | Record<string, never> {
return authToken ? { Authorization: `Bearer ${authToken}` } : {};
} | AST#method_declaration#Left static getAuthHeader AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AuthHeader AST#primary_type#Right | AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary... | static getAuthHeader(): AuthHeader | Record<string, never> {
return authToken ? { Authorization: `Bearer ${authToken}` } : {};
} | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L248-L250 | 439c4cff27edbf2f947ffbea7927ace9d4cb0ee9 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/BirthdayWidget.ets | arkts | onVisibilityChange | 卡片可见性变化 | onVisibilityChange(newStatus: Record<string, number>): void {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayWidget onVisibilityChange');
for (const formId in newStatus) {
const isVisible = newStatus[formId] === formInfo.VisibilityType.FORM_VISIBLE;
this.... | AST#method_declaration#Left onVisibilityChange AST#parameter_list#Left ( AST#parameter#Left newStatus : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , AST#type_... | onVisibilityChange(newStatus: Record<string, number>): void {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayWidget onVisibilityChange');
for (const formId in newStatus) {
const isVisible = newStatus[formId] === formInfo.VisibilityType.FORM_VISIBLE;
this.... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/BirthdayWidget.ets#L74-L85 | e1a1ea248b4bacaee7399d6b67cc31bbb5f95322 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/PickerUtil.ets | arkts | selectPhoto | 通过选择模式拉起photoPicker界面,用户可以选择一个或多个图片/视频。
@param options
@returns | static async selectPhoto(options?: photoAccessHelper.PhotoSelectOptions): Promise<Array<string>> {
try {
if (!options) {
options = new photoAccessHelper.PhotoSelectOptions();
}
//可选择的媒体文件类型,若无此参数,则默认为图片和视频类型。
if (!options.MIMEType) {
options.MIMEType = photoAccessHelper.Phot... | AST#method_declaration#Left static async selectPhoto AST#parameter_list#Left ( AST#parameter#Left options ? : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left photoAccessHelper . PhotoSelectOptions AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#... | static async selectPhoto(options?: photoAccessHelper.PhotoSelectOptions): Promise<Array<string>> {
try {
if (!options) {
options = new photoAccessHelper.PhotoSelectOptions();
}
if (!options.MIMEType) {
options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE;
... | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/OfficeAttendance-master/commons/common_lib/src/main/ets/utils/PickerUtil.ets#L18-L56 | e99373abe25dd242215b858f6a7a9cfc0cdc980d | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookDetailPage.ets | arkts | titleImageStyle | 标题图片样式 | @Extend(Image)
function titleImageStyle() {
.fillColor(Color.White)
.width(CommonConstants.TITLE_IMG_SIZE)
.height(CommonConstants.TITLE_IMG_SIZE)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Extend ( AST#expression#Left Image AST#expression#Right ) AST#decorator#Right function titleImageStyle AST#parameter_list#Left ( ) AST#parameter_list#Right AST#extend_function_body#Left { AST#modifier_chain_expression#Left . fillColor ( AST#expression#Left AS... | @Extend(Image)
function titleImageStyle() {
.fillColor(Color.White)
.width(CommonConstants.TITLE_IMG_SIZE)
.height(CommonConstants.TITLE_IMG_SIZE)
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/BookDetailPage.ets#L19-L24 | f884d82be6928e203ca789f88dfd592fbf24bf29 | github |
iotjin/JhHarmonyDemo.git | 819e6c3b1db9984c042a181967784550e171b2e8 | JhCommon/src/main/ets/JhCommon/components/JhPickerTool.ets | arkts | isOneStringArray | 是否是一维字符串数组
@param arr
@returns | public static isOneStringArray(arr: ESObject[]) {
return Array.isArray(arr) && arr.every((item: ESObject) => typeof item === 'string')
} | AST#method_declaration#Left public static isOneStringArray AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left ESObject [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_sta... | public static isOneStringArray(arr: ESObject[]) {
return Array.isArray(arr) && arr.every((item: ESObject) => typeof item === 'string')
} | https://github.com/iotjin/JhHarmonyDemo.git/blob/819e6c3b1db9984c042a181967784550e171b2e8/JhCommon/src/main/ets/JhCommon/components/JhPickerTool.ets#L242-L244 | 0fdfaa351182982367e350e99d8ebe158268744d | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/view/PrivacyPolicyPage.ets | arkts | PrivacyPolicyPage | @file 隐私政策页面视图
@author Joker.X | @ComponentV2
export struct PrivacyPolicyPage {
/**
* 隐私政策页面 ViewModel
*/
@Local
private vm: PrivacyPolicyViewModel = new PrivacyPolicyViewModel();
/**
* 构建隐私政策页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: "隐私政策",
viewModel: this.vm
}) {
this.Privac... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct PrivacyPolicyPage AST#component_body#Left { /**
* 隐私政策页面 ViewModel
*/ AST#property_declaration#Left AST#decorator#Left @ Local AST#decorator#Right private vm : AST#type_annotation#Left AST#primary_type#Left Pr... | @ComponentV2
export struct PrivacyPolicyPage {
@Local
private vm: PrivacyPolicyViewModel = new PrivacyPolicyViewModel();
build() {
AppNavDestination({
title: "隐私政策",
viewModel: this.vm
}) {
this.PrivacyPolicyContent();
}
}
@Builder
private PrivacyPolicyContent() {
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/view/PrivacyPolicyPage.ets#L8-L37 | adae9578192f370479fb1f2a883862bf299b2eb0 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/WebComponent/entry/src/main/ets/common/Constant.ets | arkts | The host address of the server. | export const CLOUD_PATH: string = 'http://xxx.xxx.xxx.xxx:9588/index.html'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left CLOUD_PATH : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'http://xxx.xxx.xxx.xxx:9588/index.html' AST#expression#Right AST#variable_declara... | export const CLOUD_PATH: string = 'http://xxx.xxx.xxx.xxx:9588/index.html'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/WebComponent/entry/src/main/ets/common/Constant.ets#L23-L23 | 4e4b6b60b8da598aacf647b383017c6a7be7ba0b | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/dialogv2/source/dialogv2.ets | arkts | getAccessibilityText | 获取SelectDialog无障碍文本
@param resource 资源
@param selected select state
@returns string | function getAccessibilityText(resource: ResourceStr, selected: boolean): string {
try {
let selectText: string = getContext().resourceManager.getStringSync(125833934);
let resourceString: string = '';
if (typeof resource === 'string') {
resourceString = resource;
} else {
resourceString = ... | AST#function_declaration#Left function getAccessibilityText AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left selected : AST#type_annotation#Left AST#primary_type#Le... | function getAccessibilityText(resource: ResourceStr, selected: boolean): string {
try {
let selectText: string = getContext().resourceManager.getStringSync(125833934);
let resourceString: string = '';
if (typeof resource === 'string') {
resourceString = resource;
} else {
resourceString = ... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/dialogv2/source/dialogv2.ets#L1663-L1679 | 340d6e79d6013ebfaf55a2936c4947115e4f809e | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/MainViewModel.ets | arkts | handleTabChanged | 切换 Tab 时更新索引并处理动画
@param {number} index - 选中的索引
@returns {void} 无返回值 | handleTabChanged(index: number): void {
this.updateCurrentPage(index);
this.playSelectedAnimation(index);
} | AST#method_declaration#Left handleTabChanged AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#R... | handleTabChanged(index: number): void {
this.updateCurrentPage(index);
this.playSelectedAnimation(index);
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/MainViewModel.ets#L59-L62 | 8cb1061f8f22570d7bd621be445d19ccec814170 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/WantAgentUtil.ets | arkts | createWantAgentForCommonEvent | create wantAgent for common event
@param mAction
@return return the created WantAgent object. | async createWantAgentForCommonEvent(action: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [{ action: action }],
actionType: wantAgent.OperationType.SEND_COMMON_EVENT,
requestCode: REQUEST_CODE // requestCode是WantAgentInfo的请求码,是使用者定义的一个私有值
}
return await wantAgent.getWantA... | AST#method_declaration#Left async createWantAgentForCommonEvent AST#parameter_list#Left ( AST#parameter#Left action : 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#va... | async createWantAgentForCommonEvent(action: string) {
let wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [{ action: action }],
actionType: wantAgent.OperationType.SEND_COMMON_EVENT,
requestCode: REQUEST_CODE
}
return await wantAgent.getWantAgent(wantAgentInfo);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_NetManager/VPNControl_Case/entry/src/main/ets/notification/WantAgentUtil.ets#L47-L54 | c70311c8cd294d7ee1ee393dd09649bfd3104993 | gitee |
xsdkhlgz/ATSOBJECT_OF_FIRST.git | 8c14e875d7ec3f418bb7cdaae123a8fea87a7e76 | entry/src/main/ets/viewmodel/ItemCategory.ets | arkts | 记录项类型 | export default class ItemCategory{
//类型id
id:number
//类型名称
name:ResourceStr
constructor | AST#export_declaration#Left export AST#ERROR#Left default class ItemCategory { //类型id id : number //类型名称 name : ResourceStr AST#ERROR#Right AST#variable_declaration#Left const AST#variable_declarator#Left ructor AST#variable_declarator#Right AST#variable_declaration#Right AST#export_declaration#Right | export default class ItemCategory{
id:number
name:ResourceStr
constructor | https://github.com/xsdkhlgz/ATSOBJECT_OF_FIRST.git/blob/8c14e875d7ec3f418bb7cdaae123a8fea87a7e76/entry/src/main/ets/viewmodel/ItemCategory.ets#L4-L10 | c169ec779eef097c1ae0bac439bc6babd4e4dbd5 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/network/HttpClient.ets | arkts | setBaseUrl | 设置基础URL | setBaseUrl(url: string): void {
this.baseUrl = url;
} | AST#method_declaration#Left setBaseUrl 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#Left AST#primary_type#Left void AST#primary_type#Right AST... | setBaseUrl(url: string): void {
this.baseUrl = url;
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/network/HttpClient.ets#L67-L69 | 231233284a512d0d124a82bcd210afe427a3db1d | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets | arkts | query | Querying the database based on predicate.
@param predicates Query condition.
@returns resultList Query result set. | async query(predicates: dataRdb.RdbPredicates): Promise<dataRdb.ResultSet>{
let resultList: null | dataRdb.ResultSet = null;
try {
resultList = await (this.rdbStore as dataRdb.RdbStore).query(predicates, this.columns);
} catch (err) {
Logger.error(`query data failed due to ${JSON.stringify(err)}... | AST#method_declaration#Left async query AST#parameter_list#Left ( AST#parameter#Left predicates : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left dataRdb . RdbPredicates AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#... | async query(predicates: dataRdb.RdbPredicates): Promise<dataRdb.ResultSet>{
let resultList: null | dataRdb.ResultSet = null;
try {
resultList = await (this.rdbStore as dataRdb.RdbStore).query(predicates, this.columns);
} catch (err) {
Logger.error(`query data failed due to ${JSON.stringify(err)}... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Security/StringCipherArkTS/entry/src/main/ets/model/RdbModel.ets#L66-L74 | 44dc7f0f5f2aa4c958271575a3884b1e13491945 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/utils/OpacityUtil.ets | arkts | Opacity adjust.
@param pixelMap.
@param value.
@return pixelMap. | export async function adjustOpacity(pixelMap: PixelMap, value: number) {
if (!pixelMap) {
return;
}
const newPixelMap = pixelMap;
await newPixelMap.opacity(value / CommonConstants.SLIDER_MAX);
return newPixelMap;
} | AST#export_declaration#Left export AST#function_declaration#Left async function adjustOpacity AST#parameter_list#Left ( AST#parameter#Left pixelMap : AST#type_annotation#Left AST#primary_type#Left PixelMap AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotat... | export async function adjustOpacity(pixelMap: PixelMap, value: number) {
if (!pixelMap) {
return;
}
const newPixelMap = pixelMap;
await newPixelMap.opacity(value / CommonConstants.SLIDER_MAX);
return newPixelMap;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/utils/OpacityUtil.ets#L28-L35 | abbb814fab2a991913e9c4f294aebfc1908e8284 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | initializePage | 初始化页面数据 | private async initializePage(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'TestSimple initializePage - starting');
console.log('[TestSimple] Starting page initialization');
// 设置通知服务的上下文用于权限检查
const context = getContext(this) as common.UIAbilityContext;... | AST#method_declaration#Left private async initializePage 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 > AS... | private async initializePage(): Promise<void> {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'TestSimple initializePage - starting');
console.log('[TestSimple] Starting page initialization');
const context = getContext(this) as common.UIAbilityContext;
this.notific... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L690-L757 | 60446d3406f1ee141135b5da19a7f4cda58d0ac7 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/models/ContactModel.ets | arkts | updateIntimacyLevel | 更新亲密度 | updateIntimacyLevel(level: number): Contact {
if (level >= 1 && level <= 5) {
this.contact.intimacyLevel = level;
this.contact.updatedAt = new Date().toISOString();
}
return this.getContact();
} | AST#method_declaration#Left updateIntimacyLevel AST#parameter_list#Left ( AST#parameter#Left level : 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 Contact AST#primary_... | updateIntimacyLevel(level: number): Contact {
if (level >= 1 && level <= 5) {
this.contact.intimacyLevel = level;
this.contact.updatedAt = new Date().toISOString();
}
return this.getContact();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/models/ContactModel.ets#L259-L265 | 28d6fdb68d8e69f7cad5ec7d4b27784d589beb5c | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/state/src/main/ets/WindowSafeAreaState.ets | arkts | updateSafeAreaByInsets | 更新安全区数据(结构体方式)
@param {SafeAreaInsets} insets - 安全区数据
@returns {void} 无返回值
@example
state.updateSafeAreaByInsets({ top: 24, left: 0, bottom: 32, right: 0 }); | updateSafeAreaByInsets(insets: SafeAreaInsets): void {
this.updateSafeArea(insets.top, insets.left, insets.bottom, insets.right);
} | AST#method_declaration#Left updateSafeAreaByInsets AST#parameter_list#Left ( AST#parameter#Left insets : AST#type_annotation#Left AST#primary_type#Left SafeAreaInsets 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... | updateSafeAreaByInsets(insets: SafeAreaInsets): void {
this.updateSafeArea(insets.top, insets.left, insets.bottom, insets.right);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/state/src/main/ets/WindowSafeAreaState.ets#L64-L66 | 6cdf0a9a42ea19d4edf366492adf9b6c518e2a0e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/i18n/I18nManager.ets | arkts | loadConfig | 加载配置 | private async loadConfig(): Promise<void> {
try {
if (!this.preferences) return;
const language = await this.preferences.get(StorageKeys.I18N_LANGUAGE, this.config.language) as SupportedLanguage;
const fallbackLanguage = await this.preferences.get(StorageKeys.I18N_FALLBACK_LANGUAGE, this.config.f... | AST#method_declaration#Left private async loadConfig 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#ty... | private async loadConfig(): Promise<void> {
try {
if (!this.preferences) return;
const language = await this.preferences.get(StorageKeys.I18N_LANGUAGE, this.config.language) as SupportedLanguage;
const fallbackLanguage = await this.preferences.get(StorageKeys.I18N_FALLBACK_LANGUAGE, this.config.f... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/i18n/I18nManager.ets#L720-L741 | 7d43f8a1ed2e2caed79b02841a56d70f7ae809a3 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/CryptoUtil.ets | arkts | verify | 对数据进行验签,异步
@param dataBlob 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、等)。
@returns | static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let res = await verifier.verify(dataBlob, signDataBlob);... | AST#method_declaration#Left static async verify AST#parameter_list#Left ( AST#parameter#Left dataBlob : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left cryptoFramework . DataBlob AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sig... | static async verify(dataBlob: cryptoFramework.DataBlob, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string): Promise<boolean> {
let verifier = cryptoFramework.createVerify(algName);
await verifier.init(pubKey);
let res = await verifier.verify(dataBlob, signDataBlob);... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/CryptoUtil.ets#L320-L326 | 41b5240238aea3c4b196d13a65b61d2102ac7973 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/common/src/main/ets/navigation/SettingsNav.ets | arkts | SettingsNav | @file 设置页面导航入口
@returns {void} 无返回值
@author Joker.X | @Builder
export function SettingsNav(): void {
SettingsPage();
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function SettingsNav AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#ui_custom_co... | @Builder
export function SettingsNav(): void {
SettingsPage();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/common/src/main/ets/navigation/SettingsNav.ets#L8-L11 | b473f6e022e48c60187cf79f730d72dca069909c | github |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/blocks/modules/meowWebView.ets | arkts | request_permission | Operations | request_permission(event: OnPermissionRequestEvent) {
this.onPermit = () => {
event.request.grant(event.request.getAccessibleResource());
}
this.onDeny = () => {
event.request.deny();
}
this.ask_resources = event.request.getAccessibleResource();
this.source = event.request.getOrigin(... | AST#method_declaration#Left request_permission AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left OnPermissionRequestEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_stat... | request_permission(event: OnPermissionRequestEvent) {
this.onPermit = () => {
event.request.grant(event.request.getAccessibleResource());
}
this.onDeny = () => {
event.request.deny();
}
this.ask_resources = event.request.getAccessibleResource();
this.source = event.request.getOrigin(... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/blocks/modules/meowWebView.ets#L675-L701 | 80b7024a4977e930369cf976b924e8b8ed6df03d | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets | arkts | ScreenAdaptContent | 屏幕适配示例页内容视图
@returns {void} 无返回值 | @Builder
private ScreenAdaptContent(): void {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
this.SectionTitle($r("app.string.demo_screen_adapt_breakpoint_title"));
SpaceVerticalSmall();
this.BreakpointCard();
SpaceVerticalLarge();
this.SectionTi... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right private ScreenAdaptContent AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left A... | @Builder
private ScreenAdaptContent(): void {
MediumPaddingVerticalScroll() {
ColumnBase({ widthValue: P100 }) {
this.SectionTitle($r("app.string.demo_screen_adapt_breakpoint_title"));
SpaceVerticalSmall();
this.BreakpointCard();
SpaceVerticalLarge();
this.SectionTi... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/demo/src/main/ets/view/ScreenAdaptDemoPage.ets#L55-L88 | e412af865be12899bf83b6d9d292812507d4832a | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/SoundEffect/SEManager.ets | arkts | setupEventListeners | 设置事件监听器 | private setupEventListeners(): void {
if (!this.soundPool) return;
// 监听资源加载完成
this.soundPool.on('loadComplete', (soundId: number) => {
console.info('loadComplete, soundId: ' + soundId);
});
// 监听播放完成(带streamId信息)
// this.soundPool.on('playFinishedWithStreamId', (streamId: number) => {
... | AST#method_declaration#Left private setupEventListeners 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#if_statement#Left if ( AST#expression#Left AST#member_expr... | private setupEventListeners(): void {
if (!this.soundPool) return;
this.soundPool.on('loadComplete', (soundId: number) => {
console.info('loadComplete, soundId: ' + soundId);
});
this.soundPool.on('error', (error: BusinessError) => {
console.error('error happ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/SoundEffect/SEManager.ets#L82-L99 | 1d3da8dc8f2f3f6f4bffb5187f9daa9e018871d6 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_offset_nowear/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets | arkts | ListItemGroupView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ListItemGroupView {
@Link _offset: Position;
private componentKey: string = '';
private parentWidth: number = 0;
private parentHeight: number = 0;
private subassemblyWidth: number = 0;
private subassemblyHeight: number = 0;
private parentComponentKey: string = '';
private refere... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ListItemGroupView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right _offset : AST#type_annotation#Left AST#primary_type#Left Position AST#primary_type#Right AST#type... | @Component
export struct ListItemGroupView {
@Link _offset: Position;
private componentKey: string = '';
private parentWidth: number = 0;
private parentHeight: number = 0;
private subassemblyWidth: number = 0;
private subassemblyHeight: number = 0;
private parentComponentKey: string = '';
private refere... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_offset_nowear/entry/src/main/ets/MainAbility/view/offset/ListItemGroupView.ets#L16-L88 | fd998afaaaf7606e7bd0195dfb68590cdf30a442 | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.