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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | toLower | 转换整个字符串的字符为小写
@param str 要转换的字符串
@returns 返回小写的字符串 | static toLower(str: string = ''): string {
return str.toLowerCase();
} | AST#method_declaration#Left static toLower AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST... | static toLower(str: string = ''): string {
return str.toLowerCase();
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L214-L216 | ee94327ee33ef10f7bf2831076d444acd3bdc848 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/DateUtils.ets | arkts | addDays | 添加天数到日期
@param date 原始日期
@param days 要添加的天数
@returns 新的日期 | static addDays(date: string | Date, days: number): Date {
const result = typeof date === 'string' ? new Date(date) : new Date(date);
result.setDate(result.getDate() + days);
return result;
} | AST#method_declaration#Left static addDays AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#par... | static addDays(date: string | Date, days: number): Date {
const result = typeof date === 'string' ? new Date(date) : new Date(date);
result.setDate(result.getDate() + days);
return result;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L352-L356 | 8c768ac0e3b4322246290b428ccdc36cd133cc67 | github |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkcompiler/esmodule/esmodule_dynamicimport/entry/src/main/ets/Calc.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 function add(a:number, b:number): number {
return a + b;
} | AST#export_declaration#Left export AST#function_declaration#Left function add AST#parameter_list#Left ( AST#parameter#Left a : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left b : AST#type_annotation#Left AST#primary_type#Lef... | export function add(a:number, b:number): number {
return a + b;
} | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkcompiler/esmodule/esmodule_dynamicimport/entry/src/main/ets/Calc.ets#L16-L18 | 569e77e7f3fdb1e8359f0680ad4cd26e4b620a76 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | AppColdStart/library/IndexOthers.ets | arkts | SubPage | [Start export_sub_page] library/IndexOthers.ets | export { SubPage } from './src/main/ets/components/mainpage/SubPage'; | AST#export_declaration#Left export { SubPage } from './src/main/ets/components/mainpage/SubPage' ; AST#export_declaration#Right | export { SubPage } from './src/main/ets/components/mainpage/SubPage'; | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/AppColdStart/library/IndexOthers.ets#L3-L3 | b44528aee372ce74719f26a5e1a35cb9b6ee5812 | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | SimpleChatList/entry/src/main/ets/pages/ScrollLeftAndRightToRefresh.ets | arkts | ScrollLeftAndRightToRefresh | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct ScrollLeftAndRightToRefresh {
@State isRefreshing: boolean = false;
@State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@StorageProp('topRectHeight') topRectHeight: number = 0;
build() {
NavDestination() {
// [Start ScrollLeftAndRightToRefresh]
Column() {
Ref... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ScrollLeftAndRightToRefresh AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isRefreshing : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | @Component
export struct ScrollLeftAndRightToRefresh {
@State isRefreshing: boolean = false;
@State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
@StorageProp('topRectHeight') topRectHeight: number = 0;
build() {
NavDestination() {
Column() {
Refresh({ refreshing: $$this.isRefreshing... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/SimpleChatList/entry/src/main/ets/pages/ScrollLeftAndRightToRefresh.ets#L16-L83 | 488d94e20df36f80051aaf548a6ab80a5b81f526 | gitee |
ashcha0/my-arkts.git | 49e433fd286793fb411fe073e37f598340c84bcb | entry/.preview/default/generated/profile/default/BuildProfile.ets | arkts | BuildProfile Class is used only for compatibility purposes. | export default class BuildProfile {
static readonly BUNDLE_NAME = BUNDLE_NAME;
static readonly BUNDLE_TYPE = BUNDLE_TYPE;
static readonly VERSION_CODE = VERSION_CODE;
static readonly VERSION_NAME = VERSION_NAME;
static readonly TARGET_NAME = TARGET_NAME;
static readonly PRODUCT_NAME = PRODUCT_NAME;
static reado... | AST#export_declaration#Left export default AST#class_declaration#Left class BuildProfile AST#class_body#Left { AST#property_declaration#Left static readonly BUNDLE_NAME = AST#expression#Left BUNDLE_NAME AST#expression#Right ; AST#property_declaration#Right AST#property_declaration#Left static readonly BUNDLE_TYPE = AST... | export default class BuildProfile {
static readonly BUNDLE_NAME = BUNDLE_NAME;
static readonly BUNDLE_TYPE = BUNDLE_TYPE;
static readonly VERSION_CODE = VERSION_CODE;
static readonly VERSION_NAME = VERSION_NAME;
static readonly TARGET_NAME = TARGET_NAME;
static readonly PRODUCT_NAME = PRODUCT_NAME;
static reado... | https://github.com/ashcha0/my-arkts.git/blob/49e433fd286793fb411fe073e37f598340c84bcb/entry/.preview/default/generated/profile/default/BuildProfile.ets#L16-L25 | 0c6ce9d615a8c8c50e6f09fb2bbc975917de7ccc | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ReviewUtils.ets | arkts | openReviewPageByAppLink | 通过App Linking方式拉起应用市场写评论页
@param context - UIAbility上下文
@param bundleName - 应用包名 | static openReviewPageByAppLink(context: common.UIAbilityContext, bundleName: string): void {
const appLink: string = `https://appgallery.huawei.com/app/detail?id=${bundleName}&action=write-review`;
context.openLink(appLink, { appLinkingOnly: false })
.then(() => {
hilog.info(0x0000, ReviewUtils.T... | AST#method_declaration#Left static openReviewPageByAppLink AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter... | static openReviewPageByAppLink(context: common.UIAbilityContext, bundleName: string): void {
const appLink: string = `https://appgallery.huawei.com/app/detail?id=${bundleName}&action=write-review`;
context.openLink(appLink, { appLinkingOnly: false })
.then(() => {
hilog.info(0x0000, ReviewUtils.T... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ReviewUtils.ets#L51-L62 | 0608073bbc2cbaf963e2c497f07a6284701764fa | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets | arkts | scrollWeb | MyScroller组件滑动Web | scrollWeb(offset:number) {
this.webviewController.scrollBy(0, offset);
} | AST#method_declaration#Left scrollWeb AST#parameter_list#Left ( AST#parameter#Left offset : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#... | scrollWeb(offset:number) {
this.webviewController.scrollBy(0, offset);
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets#L150-L152 | 277f6eabb96e4eeea8b52715783553ef46daad13 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | TODO 字符串工具类
author: 桃花镇童长老ᥫ᭡
since: 2024/05/01 | export class StrUtil {
/**
* 判断字符串是否为空(undefined、null)
* @param str 被检测的字符串
* @returns 是否为空
*/
static isNull(str: string | number | undefined | null): boolean {
return str === undefined || str === null;
}
/**
* 判断字符串是否为非空。true为非空空,否则false
* @param str
* @returns
*/
static isNotN... | AST#export_declaration#Left export AST#class_declaration#Left class StrUtil AST#class_body#Left { /**
* 判断字符串是否为空(undefined、null)
* @param str 被检测的字符串
* @returns 是否为空
*/ AST#method_declaration#Left static isNull AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left ... | export class StrUtil {
static isNull(str: string | number | undefined | null): boolean {
return str === undefined || str === null;
}
static isNotNull(str: string | number | undefined | null): boolean {
return false === StrUtil.isNull(str);
}
static isEmpty(str: string | undefined | null)... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L27-L383 | cbf0c0de64b48d7d840c16a6c4d1015cd6a95a95 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | CanvasDraw/entry/src/main/ets/view/GlassCoverView.ets | arkts | drawOneCell | Draw a circle based on the specified position and width. | private drawOneCell(canvas: CanvasRenderer, x: number, y: number, width: number): void {
canvas.moveTo(x + width, y);
canvas.arc(x, y, width, 0, Math.PI * 2);
} | AST#method_declaration#Left private drawOneCell AST#parameter_list#Left ( AST#parameter#Left canvas : AST#type_annotation#Left AST#primary_type#Left CanvasRenderer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left x : AST#type_annotation#Left AST#primary_type#Left number AST#prim... | private drawOneCell(canvas: CanvasRenderer, x: number, y: number, width: number): void {
canvas.moveTo(x + width, y);
canvas.arc(x, y, width, 0, Math.PI * 2);
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/CanvasDraw/entry/src/main/ets/view/GlassCoverView.ets#L88-L91 | 0eae69477cce4e2fe55e3dba5898fa0313409e2a | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets | arkts | PickerOrientation. include VERTICAL and HORIZONTAL
@enum { number } PickerOrientation
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare enum PickerOrientation {
/**
* VERTICAL. vertical display
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
VERTICAL = 0,
/**
* HORIZONTAL. horizontal display
*
* @syscap SystemCapability.FileManagem... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum PickerOrientation AST#enum_body#Left { /**
* VERTICAL. vertical display
*
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#enum_membe... | export declare enum PickerOrientation {
VERTICAL = 0,
HORIZONTAL = 1
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.file.PhotoPickerComponent.d.ets#L585-L602 | dcba1f9c56adefd3fd34bbfb1c50addb18d881db | github | |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/common/utils/DataSyncVerifier.ets | arkts | getVerificationSummary | 获取验证总结 | getVerificationSummary(results: string[]): VerificationSummary {
const totalTests = results.filter(line => line.includes('一致性:')).length;
const passedTests = results.filter(line => line.includes('✅')).length;
const failedTests = results.filter(line => line.includes('❌')).length;
const successRate = tota... | AST#method_declaration#Left getVerificationSummary AST#parameter_list#Left ( AST#parameter#Left results : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotati... | getVerificationSummary(results: string[]): VerificationSummary {
const totalTests = results.filter(line => line.includes('一致性:')).length;
const passedTests = results.filter(line => line.includes('✅')).length;
const failedTests = results.filter(line => line.includes('❌')).length;
const successRate = tota... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/common/utils/DataSyncVerifier.ets#L295-L308 | 7e0cca493b24b27f8a23b4a8fdf7d20ecb99acc6 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/GreetingTypes.ets | arkts | 月度统计接口 | export interface MonthlyGreetingStats {
month: string;
generated: number;
sent: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MonthlyGreetingStats AST#object_type#Left { AST#type_member#Left month : 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 generated : AST#type_an... | export interface MonthlyGreetingStats {
month: string;
generated: number;
sent: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/GreetingTypes.ets#L36-L40 | d580a9c6f459bc2a9993777d3a956571b3d50dc3 | github | |
lime-zz/Ark-ui_RubbishRecycleApp.git | c2a9bff8fbb5bc46d922934afad0327cc1696969 | rubbish/rubbish/entry/src/main/ets/pages/pickover.ets | arkts | 取消订单弹窗控制 | build() {
Stack() {
// 地图背景层
Column() {
Image($r('app.media.map')) // 替换为实际地图背景图资源
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
}
.width('100%')
.height('100%')
// 主内容层 - 整体垂直排列
Column() {
// 信息卡片区域
Column(... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Stack ( ) AST#container_content_body#Left { // 地图背景层 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AS... | build() {
Stack() {
Column() {
Image($r('app.media.map'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
}
.width('100%')
.height('100%')
Column() {
Column() {
Row() {
Col... | https://github.com/lime-zz/Ark-ui_RubbishRecycleApp.git/blob/c2a9bff8fbb5bc46d922934afad0327cc1696969/rubbish/rubbish/entry/src/main/ets/pages/pickover.ets#L7-L256 | 18cf5f6d583857cb08ecfa9b10b9dafd4042e967 | github | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/strings/ZFunction.ets | arkts | contains | 检查字符串是否包含模式串
@param text 文本字符串
@param pattern 模式串
@returns 是否包含模式串 | static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const matches = ZFunction.findAllMatches(text, pattern);
return matches.length > 0;
} | AST#method_declaration#Left static contains AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left pattern : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | static contains(text: string, pattern: string): boolean {
if (!text || !pattern || pattern.length === 0) {
return false;
}
const matches = ZFunction.findAllMatches(text, pattern);
return matches.length > 0;
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/strings/ZFunction.ets#L144-L151 | 125129baa0d7b7da0480eafb66274d2077d8c1c5 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/app/views/CircleView.ets | arkts | ======================= GraphPart ======================= | export interface GraphPart {
partName : string
count : number
color : string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface GraphPart AST#object_type#Left { AST#type_member#Left partName : 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 count : AST#type_annotation#Left ... | export interface GraphPart {
partName : string
count : number
color : string
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/app/views/CircleView.ets#L2-L7 | 34af176ca62b99f64d054cabbdaf62b0ba1b75cf | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customstepper/src/main/ets/view/HeaderView.ets | arkts | 当前页面的索引,由索引及titleArray确定当前页面的Title | build() {
Column() {
Row() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {
notImplementPrompt();
})
Text(this.titleArray[this.currentIndex])
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {
notImplementPrompt();
})
Text(this.titleArray[this.currentIndex])
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/src/main/ets/view/HeaderView.ets#L27-L59 | f4981b56e21d1f41433bc07546e8b6fe9d023bb4 | gitee | |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | deleteAccountingItem | 侧滑删除单个记账信息 | public deleteAccountingItem (accountingInfoStr: string) {
let accountingInfo: AccountingInfo = JSON.parse(accountingInfoStr);
this.selectedDayInfo.accountingList = this.selectedDayInfo.accountingList.filter((item: AccountingInfo) => accountingInfo.id !== item.id);
this.selectedDayInfo.dayInfo = this.setSele... | AST#method_declaration#Left public deleteAccountingItem AST#parameter_list#Left ( AST#parameter#Left accountingInfoStr : 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... | public deleteAccountingItem (accountingInfoStr: string) {
let accountingInfo: AccountingInfo = JSON.parse(accountingInfoStr);
this.selectedDayInfo.accountingList = this.selectedDayInfo.accountingList.filter((item: AccountingInfo) => accountingInfo.id !== item.id);
this.selectedDayInfo.dayInfo = this.setSele... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L302-L322 | f752eee53f3b4ec0756d9e48e05599358a41021b | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/PreferencesUtil.ets | arkts | putString | 存储字符串数据
@param context 应用上下文
@param key 键
@param value 值 | static async putString(context: common.UIAbilityContext, key: string, value: string): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Prefer... | AST#method_declaration#Left static async putString AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left ke... | static async putString(context: common.UIAbilityContext, key: string, value: string): Promise<void> {
try {
const dataPreferences = await PreferencesUtil.getPreferences(context);
await dataPreferences.put(key, value);
await dataPreferences.flush();
} catch (error) {
console.error('Prefer... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/PreferencesUtil.ets#L42-L50 | 095cef4524e8f06bf3a7615afc589a075a411646 | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/ScatterDataSet.ets | arkts | setScatterShapeHoleColor | Sets the color for the hole in the shape.
@param holeColor | public setScatterShapeHoleColor(holeColor: number): void {
this.mScatterShapeHoleColor = holeColor;
} | AST#method_declaration#Left public setScatterShapeHoleColor AST#parameter_list#Left ( AST#parameter#Left holeColor : 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... | public setScatterShapeHoleColor(holeColor: number): void {
this.mScatterShapeHoleColor = holeColor;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/ScatterDataSet.ets#L138-L140 | 7046a37529802f500c275f4102736a59ffab7cd3 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets | arkts | getSymbolFontSizeFrom | translate option imageSize to symbol fontSize | getSymbolFontSizeFrom(imageSize?: number | Resource | undefined) : string | Resource {
if (imageSize === undefined) {
return SYMBOL_DEFAULT;
}
if (typeof imageSize === 'number') {
return (imageSize as number).toString() + 'vp';
}
return imageSize as Resource;
} | AST#method_declaration#Left getSymbolFontSizeFrom AST#parameter_list#Left ( AST#parameter#Left imageSize ? : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left Resource AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right A... | getSymbolFontSizeFrom(imageSize?: number | Resource | undefined) : string | Resource {
if (imageSize === undefined) {
return SYMBOL_DEFAULT;
}
if (typeof imageSize === 'number') {
return (imageSize as number).toString() + 'vp';
}
return imageSize as Resource;
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/gridobjectsortcomponent/source/GridObjectSortComponent.ets#L275-L283 | 2abbcacb2df4e93edceb1a90bab8185b1934d300 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/navigation/src/main/ets/NavigationService.ets | arkts | 返回上一页
@returns {void} 无返回值 | export function navigateBack(): void {
const stack: NavPathStack | undefined = getNavPathStack();
if (!stack) {
return;
}
try {
stack.pop();
} catch (err) {
hilog.error(DOMAIN, "NavSvc", "[NavigationService] navigateBack failed: %{public}s", JSON.stringify(err));
}
} | AST#export_declaration#Left export AST#function_declaration#Left function navigateBack AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left c... | export function navigateBack(): void {
const stack: NavPathStack | undefined = getNavPathStack();
if (!stack) {
return;
}
try {
stack.pop();
} catch (err) {
hilog.error(DOMAIN, "NavSvc", "[NavigationService] navigateBack failed: %{public}s", JSON.stringify(err));
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/navigation/src/main/ets/NavigationService.ets#L84-L94 | e69eb365f6312f24faf1f39064e9b6c656af2e69 | github | |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/TaoYao.ets | arkts | isLocationEnabled | 定位开关是否打开
@returns true 定位开关已开启 | static isLocationEnabled(): boolean {
const locationGlobalSwitch = new LocationGlobalSwitch()
return locationGlobalSwitch.isLocationEnabled()
} | AST#method_declaration#Left static isLocationEnabled AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Le... | static isLocationEnabled(): boolean {
const locationGlobalSwitch = new LocationGlobalSwitch()
return locationGlobalSwitch.isLocationEnabled()
} | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L104-L107 | 45fab4b2c009af0f8803b29468f5c31ed59f544e | gitee |
MissTeven/ArkTS-demo.git | fd9f7695fa29889ad4a9ecf3330fda9991aca24c | entry/src/main/ets/view/PrivacyStatementComponent.ets | arkts | PrivacyStatementComponent | Component of privacy statement and help. | @Component
export struct PrivacyStatementComponent {
build() {
GridRow({
columns: {
sm: CommonConstants.GRID_ROW_SM,
md: CommonConstants.GRID_ROW_MD,
lg: CommonConstants.GRID_ROW_LG
},
gutter: { x: CommonConstants.GUTTER_X },
breakpoints: { value: CommonConstants.BR... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct PrivacyStatementComponent AST#component_body#Left { AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left GridRow ( AST#component_para... | @Component
export struct PrivacyStatementComponent {
build() {
GridRow({
columns: {
sm: CommonConstants.GRID_ROW_SM,
md: CommonConstants.GRID_ROW_MD,
lg: CommonConstants.GRID_ROW_LG
},
gutter: { x: CommonConstants.GUTTER_X },
breakpoints: { value: CommonConstants.BR... | https://github.com/MissTeven/ArkTS-demo.git/blob/fd9f7695fa29889ad4a9ecf3330fda9991aca24c/entry/src/main/ets/view/PrivacyStatementComponent.ets#L7-L69 | 1652d2dfa103e74ddcc682e1143c6976091d4c99 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/ciphers/AtbashCipher.ets | arkts | encrypt | 加密文本
@param text 要加密的文本
@returns 加密后的文本 | public static encrypt(text: string): string {
return text.split('').map(AtbashCipher.encryptChar).join('');
} | AST#method_declaration#Left public static encrypt AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | public static encrypt(text: string): string {
return text.split('').map(AtbashCipher.encryptChar).join('');
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/ciphers/AtbashCipher.ets#L28-L30 | 00f6d135c44a16a5ff86c8cee1fe6d12a3bc2ba7 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/icon/ArrowRightIcon.ets | arkts | ArrowRightIcon | @file 右箭头图标组件
@author Joker.X | @ComponentV2
export struct ArrowRightIcon {
/**
* 图标大小(单位:vp)
*/
@Param
iconSize: number = 24;
/**
* 图标颜色
*/
@Param
tintColor: ResourceColor = $r("app.color.text_tertiary");
/**
* 点击回调
*/
@Param
onTap: (() => void) | undefined = undefined;
/**
* 构建右箭头图标
* @returns {void} 无返回... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ArrowRightIcon AST#component_body#Left { /**
* 图标大小(单位:vp)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right iconSize : AST#type_annotation#Left AST#primary_type#Left number AST#p... | @ComponentV2
export struct ArrowRightIcon {
@Param
iconSize: number = 24;
@Param
tintColor: ResourceColor = $r("app.color.text_tertiary");
@Param
onTap: (() => void) | undefined = undefined;
build(): void {
CommonIcon({
icon: $r("app.media.ic_right"),
iconSize: this.iconSize,
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/icon/ArrowRightIcon.ets#L7-L37 | fb637d19503fdc518270d6d2eca34abb8ac746c4 | github |
gouhaoshuang/arkts-booking-software.git | e0254dae0c4cfd3d43c4e3970528d97136fcc69b | demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | textPickerDialog | Text dialog dialog | textPickerDialog(sexArray: Resource, sexCallback: Function) {
if (this.isEmpty(sexArray)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'sex is null');
return;
}
TextPickerDialog.show({
range: sexArray,
selected: 0,
onAccept: (result: TextPickerResult) => {
sexCallba... | AST#method_declaration#Left textPickerDialog AST#parameter_list#Left ( AST#parameter#Left sexArray : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left sexCallback : AST#type_annotation#Left AST#primary_type#Left Function AST... | textPickerDialog(sexArray: Resource, sexCallback: Function) {
if (this.isEmpty(sexArray)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'sex is null');
return;
}
TextPickerDialog.show({
range: sexArray,
selected: 0,
onAccept: (result: TextPickerResult) => {
sexCallba... | https://github.com/gouhaoshuang/arkts-booking-software.git/blob/e0254dae0c4cfd3d43c4e3970528d97136fcc69b/demo_bookkeeping/entry/src/main/ets/common/utils/CommonUtils.ets#L76-L91 | de7aaf20eb40a5b0c2b974a57effff035f928bd6 | github |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_axios/src/main/ets/ui/axiosLoading.ets | arkts | efAxiosLoadingOptions | 窗口loading方式入参实体 | @Observed
export class efAxiosLoadingOptions {
/**
* 加载内容
*/
@Track content: string = '';
/**
* 内容字体大小
*/
@Track fontSize?: string | number;
/**
* loading位置
*/
@Track position?: Alignment;
/**
* 图片布局方式
*/
@Track imgLayout?: ImgLayout;
/**
* 弹框形状
*/
@Track layoutShape?: ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class efAxiosLoadingOptions AST#class_body#Left { /**
* 加载内容
*/ AST#property_declaration#Left AST#decorator#Left @ Track AST#decorator#Right content : AST#type_annotation#Left AST#primary_type#Left string AST#primary_ty... | @Observed
export class efAxiosLoadingOptions {
@Track content: string = '';
@Track fontSize?: string | number;
@Track position?: Alignment;
@Track imgLayout?: ImgLayout;
@Track layoutShape?: LoadingShape;
constructor() {
this.content = '小的正在努力加载中...';
}
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/ui/axiosLoading.ets#L173-L199 | 2543ad892c35b29281366da3351b820cbd76e9e3 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/GridSample/entry/src/main/ets/viewmodel/GridViewModel.ets | arkts | Get the app index in bundleInfoList. | export class GridViewModel {
/**
* Get the grid items.
*
* @param {number} dataCount
* @return {Array<GridItemData>} gridItems
*/
private getGridItems(dataCount: number): Array<GridItemData> {
let gridItems: Array<GridItemData> = [];
for (let index = 0; index < dataCount; index++) {
let... | AST#export_declaration#Left export AST#class_declaration#Left class GridViewModel AST#class_body#Left { /**
* Get the grid items.
*
* @param {number} dataCount
* @return {Array<GridItemData>} gridItems
*/ AST#method_declaration#Left private getGridItems AST#parameter_list#Left ( AST#parameter#Left dataCo... | export class GridViewModel {
private getGridItems(dataCount: number): Array<GridItemData> {
let gridItems: Array<GridItemData> = [];
for (let index = 0; index < dataCount; index++) {
let gridItem = new GridItemData();
gridItem.image = $r("app.media.ic_grid_item");
gridItem.title = $r('app... | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/GridSample/entry/src/main/ets/viewmodel/GridViewModel.ets#L8-L53 | 7b8cfc30205b9b077c6e360e33dcc4808532fac7 | gitee | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | delayed_set_restore_ok | Tag myself as restore finished after 500 ms. | delayed_set_restore_ok(action?: () => void) {
setTimeout(() => {
this.pre_restoration_stage = false;
console.log(`[delayed_set_restore_ok] pack: ${this.url}, this.pre_restoration_stage = false!`);
if (action) {
try {
action();
} catch (e) {
console.error('[delay... | AST#method_declaration#Left delayed_set_restore_ok AST#parameter_list#Left ( AST#parameter#Left action ? : AST#type_annotation#Left AST#function_type#Left 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#func... | delayed_set_restore_ok(action?: () => void) {
setTimeout(() => {
this.pre_restoration_stage = false;
console.log(`[delayed_set_restore_ok] pack: ${this.url}, this.pre_restoration_stage = false!`);
if (action) {
try {
action();
} catch (e) {
console.error('[delay... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L887-L899 | abed7a4f24ba262f6e7bb385f5e8bd9eb121ccb8 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/data/FestivalData.ets | arkts | clearCache | 清空缓存(当数据发生变化时调用) | public static clearCache(): void {
FestivalData.festivalCache.clear();
FestivalData.legalHolidayCache.clear();
} | AST#method_declaration#Left public static clearCache 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... | public static clearCache(): void {
FestivalData.festivalCache.clear();
FestivalData.legalHolidayCache.clear();
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/data/FestivalData.ets#L179-L182 | aefb1f23e46637ed9a6c7f849343439c2127ef5c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets | arkts | totalCount | 获取数组长度 | public totalCount(): number {
return this.tabContent.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.tabContent.length;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/model/DataModel.ets#L64-L66 | 0502333b3e8920e4cbeab6d526c65bc929905080 | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/ui/Index.ets | arkts | AppNavDestination | @file ui 模块统一导出
@author Joker.X | export { AppNavDestination } from "./src/main/ets/component/navdestination/AppNavDestination"; | AST#export_declaration#Left export { AppNavDestination } from "./src/main/ets/component/navdestination/AppNavDestination" ; AST#export_declaration#Right | export { AppNavDestination } from "./src/main/ets/component/navdestination/AppNavDestination"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/ui/Index.ets#L6-L6 | 0f86eda453592a9d3e43fb31b6ededb374f2607e | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/utils/CacheHelper.ets | arkts | getCapacity | 获取当前缓冲区的容量。
@returns | public static getCapacity(): number {
console.error(JSON.stringify(CacheHelper.lruCache, null, 2));
return CacheHelper.lruCache.getCapacity();
} | AST#method_declaration#Left public static getCapacity 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#expression_statement#Left AST#expression#Left AST#call_exp... | public static getCapacity(): number {
console.error(JSON.stringify(CacheHelper.lruCache, null, 2));
return CacheHelper.lruCache.getCapacity();
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/utils/CacheHelper.ets#L73-L76 | 351d7f77b13dc4d2a6442839874c3854612d5ece | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/utils/RegexUtil.ets | arkts | isValidCard | 验证身份证号码的有效性
@param id
@returns | static isValidCard(id: string): boolean {
if (id.length === 18) {
const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
id = id.toLowerCase();
const lastChar = id.charAt(17).toLowerCase();
let s... | AST#method_declaration#Left static isValidCard 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_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type... | static isValidCard(id: string): boolean {
if (id.length === 18) {
const factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
const lastLetter = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
id = id.toLowerCase();
const lastChar = id.charAt(17).toLowerCase();
let s... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/utils/RegexUtil.ets#L258-L275 | 27bad4813ba7a9fc25a9c1597fad798ff7745ac1 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | getDBBoxes | / 获取转换后的 DBBoxes | getDBBoxes(): DBBox[] {
let dbBoxes: DBBox[] = [];
this.dayOfs.forEach((dayOf) => {
dayOf.boxes.forEach((box) => {
let dbBox = new DBBox();
dbBox.planId = this.planId;
dbBox.num = dayOf.num;
dbBox.distance = box.distance;
dbBox.pieceNo = box.pieceNo;
... | AST#method_declaration#Left getDBBoxes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left DBBox [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let... | getDBBoxes(): DBBox[] {
let dbBoxes: DBBox[] = [];
this.dayOfs.forEach((dayOf) => {
dayOf.boxes.forEach((box) => {
let dbBox = new DBBox();
dbBox.planId = this.planId;
dbBox.num = dayOf.num;
dbBox.distance = box.distance;
dbBox.pieceNo = box.pieceNo;
... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L436-L449 | 8117561a1774cbba5b081fcc145e04d2a10aba87 | github |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/Viewmodel/HomeViewModel.ets | arkts | queryAllData | 启动应用时初始化数据 | public queryAllData() {
AccountingInfoApi.queryAllDate((resultSet: AccountingInfo[]) => {
for (let i = 0; i < resultSet.length; i++) {
let addAccountingInfo: AccountingInfo = resultSet[i] as AccountingInfo;
let filteredItems = this.dateArr.filter(item => item.dateStr === addAccountingInfo.date... | AST#method_declaration#Left public queryAllData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AccountingInfoApi AST#expression#Right . que... | public queryAllData() {
AccountingInfoApi.queryAllDate((resultSet: AccountingInfo[]) => {
for (let i = 0; i < resultSet.length; i++) {
let addAccountingInfo: AccountingInfo = resultSet[i] as AccountingInfo;
let filteredItems = this.dateArr.filter(item => item.dateStr === addAccountingInfo.date... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/Viewmodel/HomeViewModel.ets#L34-L96 | 4bca8cc2e1036f4454054b56fe50d4d8d6b9b34c | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/Index.ets | arkts | buildNotificationCenterDialog | 通知中心对话框 | @Builder
buildNotificationCenterDialog() {
Stack() {
// 遮罩层
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0,0,0,0.5)')
.onClick(() => {
this.showNotificationCenter = false;
})
// 通知中心内容
Column({ space: 0 }) {
// 标题... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildNotificationCenterDialog 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 Stack ( ) AST#container_content_body#Left { ... | @Builder
buildNotificationCenterDialog() {
Stack() {
Column()
.width('100%')
.height('100%')
.backgroundColor('rgba(0,0,0,0.5)')
.onClick(() => {
this.showNotificationCenter = false;
})
Column({ space: 0 }) {
Row({ space... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/Index.ets#L5138-L5273 | 0e91cc34583e1f4a82770b653bf90d2f64f931f9 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DeviceUtil.ets | arkts | getBrandModel | 获取设备品牌名称 认证型号。示例:HUAWEI ALN-AL00。 | static getBrandModel(): string {
return `${deviceInfo.brand} ${deviceInfo.productModel}`;
} | AST#method_declaration#Left static getBrandModel 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#template_l... | static getBrandModel(): string {
return `${deviceInfo.brand} ${deviceInfo.productModel}`;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DeviceUtil.ets#L164-L166 | bea2901b972f7fb7519630045959abd038169c06 | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/TaskViewModel.ets | arkts | getTaskById | 根据ID获取任务 | getTaskById(id: number): TaskItem | null {
return this.tasks.find(task => task.id === id) || null;
} | AST#method_declaration#Left getTaskById AST#parameter_list#Left ( AST#parameter#Left id : 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#union_type#Left AST#primary_type#Left TaskItem AS... | getTaskById(id: number): TaskItem | null {
return this.tasks.find(task => task.id === id) || null;
} | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/TaskViewModel.ets#L88-L90 | 2e577ffb079464c1922c834fa0915cabbae36a53 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.arkui.advanced.ArcButton.d.ets | arkts | Provides an arc button style.
@enum { number }
@syscap SystemCapability.ArkUI.ArkUI.Circle
@crossplatform
@atomicservice
@since 18 | export declare enum ArcButtonStyleMode {
/**
* Emphasis status, light style.
*
* @syscap SystemCapability.ArkUI.ArkUI.Circle
* @crossplatform
* @atomicservice
* @since 18
*/
EMPHASIZED_LIGHT = 0,
/**
* Emphasis status, dark style.
*
* @syscap SystemCapabilit... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#enum_declaration#Left enum ArcButtonStyleMode AST#enum_body#Left { /**
* Emphasis status, light style.
*
* @syscap SystemCapability.ArkUI.ArkUI.Circle
* @crossplatform
* @atomicservice
* @since 18
*/ AST#enu... | export declare enum ArcButtonStyleMode {
EMPHASIZED_LIGHT = 0,
EMPHASIZED_DARK = 1,
NORMAL_LIGHT = 2,
NORMAL_DARK = 3,
CUSTOM = 4
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.arkui.advanced.ArcButton.d.ets#L62-L109 | 14de4eda08303ebd813e99fa6f845c7a4aa50c77 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | BptaUseResources/entry/src/main/ets/pages/music/AudioRenderer.ets | arkts | [EndExclude audio_renderer] | export default class EntryAbility extends UIAbility {
// Create an AudioRenderer based on the service requirements at the foreground
onForeground(): void {
audio.createAudioRenderer(audioRendererOptions, ((err: BusinessError) => {}));
}
onBackground(): void {
// Return to the background to stop or pau... | AST#export_declaration#Left export default AST#class_declaration#Left class EntryAbility extends AST#type_annotation#Left AST#primary_type#Left UIAbility AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { // Create an AudioRenderer based on the service requirements at the foreground AST#method_decla... | export default class EntryAbility extends UIAbility {
onForeground(): void {
audio.createAudioRenderer(audioRendererOptions, ((err: BusinessError) => {}));
}
onBackground(): void {
audioRenderer.stop((err: BusinessError) => {});
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/BptaUseResources/entry/src/main/ets/pages/music/AudioRenderer.ets#L40-L51 | 91f31a0f392edc7e04136f85930e5a3298bad895 | gitee | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/crypto/SM3.ets | arkts | digestSegment | SM3分段摘要,同步
@param data 待摘要的数据
@param resultCoding 摘要的编码方式(base64/hex),默认不传为hex。
@param len 自定义的数据拆分长度
@returns | static async digestSegment(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
return CryptoUtil.digestSegment(data, 'SM3', resultCoding, len);
} | AST#method_declaration#Left static async digestSegment AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qua... | static async digestSegment(data: string, resultCoding: crypto.BhCoding = 'hex', len: number = 128): Promise<string> {
return CryptoUtil.digestSegment(data, 'SM3', resultCoding, len);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/crypto/SM3.ets#L58-L60 | 5bf7d8beebc8f3683154e8c89fe5749a8946d0f6 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/timer/CountDownTimerView.ets | arkts | start | ========== 对外 API ========== | start() {
if (this.remainSeconds <= 0) this.remainSeconds = this.totalSeconds
if (this.timerId !== undefined) {
clearInterval(this.timerId)
this.timerId = undefined
}
this.running = true
this.paused = false
this.updateCanvas()
this.timerId = setInterval(() => {
if (!thi... | AST#method_declaration#Left start AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . remainSeconds AST#... | start() {
if (this.remainSeconds <= 0) this.remainSeconds = this.totalSeconds
if (this.timerId !== undefined) {
clearInterval(this.timerId)
this.timerId = undefined
}
this.running = true
this.paused = false
this.updateCanvas()
this.timerId = setInterval(() => {
if (!thi... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/timer/CountDownTimerView.ets#L100-L130 | 0f94ae70afe570b9d4cb7083887c3629f9c3f7f2 | github |
waylau/harmonyos-tutorial | 74e23dfa769317f8f057cc77c2d09f0b1f2e0773 | samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets | arkts | sleep | 延迟 | private sleep(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms))
} | AST#method_declaration#Left private sleep AST#parameter_list#Left ( AST#parameter#Left ms : 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 AST#generic_type#Left Promise... | private sleep(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms))
} | https://github.com/waylau/harmonyos-tutorial/blob/74e23dfa769317f8f057cc77c2d09f0b1f2e0773/samples/ArkTSCoreSpeechSpeechRecognizer/entry/src/main/ets/pages/Index.ets#L141-L143 | d208feab26b22409f21e45e562096e4465d60f56 | gitee |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/model/Information.ets | arkts | Information | 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... | @Observed
export class Information {
name: string;
age: number;
phone: string;
clickAble?: boolean;
constructor(name: string, age: number, phone: string, clickAble?: boolean) {
this.name = name;
this.age = age;
this.phone = phone;
this.clickAble = clickAble;
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class Information AST#class_body#Left { AST#property_declaration#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property... | @Observed
export class Information {
name: string;
age: number;
phone: string;
clickAble?: boolean;
constructor(name: string, age: number, phone: string, clickAble?: boolean) {
this.name = name;
this.age = age;
this.phone = phone;
this.clickAble = clickAble;
}
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/HarmonyOS_NEXT/ArkTSLanguageBaseClassLibrary/LanguageBaseClassLibrary/feature/capabilities/src/main/ets/model/Information.ets#L16-L29 | 2fd72b4af9bbd54f20230d2083cb5f4efdd6640a | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/utils/storage_tools.ets | arkts | Converts an ArrayBuffer to image.PixelMap object. In a sync way.
@param buf the ArrayBuffer
@returns an image.PixelMap | export function arrayBuffer_2_pixelMap_sync(buf: ArrayBuffer) {
// ArrayBuffer => PixelMap
const imageSource = image.createImageSource(buf);
console.log('imageSource: ' + JSON.stringify(imageSource));
let pixelMap = imageSource.createPixelMapSync({});
imageSource.release();
console.log('[arrayBuffer_2_pixel... | AST#export_declaration#Left export AST#function_declaration#Left function arrayBuffer_2_pixelMap_sync AST#parameter_list#Left ( AST#parameter#Left buf : AST#type_annotation#Left AST#primary_type#Left ArrayBuffer AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_st... | export function arrayBuffer_2_pixelMap_sync(buf: ArrayBuffer) {
const imageSource = image.createImageSource(buf);
console.log('imageSource: ' + JSON.stringify(imageSource));
let pixelMap = imageSource.createPixelMapSync({});
imageSource.release();
console.log('[arrayBuffer_2_pixelMap_sync] Released imageSo... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/utils/storage_tools.ets#L745-L753 | e4d1b48300bf6b9fd7042fc8cd7025552c045f08 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/widgets/BirthdayWidget.ets | arkts | onAddForm | 创建卡片实例 | onAddForm(want: Want): formBindingData.FormBindingData {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayWidget onAddForm called');
// 获取卡片配置信息
const formId = want.parameters?.[formInfo.FormParam.IDENTITY_KEY] as string;
const formName = want.parameters?.[form... | AST#method_declaration#Left onAddForm AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left formBindi... | onAddForm(want: Want): formBindingData.FormBindingData {
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, 'BirthdayWidget onAddForm called');
const formId = want.parameters?.[formInfo.FormParam.IDENTITY_KEY] as string;
const formName = want.parameters?.[formInfo.FormPa... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/widgets/BirthdayWidget.ets#L19-L37 | 3929208e47464cf67eb7cc017b8d6bcc8bde78f6 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets | arkts | backups_onClick | 备份按钮事件 | backups_onClick(){
this.cloud_refresh()
} | AST#method_declaration#Left backups_onClick AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . cloud_refresh AST#me... | backups_onClick(){
this.cloud_refresh()
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/legado-Harmony-master/entry/src/main/ets/pages/view/myCenter/cloudDisk.ets#L224-L226 | 9189811c77d7b5502bb127bb9ca13ceba303cbdf | github |
OHPG/FinVideo.git | 2b288396af5b2a20a24575faa317b46214965391 | entry/src/main/ets/pages/home/media/MediaComponent.ets | arkts | MediaComponent | @Author peerless2012
@Email peerless2012@126.com
@DateTime 2024/11/7 20:27
@Version V1.0
@Description Main | @Component
export struct MediaComponent {
private viewModel = new MediaViewModel(getContext())
@Builder
mediaLibraryItem(item: Object, index: number) {
MediaLibraryItem({
item: item as FinItem
})
}
build() {
Column() {
HomeToolBar({
title: $r('app.string.home_media')
}... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MediaComponent AST#component_body#Left { AST#property_declaration#Left private viewModel = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#new_expression#Left new AST#expression#Left MediaViewMode... | @Component
export struct MediaComponent {
private viewModel = new MediaViewModel(getContext())
@Builder
mediaLibraryItem(item: Object, index: number) {
MediaLibraryItem({
item: item as FinItem
})
}
build() {
Column() {
HomeToolBar({
title: $r('app.string.home_media')
}... | https://github.com/OHPG/FinVideo.git/blob/2b288396af5b2a20a24575faa317b46214965391/entry/src/main/ets/pages/home/media/MediaComponent.ets#L16-L58 | e73d70840e9e8aaaedd2346bc267256f712f203d | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets | arkts | getSubdirectory | 根据沙箱路径打开目录 | getSubdirectory(filePath: string): Array<SubDirectoryType> {
// 获取目录
let dir: fileio.Dir;
try {
dir = fileio.opendirSync(filePath);
} catch (err) {
let error: BusinessError = err as BusinessError;
Logger.error(TAG, `Open dir of path ${filePath} failed. error code is ${error.code}, mess... | AST#method_declaration#Left getSubdirectory AST#parameter_list#Left ( AST#parameter#Left filePath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left... | getSubdirectory(filePath: string): Array<SubDirectoryType> {
let dir: fileio.Dir;
try {
dir = fileio.opendirSync(filePath);
} catch (err) {
let error: BusinessError = err as BusinessError;
Logger.error(TAG, `Open dir of path ${filePath} failed. error code is ${error.code}, message is ... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/FileManager/Library/src/main/ets/filemanager/fileio/FileIoManager.ets#L92-L113 | 72886f7a98bda61461a7e06797bd944b274b409e | gitee |
LiuAnclouds/Harmony-ArkTS-App.git | 2119ce333927599b81a31081bc913e1416837308 | WeatherMind/entry/src/main/ets/pages/ChooseCity.ets | arkts | loadAllCities | 加载所有城市后检查当前位置状态 | private async loadAllCities() {
try {
console.log('开始加载所有城市...');
let httpRequest = http.createHttp();
let response = await httpRequest.request(Config.API.ALL_CITIES, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json'
}
});
... | AST#method_declaration#Left private async loadAllCities AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#try_statement#Left try AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Le... | private async loadAllCities() {
try {
console.log('开始加载所有城市...');
let httpRequest = http.createHttp();
let response = await httpRequest.request(Config.API.ALL_CITIES, {
method: http.RequestMethod.GET,
header: {
'Content-Type': 'application/json'
}
});
... | https://github.com/LiuAnclouds/Harmony-ArkTS-App.git/blob/2119ce333927599b81a31081bc913e1416837308/WeatherMind/entry/src/main/ets/pages/ChooseCity.ets#L147-L179 | e20ea543b8aefeb05913ed208834a9aa15eefa84 | github |
Duke_Bit/ElfRefresh | 56faf5431c1643ec5ae227dc854a31b391778b2c | library/src/main/ets/model/ElfCustomHeaderFooter.ets | arkts | @author duke
@description 自定义头尾 | export interface ElfCustomHeaderFooter{
builderHeader?:WrappedBuilder<[ElfRefreshHeader]>
builderFooter?:WrappedBuilder<[ElfLoadFooter]>
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ElfCustomHeaderFooter AST#object_type#Left { AST#type_member#Left builderHeader ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST... | export interface ElfCustomHeaderFooter{
builderHeader?:WrappedBuilder<[ElfRefreshHeader]>
builderFooter?:WrappedBuilder<[ElfLoadFooter]>
} | https://github.com/Duke_Bit/ElfRefresh/blob/56faf5431c1643ec5ae227dc854a31b391778b2c/library/src/main/ets/model/ElfCustomHeaderFooter.ets#L8-L13 | bca825222c852d99bf8a1311bacfb0f9586a2fc6 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets | arkts | buildContactInfoCard | 构建联系人信息卡片 | @Builder
buildContactInfoCard() {
Row({ space: 16 }) {
// 头像
Image(this.contact!.avatar || $r('app.media.ic_avatar_default'))
.width(60)
.height(60)
.borderRadius(30)
.objectFit(ImageFit.Cover)
// 信息
Column({ space: 4 }) {
Text(this.contact!.n... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right buildContactInfoCard 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#component_parameters#Left { AST#component_p... | @Builder
buildContactInfoCard() {
Row({ space: 16 }) {
Image(this.contact!.avatar || $r('app.media.ic_avatar_default'))
.width(60)
.height(60)
.borderRadius(30)
.objectFit(ImageFit.Cover)
Column({ space: 4 }) {
Text(this.contact!.name)
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/pages/greetings/GreetingSendPage.ets#L255-L304 | 95b4097c897379703b48db1f9de4ddecb0a4095d | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets | arkts | touchInThumb | 是否触摸在选取框内
@param event
@returns | touchInThumb(event?: GestureEvent): boolean {
if (this.touchInLeftThumb(event)
|| this.touchInRightThumb(event)
|| this.touchInMiddleThumb(event)) {
return true;
} else {
return false;
}
} | AST#method_declaration#Left touchInThumb AST#parameter_list#Left ( AST#parameter#Left event ? : AST#type_annotation#Left AST#primary_type#Left GestureEvent AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary... | touchInThumb(event?: GestureEvent): boolean {
if (this.touchInLeftThumb(event)
|| this.touchInRightThumb(event)
|| this.touchInMiddleThumb(event)) {
return true;
} else {
return false;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/videocreategif/src/main/ets/components/RangeSeekBarView.ets#L336-L346 | 95b8846873171fa6c94cba23e8145ffccd49b8d6 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_settings.ets | arkts | read_create_and_or_migration | Auto migrates old kv-store settings data into sandbox file.
Generates the very first settings.json.browsercatsettings.txt too for the first launch of app.
@returns The settings json string if read ok. Undefined if this is first launch of app, because things are already loaded. | private static async read_create_and_or_migration() {
let read = sandbox_read_text_sync('settings.json.browsercatsettings.txt');
if (read == 'undefined') {
// Need migration, load all things into bunch_of_settings.
// Load all things
for (let index = 0; index < bunch_of_settings.settings_defa... | AST#method_declaration#Left private static async read_create_and_or_migration AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left read = AST#expression#Left AST#call_expression#Left AST#expression#Left sandbox_... | private static async read_create_and_or_migration() {
let read = sandbox_read_text_sync('settings.json.browsercatsettings.txt');
if (read == 'undefined') {
for (let index = 0; index < bunch_of_settings.settings_defaults_key.length; index++) {
await bunch_of_settings.get_from_kv(bunc... | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_settings.ets#L320-L336 | 4280ca4ee30a6e86db39f60c97e89296db535aff | gitee |
RedRackham-R/WanAndroidHarmoney.git | 0bb2a7c8d7b49194a96e42a380d43b7e106cdb22 | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | subscribeLoginEvent | 订阅登录事件 | subscribeLoginEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_LOGIN, key, callback);
} | AST#method_declaration#Left subscribeLoginEvent AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parameter_list... | subscribeLoginEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_LOGIN, key, callback);
} | https://github.com/RedRackham-R/WanAndroidHarmoney.git/blob/0bb2a7c8d7b49194a96e42a380d43b7e106cdb22/entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets#L223-L225 | ac94e909c4138f4bea6ac01c64af415937f69f7c | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets | arkts | 首页应用里第一个app相对于屏幕的y轴坐标(px) | export enum DeletionStatus {
IDLE,
START,
FINISH
} | AST#export_declaration#Left export AST#enum_declaration#Left enum DeletionStatus AST#enum_body#Left { AST#enum_member#Left IDLE AST#enum_member#Right , AST#enum_member#Left START AST#enum_member#Right , AST#enum_member#Left FINISH AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right AST#export_declara... | export enum DeletionStatus {
IDLE,
START,
FINISH
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L27-L31 | f67dc7bbc7ab7a7c2569c86379bd0e197d9bcb62 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/component/GoodsDetailTopBar.ets | arkts | GoodsDetailTopBar | @file 商品详情顶部导航栏组件
@author Joker.X | @ComponentV2
export struct GoodsDetailTopBar {
/**
* 顶部导航栏透明度(0-255)
*/
@Param
topBarAlpha: number = 0;
/**
* 顶部安全区高度
*/
@Param
topInset: number = 0;
/**
* 返回按钮点击回调
*/
@Param
onBackClick: () => void = (): void => {
};
/**
* 分享按钮点击回调
*/
@Param
onShareClick: () => void = ... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsDetailTopBar AST#component_body#Left { /**
* 顶部导航栏透明度(0-255)
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right topBarAlpha : AST#type_annotation#Left AST#primary_type#Left nu... | @ComponentV2
export struct GoodsDetailTopBar {
@Param
topBarAlpha: number = 0;
@Param
topInset: number = 0;
@Param
onBackClick: () => void = (): void => {
};
@Param
onShareClick: () => void = (): void => {
};
@Param
showShare: boolean = true;
build(): void {
Stack({ alig... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/component/GoodsDetailTopBar.ets#L8-L139 | ca21c9ae33f50563da687e48ea129921d9af933f | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/goods/src/main/ets/view/GoodsCommentPage.ets | arkts | GoodsCommentPage | @file 商品评论页面视图
@author Joker.X | @ComponentV2
export struct GoodsCommentPage {
/**
* 商品评论页面 ViewModel
*/
@Local
private vm: GoodsCommentViewModel = new GoodsCommentViewModel();
/**
* 构建商品评论页面
* @returns {void} 无返回值
*/
build() {
AppNavDestination({
title: "商品评论",
viewModel: this.vm
}) {
this.GoodsComm... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct GoodsCommentPage 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 Goo... | @ComponentV2
export struct GoodsCommentPage {
@Local
private vm: GoodsCommentViewModel = new GoodsCommentViewModel();
build() {
AppNavDestination({
title: "商品评论",
viewModel: this.vm
}) {
this.GoodsCommentContent();
}
}
@Builder
private GoodsCommentContent() {
Tex... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/goods/src/main/ets/view/GoodsCommentPage.ets#L8-L37 | c4a55c22d2fea77b7e82a4736812c4607b47da65 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/WantUtil.ets | arkts | toSetting | 系统和更新-重置-还原网络设置-还原网络设置确认五级页面
跳转系统设置页面(配合WantUtil里的URI常量一起使用,可跳转更多的设置页面)
@param uri: 传入WantUtil的URI常量,不传默认为设置页面
@param parameters: WantParams参数
@returns | static async toSetting(uri?: string, parameters: Record<string, Object> = { 'pushParams': AppUtil.getContext().abilityInfo.bundleName }): Promise<void> {
const want: Want = {
bundleName: 'com.huawei.hmos.settings', //设置应用bundleName
abilityName: 'com.huawei.hmos.settings.MainAbility', //设置应用abilityName
... | AST#method_declaration#Left static async toSetting AST#parameter_list#Left ( AST#parameter#Left uri ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left parameters : AST#type_annotation#Left AST#primary_type#Left AST#generic_... | static async toSetting(uri?: string, parameters: Record<string, Object> = { 'pushParams': AppUtil.getContext().abilityInfo.bundleName }): Promise<void> {
const want: Want = {
bundleName: 'com.huawei.hmos.settings',
abilityName: 'com.huawei.hmos.settings.MainAbility',
uri: uri,
parameters:... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/WantUtil.ets#L96-L104 | e3fe33035468333d5905a06da1aca46309035815 | gitee |
wustcat404/time-bar | d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8 | entry/src/main/ets/common/contants/CommonConstants.ets | arkts | The field identifier corresponding to the log | export const LOG_TAG = 'TimeBar'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left LOG_TAG = AST#expression#Left 'TimeBar' AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const LOG_TAG = 'TimeBar'; | https://github.com/wustcat404/time-bar/blob/d876c3b10aa2538ee2ea0201b9a6fbaad9b693c8/entry/src/main/ets/common/contants/CommonConstants.ets#L83-L83 | efeba6d88ecf9425855db1ef6c03ae9a51db25b9 | gitee | |
pangpang20/wavecast.git | d3da8a0009eb44a576a2b9d9d9fe6195a2577e32 | entry/src/main/ets/service/SettingsService.ets | arkts | saveSettings | 保存设置 | private async saveSettings(): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put(Constants.PREF_THEME, this.settings.themeMode);
await this.preferences.put(Constants.PREF_PLAYBACK_SPEED, this.settings.playbackSpeed);
await this.preferences.put('wifi_only_download'... | AST#method_declaration#Left private async saveSettings AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#... | private async saveSettings(): Promise<void> {
if (!this.preferences) return;
try {
await this.preferences.put(Constants.PREF_THEME, this.settings.themeMode);
await this.preferences.put(Constants.PREF_PLAYBACK_SPEED, this.settings.playbackSpeed);
await this.preferences.put('wifi_only_download'... | https://github.com/pangpang20/wavecast.git/blob/d3da8a0009eb44a576a2b9d9d9fe6195a2577e32/entry/src/main/ets/service/SettingsService.ets#L87-L106 | d573a61bccbd34af5911f03bc7521e8e38faebd1 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets | arkts | 查看文件列表 | export function getListFile(): string {
let str = '';
let listFileOption: ListFileOptions = {
recursion: false,
listNum: 0, // 0 表示不限制文件数量
filter: {
suffix: ['.png', '.jpg', '.txt'],
displayName: ['*'],
fileSizeOver: 0, // 0 表示列出所有文件,不限制文件大小
lastModifiedAfter: new Date(0).getTime... | AST#export_declaration#Left export AST#function_declaration#Left function getListFile 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#variable_declaration#Left ... | export function getListFile(): string {
let str = '';
let listFileOption: ListFileOptions = {
recursion: false,
listNum: 0,
filter: {
suffix: ['.png', '.jpg', '.txt'],
displayName: ['*'],
fileSizeOver: 0,
lastModifiedAfter: new Date(0).getTime()
}
};
let files = fs.lis... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets#L87-L105 | e3bbb7c937bafb96a2ccb7f08cd42135c3c1ee02 | gitee | |
ccccjiemo/egl.git | d18849c3da975ccf9373fd09874aa5637ccbe6bd | Index.d.ets | arkts | destroySync | eglDestroySync | destroySync(sync: EGLSync): boolean; | AST#method_declaration#Left destroySync AST#parameter_list#Left ( AST#parameter#Left sync : AST#type_annotation#Left AST#primary_type#Left EGLSync AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Rig... | destroySync(sync: EGLSync): boolean; | https://github.com/ccccjiemo/egl.git/blob/d18849c3da975ccf9373fd09874aa5637ccbe6bd/Index.d.ets#L201-L201 | 3acf16ee44a6b1d1dbd3e27aabd29e285814f846 | github |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/view/ContactData.ets | arkts | Index of contact. | export const contactIndex: Array<string> = [
'#', '★', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z'
]; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left contactIndex : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right >... | export const contactIndex: Array<string> = [
'#', '★', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z'
]; | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/view/ContactData.ets#L77-L80 | 4059690ef95ceed9486c64a02729a09bcae416c8 | gitee | |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/sorting/QuickSort.ets | arkts | quickSort | 快速排序的递归实现
@param arr 需要排序的数组
@param low 起始索引
@param high 结束索引 | private static quickSort(arr: number[], low: number, high: number): void {
if (low < high) {
// 获取分区点
const pi = QuickSort.partition(arr, low, high);
// 递归排序分区点左侧的子数组
QuickSort.quickSort(arr, low, pi - 1);
// 递归排序分区点右侧的子数组
QuickSort.quickSort(arr, pi + 1, high);
}
} | AST#method_declaration#Left private static quickSort AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left low : AST#type_annotation#L... | private static quickSort(arr: number[], low: number, high: number): void {
if (low < high) {
const pi = QuickSort.partition(arr, low, high);
QuickSort.quickSort(arr, low, pi - 1);
QuickSort.quickSort(arr, pi + 1, high);
}
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/sorting/QuickSort.ets#L22-L32 | cf234fb60393906e682623798a87b4ea17efbdbc | github |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/Utils.ets | arkts | getPosition | Returns a recyclable MPPointF instance.
Calculates the position around a center point, depending on the distance
from the center, and the angle of the position around the center.
@param center
@param dist
@param angle in degrees, converted to radians internally
@return | public static getPosition(center: MPPointF, dist: number, angle: number, outputPoint?: MPPointF): MPPointF {
let p: MPPointF = ((outputPoint == null || outputPoint == undefined) ? MPPointF.getInstance(0, 0) : outputPoint);
p.x = center.x + dist * Math.cos((angle * Math.PI / 180));
p.y = center.y + dist * Ma... | AST#method_declaration#Left public static getPosition AST#parameter_list#Left ( AST#parameter#Left center : AST#type_annotation#Left AST#primary_type#Left MPPointF AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left dist : AST#type_annotation#Left AST#primary_type#Left number AST#p... | public static getPosition(center: MPPointF, dist: number, angle: number, outputPoint?: MPPointF): MPPointF {
let p: MPPointF = ((outputPoint == null || outputPoint == undefined) ? MPPointF.getInstance(0, 0) : outputPoint);
p.x = center.x + dist * Math.cos((angle * Math.PI / 180));
p.y = center.y + dist * Ma... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/Utils.ets#L229-L234 | 75cd1985075bfac3c65b7c53be5b15133cd6d665 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/Start/StartDialogPage.ets | arkts | formatContent | 从富文本中提取<p>标签内的内容 | formatContent(richText: string): string {
// 检查输入是否为空
if (!richText) {
return "";
}
const startIndex = richText.indexOf("<p>");
const endIndex = richText.indexOf("</p>");
// 验证标签是否存在且格式正确(<p>在</p>之前)
if (startIndex === -1 || endIndex === -1 || startIndex >= endIndex) {
console.w... | AST#method_declaration#Left formatContent AST#parameter_list#Left ( AST#parameter#Left richText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type... | formatContent(richText: string): string {
if (!richText) {
return "";
}
const startIndex = richText.indexOf("<p>");
const endIndex = richText.indexOf("</p>");
if (startIndex === -1 || endIndex === -1 || startIndex >= endIndex) {
console.warn("富文本格式不符合要求,无法提取内容");
return ... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/Start/StartDialogPage.ets#L58-L73 | 88db6f1428280214ce4ec51216a0c7ca933bc67e | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets | arkts | Domain of log. | export const DOMAIN = 0xFF00; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DOMAIN = AST#expression#Left 0xFF00 AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right AST#export_declaration#Right | export const DOMAIN = 0xFF00; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TransitionAnimation/entry/src/main/ets/common/constants/CommonConstants.ets#L130-L130 | 2358ccf2bd78a9d1fbcc2c36d36f7eda2940f1b7 | gitee | |
openharmony/applications_launcher | f75dfb6bf7276e942793b75e7a9081bbcd015843 | feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets | arkts | cancelFormDialog | When click cancel dialog, this function will be called. | cancelFormDialog() {
Log.showInfo(TAG, 'cancel dialog');
this.clearForm();
} | AST#method_declaration#Left cancelFormDialog AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left Log AST#expression#Right . showInfo AST#member_... | cancelFormDialog() {
Log.showInfo(TAG, 'cancel dialog');
this.clearForm();
} | https://github.com/openharmony/applications_launcher/blob/f75dfb6bf7276e942793b75e7a9081bbcd015843/feature/pagedesktop/src/main/ets/default/common/components/FormItem.ets#L216-L219 | 443b74241ae6bf0dd03ed95c12100201eab84fab | gitee |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets | arkts | setScatterShapeHoleColor | Sets the color for the hole in the shape.
@param holeColor | public setScatterShapeHoleColor(holeColor: number): void {
this.mScatterShapeHoleColor = holeColor;
} | AST#method_declaration#Left public setScatterShapeHoleColor AST#parameter_list#Left ( AST#parameter#Left holeColor : 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... | public setScatterShapeHoleColor(holeColor: number): void {
this.mScatterShapeHoleColor = holeColor;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScatterDataSet.ets#L116-L118 | 7c47e51e4653fea735ebb68c6faef8d1e5dc970a | gitee |
wasd09090030/MyHongmengProject.git | a8ed386b658ceeac69ef5bc42a92d78c7980821c | entry/src/main/ets/components/review/ReviewCardComponents.ets | arkts | HeroStatCard | 主统计卡片 - 英雄卡片 | @Builder
export function HeroStatCard(
totalTime: string,
completedCount: number,
averageTime: string,
efficiencyRate: string,
forceRefresh: number
) {
Column() {
Row() {
Column({ space: 8 }) {
Text('累计专注时长')
.fontSize(14)
.fontColor('#FFFFFF99')
Row({ ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function HeroStatCard AST#parameter_list#Left ( AST#parameter#Left totalTime : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left com... | @Builder
export function HeroStatCard(
totalTime: string,
completedCount: number,
averageTime: string,
efficiencyRate: string,
forceRefresh: number
) {
Column() {
Row() {
Column({ space: 8 }) {
Text('累计专注时长')
.fontSize(14)
.fontColor('#FFFFFF99')
Row({ ... | https://github.com/wasd09090030/MyHongmengProject.git/blob/a8ed386b658ceeac69ef5bc42a92d78c7980821c/entry/src/main/ets/components/review/ReviewCardComponents.ets#L12-L142 | d296d269919ae2257f2a143ae78377d066cb2deb | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | generateUsageReport | 生成使用报告 | async generateUsageReport(period: 'week' | 'month' | 'year'): Promise<string> {
const stats = await this.getStatisticsData();
const report = this.formatUsageReport(stats, period);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Usage report generated for ${period}`);
return rep... | AST#method_declaration#Left async generateUsageReport AST#parameter_list#Left ( AST#parameter#Left period AST#parameter#Right AST#ERROR#Left : 'week' | 'month' | 'year' AST#ERROR#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST... | async generateUsageReport(period: 'week' | 'month' | 'year'): Promise<string> {
const stats = await this.getStatisticsData();
const report = this.formatUsageReport(stats, period);
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Usage report generated for ${period}`);
return rep... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L588-L596 | 35706383dc0ab25e59c3e40ca7d4b5f3cd90215f | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/utils/DownloadUtils.ets | arkts | getDownloadWantAgent | 创建一个可拉起Ability的Want
@param uri
@param fileActionType 文件预览、文件保存
@returns | static async getDownloadWantAgent(uri: string, fileActionType: FileActionType): Promise<WantAgent> {
const context = ArkWebHelper.getContext(); //获取当前上下文对象
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
moduleName: contex... | AST#method_declaration#Left static async getDownloadWantAgent AST#parameter_list#Left ( AST#parameter#Left uri : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left fileActionType : AST#type_annotation#Left AST#primary_type#Left... | static async getDownloadWantAgent(uri: string, fileActionType: FileActionType): Promise<WantAgent> {
const context = ArkWebHelper.getContext();
const wantAgentInfo: wantAgent.WantAgentInfo = {
wants: [
{
bundleName: context.abilityInfo.bundleName,
moduleName: context.abilityIn... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/utils/DownloadUtils.ets#L157-L177 | 2d4c0ef8c1c51164fce2f0afb658a324563596e4 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets | arkts | getCurrentScreenWidth | 获取当前屏幕宽度 | getCurrentScreenWidth(): number {
let screenWidth: number = px2vp(display.getDefaultDisplaySync().width);
// 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显
// 示,需要重新计算实际页面所需的屏幕宽度。
if (!this.isPlugin && screenWidth >= this.DEVICESIZE) {
return screenWidth / ... | AST#method_declaration#Left getCurrentScreenWidth AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left scr... | getCurrentScreenWidth(): number {
let screenWidth: number = px2vp(display.getDefaultDisplaySync().width);
if (!this.isPlugin && screenWidth >= this.DEVICESIZE) {
return screenWidth / 2;
} else {
return screenWidth;
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/CalendarViewSwitch/casesfeature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets#L134-L143 | b6ab9e87ba0a25b6cec0fc0585622019bfff0cba | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/modules/auth/AuthService.ets | arkts | logout | 注销登录 | async logout(): Promise<void> {
await StorageManager.remove(this.TOKEN_KEY);
await StorageManager.remove(this.USER_INFO_KEY);
this.currentUser = null;
EventBus.emit('LOGOUT_SUCCESS');
Logger.info('AuthService', 'Logout successful');
} | AST#method_declaration#Left async logout AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right > AST#type_arguments... | async logout(): Promise<void> {
await StorageManager.remove(this.TOKEN_KEY);
await StorageManager.remove(this.USER_INFO_KEY);
this.currentUser = null;
EventBus.emit('LOGOUT_SUCCESS');
Logger.info('AuthService', 'Logout successful');
} | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/modules/auth/AuthService.ets#L175-L183 | 40f1b1b772d80e6b09503df3b88f37dbef2a43de | github |
zl3624/harmonyos_network_samples | b8664f8bf6ef5c5a60830fe616c6807e83c21f96 | code/tls/TLSEchoServer/entry/src/main/ets/pages/Index.ets | arkts | stopServer | 停止服务 | stopServer() {
tlsSocketServer.off('connect')
for (let client of this.clientList) {
client.off('message')
}
this.running = false
this.msgHistory += "停止服务\r\n"
} | AST#method_declaration#Left stopServer AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left tlsSocketServer AST#expression#Right . o... | stopServer() {
tlsSocketServer.off('connect')
for (let client of this.clientList) {
client.off('message')
}
this.running = false
this.msgHistory += "停止服务\r\n"
} | https://github.com/zl3624/harmonyos_network_samples/blob/b8664f8bf6ef5c5a60830fe616c6807e83c21f96/code/tls/TLSEchoServer/entry/src/main/ets/pages/Index.ets#L127-L134 | 412c340a80c831921f3a944fc1820007fb9cb054 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/model/WeekCalendarModel.ets | arkts | init calendar data
@param date today str | export function initializeOnStartUp(date: Date): WeekCalendarInfo {
let weekCalendarInfo: WeekCalendarInfo = new WeekCalendarInfo();
let arr: Array<WeekDateModel> = [];
let strArr: Array<string> = [];
let currentDay = date.getDay() - 1;
if (date.getDay() === 0) {
currentDay = 6;
}
Logger.debug('WeekCa... | AST#export_declaration#Left export AST#function_declaration#Left function initializeOnStartUp 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... | export function initializeOnStartUp(date: Date): WeekCalendarInfo {
let weekCalendarInfo: WeekCalendarInfo = new WeekCalendarInfo();
let arr: Array<WeekDateModel> = [];
let strArr: Array<string> = [];
let currentDay = date.getDay() - 1;
if (date.getDay() === 0) {
currentDay = 6;
}
Logger.debug('WeekCa... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/model/WeekCalendarModel.ets#L44-L66 | ed89fbd84fb9cbae10b63103dcb7126b73a4c847 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/util/DynamicUtil.ets | arkts | hmac | 消息认证码计算
@param str 计算字符串
@param symAlgName 秘钥规格
@returns | static async hmac(str: string, symAlgName: string): Promise<string> {
//创建消息认证码计算器
let mac = crypto.createMac(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200; // 默认以200字节为单位进行分段update
let symKeyGenerator = crypto.createSymKeyGenerator('AES256')... | AST#method_declaration#Left static async hmac AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_... | static async hmac(str: string, symAlgName: string): Promise<string> {
let mac = crypto.createMac(symAlgName);
let messageData = new Uint8Array(buffer.from(str, 'utf-8').buffer);
let updateLength = 200;
let symKeyGenerator = crypto.createSymKeyGenerator('AES256');
let symKey = await symKey... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/util/DynamicUtil.ets#L80-L97 | 43bac5e749ba2b536001ed36f1731d1cfbef3fa9 | gitee |
Neptune-EX/OS_System_Design.git | c728a82d48079ae0c52d50c4a2e2586b69f4ce55 | entry/src/main/ets/view/PublicFilesTab.ets | arkts | searchFilesWithInfo | 搜索文件(带详细信息) | async searchFilesWithInfo() {
console.log('搜索文件:', this.searchKeyword);
if (this.fileManager) {
if (this.searchKeyword.trim() === '') {
await this.loadFileListWithInfo();
} else {
const files = await this.fileManager.searchFilesWithInfo(this.searchKeyword);
this.fileList = f... | AST#method_declaration#Left async searchFilesWithInfo AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left console AST#expression#Right . log AST... | async searchFilesWithInfo() {
console.log('搜索文件:', this.searchKeyword);
if (this.fileManager) {
if (this.searchKeyword.trim() === '') {
await this.loadFileListWithInfo();
} else {
const files = await this.fileManager.searchFilesWithInfo(this.searchKeyword);
this.fileList = f... | https://github.com/Neptune-EX/OS_System_Design.git/blob/c728a82d48079ae0c52d50c4a2e2586b69f4ce55/entry/src/main/ets/view/PublicFilesTab.ets#L235-L247 | 9f9ff7f744fb6bf1bc7731ba2722406019df88ea | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_dialog/src/main/ets/model/TextAreaOptions.ets | arkts | TODO 输入弹出框,参数类
author: 桃花镇童长老ᥫ᭡
since: 2024/08/18 | export interface TextAreaOptions extends BaseInputOptions {
inputType?: TextAreaType; //输入框类型。默认值:TextAreaType.Normal
inputLineHeight?: number | string | Resource; //行高
textAlign?: TextAlign; //输入框TextAlign
align?: TextAlignment; //输入框Align
} | AST#export_declaration#Left export AST#interface_declaration#Left interface TextAreaOptions AST#extends_clause#Left extends BaseInputOptions AST#extends_clause#Right AST#object_type#Left { AST#type_member#Left inputType ? : AST#type_annotation#Left AST#primary_type#Left TextAreaType AST#primary_type#Right AST#type_anno... | export interface TextAreaOptions extends BaseInputOptions {
inputType?: TextAreaType;
inputLineHeight?: number | string | Resource;
textAlign?: TextAlign;
align?: TextAlignment;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_dialog/src/main/ets/model/TextAreaOptions.ets#L24-L32 | 792d66ce2c59c90df083840e768136e91a8b6e75 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/StateManagement/entry/src/main/ets/segment/segment10.ets | arkts | Segment10Builder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function Segment10Builder() {
NavDestination(){
Index()
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function Segment10Builder 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 NavDestination ( ) AST#containe... | @Builder
export function Segment10Builder() {
NavDestination(){
Index()
}
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/StateManagement/entry/src/main/ets/segment/segment10.ets#L16-L21 | b1780ce96b5870d3fc83ef53d4e97f0449d9df3c | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/views/FocusPage.ets | arkts | focusPage | Exposure selection | @Component
export struct focusPage {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
// Display where scale, focal length value, and focus box cannot coexist
@Link exposureBol: boolean;
// Exposure value
@Link exposureNum: number;
build() {
Row() {
if (this.focusPointBol) {
... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct focusPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right focusPointBol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct focusPage {
@Link focusPointBol: boolean;
@Link focusPointVal: Array<number>;
@Link exposureBol: boolean;
@Link exposureNum: number;
build() {
Row() {
if (this.focusPointBol) {
Row() {
if (this.exposureBol) {
Flex({ direction: FlexDire... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/views/FocusPage.ets#L17-L117 | 737101555da5a90c1e1d9a06ca783df0dfbe3834 | gitee |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | confirmDeleteTask | 删除任务 | async confirmDeleteTask() {
if (!this.task.id) return;
this.isSubmitting = true;
try {
await deleteTask(this.task.id);
const toastOptions: promptAction.ShowToastOptions = {
message: '任务删除成功',
duration: 2000
};
prompt.showToast(toastOptions);
// 返回上一页
... | AST#method_declaration#Left async confirmDeleteTask AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ( AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#unary_expression#Left ! ... | async confirmDeleteTask() {
if (!this.task.id) return;
this.isSubmitting = true;
try {
await deleteTask(this.task.id);
const toastOptions: promptAction.ShowToastOptions = {
message: '任务删除成功',
duration: 2000
};
prompt.showToast(toastOptions);
router.b... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L407-L432 | 6f760aa154a8f48a6527fcc61a77973eca124c42 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets | arkts | showDeleteConfirmDialog | 显示删除确认对话框的方法 | showDeleteConfirmDialog(): void {
this.showDeleteDialog = true;
const dialogOptions: promptAction.ShowDialogOptions = {
title: '确认删除',
message: '确定要删除这个任务吗?删除后将无法恢复。',
buttons: [
{
text: '取消',
color: '#666666'
},
{
text: '删除',
... | AST#method_declaration#Left showDeleteConfirmDialog 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#assignment_e... | showDeleteConfirmDialog(): void {
this.showDeleteDialog = true;
const dialogOptions: promptAction.ShowDialogOptions = {
title: '确认删除',
message: '确定要删除这个任务吗?删除后将无法恢复。',
buttons: [
{
text: '取消',
color: '#666666'
},
{
text: '删除',
... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/pages/task/TaskEditPage.ets#L1082-L1113 | 60bf6e84bea95fc2dd14a30a681df7654248658f | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | regXCompSizeUpdateListener | 注册相机流展示组件内容尺寸修改回调函数
@param {Function} callback 相机流展示组件内容尺寸修改回调函数
@returns {void} | regXCompSizeUpdateListener(callback: Function): void {
this.cameraCompSizeUpdateCb = callback;
} | AST#method_declaration#Left regXCompSizeUpdateListener AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left Function AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST... | regXCompSizeUpdateListener(callback: Function): void {
this.cameraCompSizeUpdateCb = callback;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L224-L226 | 50e0d40a948424a9dd0d7d0dfd60d18582c2bb99 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/CustomRefreshLoadLayout.ets | arkts | CustomLayout | Custom layout to show refresh or load. | @Component
export default struct CustomLayout {
@ObjectLink customRefreshLoadClass: CustomRefreshLoadLayoutClass;
build() {
Row() {
Image(this.customRefreshLoadClass.imageSrc)
.width(Const.RefreshLayout_IMAGE_WIDTH)
.height(Const.RefreshLayout_IMAGE_HEIGHT)
Text(this.customRefreshL... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct CustomLayout AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ ObjectLink AST#decorator#Right customRefreshLoadClass : AST#type_annotation#Left AST#primary_type#Left CustomRefreshLoa... | @Component
export default struct CustomLayout {
@ObjectLink customRefreshLoadClass: CustomRefreshLoadLayoutClass;
build() {
Row() {
Image(this.customRefreshLoadClass.imageSrc)
.width(Const.RefreshLayout_IMAGE_WIDTH)
.height(Const.RefreshLayout_IMAGE_HEIGHT)
Text(this.customRefreshL... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/NetworkManagement/NewsDataArkTS/entry/src/main/ets/view/CustomRefreshLoadLayout.ets#L22-L45 | 5ba02cd8bdc1ecec35e4a33858f431e11951b4f3 | gitee |
yangsongming/ArkTs-HuXiHelper.git | ed148299fc6dcf351bcc0f2863a5aee4885fbaf5 | ets/viewmodel/MapModel.ets | arkts | Initializing Map Data. | export class MapModel {
private data?: AddressItem;
private addressArray: Array<AddressItem> = new Array(Const.MAP_LANDMARKS_LENGTH).fill(undefined);
/**
* Obtains landmark objects on the map based on the longitude and latitude.
*
* @param geoCoordinates Longitude and latitude.
* @param type Landmark... | AST#export_declaration#Left export AST#class_declaration#Left class MapModel AST#class_body#Left { AST#property_declaration#Left private data ? : AST#type_annotation#Left AST#primary_type#Left AddressItem AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#property_declaration#Left pri... | export class MapModel {
private data?: AddressItem;
private addressArray: Array<AddressItem> = new Array(Const.MAP_LANDMARKS_LENGTH).fill(undefined);
calCoordinateByLonAndLat(geoCoordinates: Array<GeoCoordinates>, type: number, mapWidth: number, mapHeight: number): AddressItem {
this.data = undefined;
... | https://github.com/yangsongming/ArkTs-HuXiHelper.git/blob/ed148299fc6dcf351bcc0f2863a5aee4885fbaf5/ets/viewmodel/MapModel.ets#L11-L32 | 720a28b89de7316146961f00605dd8f9afb52c06 | github | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildEmojiUpdate.ets | arkts | handle | 应用约束1:为参数添加类型注解(根据实际类型替换any) | handle(oldEmoji: any, newEmoji: any): object { // 需要根据实际返回类型定义更具体的类型
// 应用约束1:client需要正确定义类型
const emoji = this.client.dataManager.updateEmoji(oldEmoji, newEmoji);
return { emoji };
} | AST#method_declaration#Left handle AST#parameter_list#Left ( AST#parameter#Left oldEmoji : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newEmoji : AST#type_annotation#Left AST#primary_type#Left any AST#primary_type#Right AST... | handle(oldEmoji: any, newEmoji: any): object {
const emoji = this.client.dataManager.updateEmoji(oldEmoji, newEmoji);
return { emoji };
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/actions/GuildEmojiUpdate.ets#L6-L10 | 3f312ae15820f08b418abe3a99a821d322af15b9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/multicolumndisplay/Index.ets | arkts | MultiColumnDisplayComponent | 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 { MultiColumnDisplayComponent } from './src/main/ets/components/MultiColumnDisplayPage'; | AST#export_declaration#Left export { MultiColumnDisplayComponent } from './src/main/ets/components/MultiColumnDisplayPage' ; AST#export_declaration#Right | export { MultiColumnDisplayComponent } from './src/main/ets/components/MultiColumnDisplayPage'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/multicolumndisplay/Index.ets#L30-L30 | c772e7d2bd4456ea2c88f376b272fdf2ead6441e | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/shortcut/ShortcutManager.ets | arkts | getUpcomingBirthdays | 私有辅助方法
获取即将到来的生日 | private async getUpcomingBirthdays(): Promise<Contact[]> {
try {
const contacts = await this.contactService.searchContacts({ pageSize: 100 });
return contacts.filter(contact => {
if (!contact.birthday.date) return false;
const daysUntil = this.calculateDaysUntil(contact.birthday.date);
... | AST#method_declaration#Left private async getUpcomingBirthdays 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 Contact [ ] AST#array_type#Right... | private async getUpcomingBirthdays(): Promise<Contact[]> {
try {
const contacts = await this.contactService.searchContacts({ pageSize: 100 });
return contacts.filter(contact => {
if (!contact.birthday.date) return false;
const daysUntil = this.calculateDaysUntil(contact.birthday.date);
... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/shortcut/ShortcutManager.ets#L405-L417 | d49755c2c656eb02f336d1c8d0ff61223ee1f043 | github |
xixi-cquer/ShouZhiJiZhang.git | aafb992b704f758715c5ee21e6cb636b467be7de | entry/src/main/ets/pages/MainPage.ets | arkts | deleteListItem | 删除功能 | deleteListItem() {
for (let i = 0; i < this.deleteList.length; i++) {
let index = this.accounts.indexOf(this.deleteList[i]);
this.accounts.splice(index, 1);
this.AccountTable.deleteData(this.deleteList[i], () => {
});
}
this.deleteList = [];
this.isEdit = false;
} | AST#method_declaration#Left deleteListItem AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#for_statement#Left for ( AST#variable_declaration#Left let AST#variable_declarator#Left i = AST#expression#Left 0 AST#expression#Right AST#variable_declarator#Right ; AST#var... | deleteListItem() {
for (let i = 0; i < this.deleteList.length; i++) {
let index = this.accounts.indexOf(this.deleteList[i]);
this.accounts.splice(index, 1);
this.AccountTable.deleteData(this.deleteList[i], () => {
});
}
this.deleteList = [];
this.isEdit = false;
} | https://github.com/xixi-cquer/ShouZhiJiZhang.git/blob/aafb992b704f758715c5ee21e6cb636b467be7de/entry/src/main/ets/pages/MainPage.ets#L253-L262 | 59dc340f222caa4dd428c46b60224e3e0da5c389 | github |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | 取按钮文字
@param status 状态
@return 按钮文字 | export function getButtonText(status: number): string | Resource {
return OtaUpdateManager.getInstance().getStateObj(status).buttonText;
} | AST#export_declaration#Left export AST#function_declaration#Left function getButtonText AST#parameter_list#Left ( AST#parameter#Left status : 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 A... | export function getButtonText(status: number): string | Resource {
return OtaUpdateManager.getInstance().getStateObj(status).buttonText;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L61-L63 | 1366bb5c62e4f1a8f0bebf32be5ddf9f84765b3e | gitee | |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinCard/entry/src/main/ets/entryability/EntryAbility.ets | arkts | onNewWant | 再次拉起应用 | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
if (want?.parameters?.params) {
// want.parameters.params 对应 postCardAction() 中 params 内容
let params: Record<string, Object> = JSON.parse(want.parameters.params as string);
this.selectPage = params.targetPage as string;
}
... | AST#method_declaration#Left onNewWant AST#parameter_list#Left ( AST#parameter#Left want : AST#type_annotation#Left AST#primary_type#Left Want AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left launchParam : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left Abi... | onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void {
if (want?.parameters?.params) {
let params: Record<string, Object> = JSON.parse(want.parameters.params as string);
this.selectPage = params.targetPage as string;
}
if (this.currentWindowStage !== null) {
this.on... | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinCard/entry/src/main/ets/entryability/EntryAbility.ets#L44-L53 | 4894be3d77a02371b2e3fb954e4c21ca4fd073c1 | gitee |
meltsama/Arkts_HarmonyOS_App.git | 546adabde1c0f2e9abb988dd26c5722f4f0e2514 | version_1/entry/src/main/ets/pages/xzypages/bzxq.ets | arkts | 初始颜色为白色 | build() {
Column() {
Row(){
Image($r('app.media.backbutton')).width(20).onClick(() =>{
router.back()
})
Text('帮助详情')
.margin({left:113})
.fontSize(20)
.fontWeight(600)//.padding(20)
.textAlign(TextAlign.Center)
}
.width('10... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Column() {
Row(){
Image($r('app.media.backbutton')).width(20).onClick(() =>{
router.back()
})
Text('帮助详情')
.margin({left:113})
.fontSize(20)
.fontWeight(600)
.textAlign(TextAlign.Center)
}
.width('100%')
.pa... | https://github.com/meltsama/Arkts_HarmonyOS_App.git/blob/546adabde1c0f2e9abb988dd26c5722f4f0e2514/version_1/entry/src/main/ets/pages/xzypages/bzxq.ets#L9-L163 | 20ae14728b843d511f9967274d99c7f128e749cf | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/utils/DateUtils.ets | arkts | getDaysUntilBirthday | 获取距离生日的天数
@param birthDate 出生日期
@param isLunar 是否农历生日
@returns 距离生日的天数 | static getDaysUntilBirthday(birthDate: string | Date, isLunar: boolean = false): number {
const nextBirthday = DateUtils.getNextBirthday(birthDate, isLunar);
if (!nextBirthday) {
return 365; // 默认值
}
const today = new Date();
const next = new Date(nextBirthday);
// 重置时间为00:00:00以... | AST#method_declaration#Left static getDaysUntilBirthday AST#parameter_list#Left ( AST#parameter#Left birthDate : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#paramet... | static getDaysUntilBirthday(birthDate: string | Date, isLunar: boolean = false): number {
const nextBirthday = DateUtils.getNextBirthday(birthDate, isLunar);
if (!nextBirthday) {
return 365;
}
const today = new Date();
const next = new Date(nextBirthday);
today.setHours(0, ... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/utils/DateUtils.ets#L209-L223 | 884e37b869d4fd2c4aee315473b4229b086b159b | github |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelPinsUpdate.ets | arkts | 应用约束:61. 不支持export = ...语法,改用ES6导出 | export default ChannelPinsUpdate; | AST#export_declaration#Left export default AST#expression#Left ChannelPinsUpdate AST#expression#Right ; AST#export_declaration#Right | export default ChannelPinsUpdate; | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/alprazolamdiv/11.5.1/package/src/client/websocket/packets/handlers/ChannelPinsUpdate.ets#L37-L37 | 20c93a9977bf94dc81961bd44a1695655a3d3071 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/util/StrUtil.ets | arkts | repeat | 重复 N 次给定字符串
@param str 要重复的字符串
@param n 重复的次数
@returns | static repeat(str: string = '', n: number = 1): string {
return str.repeat(n);
} | AST#method_declaration#Left static repeat AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left '' AST#expression#Right AST#parameter#Right , AST#parameter#Left n : AST#type_annotation#Left AST#prim... | static repeat(str: string = '', n: number = 1): string {
return str.repeat(n);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/util/StrUtil.ets#L183-L185 | 923106b7084a8106974a39c85691bc264fe2a28d | gitee |
bigbear20240612/planner_build-.git | 89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1 | entry/src/main/ets/viewmodel/AcademyManager.ets | arkts | initializeLearningProgress | 初始化学习进度 | private initializeLearningProgress(): void {
const methods: Array<MethodInfo> = [
{ id: 'pomodoro', name: '番茄工作法' },
{ id: 'gtd', name: 'GTD时间管理' },
{ id: 'eisenhower', name: '四象限法' },
{ id: 'timeblock', name: '时间块管理' },
{ id: 'kanban', name: '看板方法' },
{ id: 'okr', name: 'OKR目标管理... | AST#method_declaration#Left private initializeLearningProgress AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declar... | private initializeLearningProgress(): void {
const methods: Array<MethodInfo> = [
{ id: 'pomodoro', name: '番茄工作法' },
{ id: 'gtd', name: 'GTD时间管理' },
{ id: 'eisenhower', name: '四象限法' },
{ id: 'timeblock', name: '时间块管理' },
{ id: 'kanban', name: '看板方法' },
{ id: 'okr', name: 'OKR目标管理... | https://github.com/bigbear20240612/planner_build-.git/blob/89c0e0027d9c46fa1d0112b71fcc95bb0b97ace1/entry/src/main/ets/viewmodel/AcademyManager.ets#L173-L195 | 1cd769dfd5fc74d79ef83cae58db6c9c0e00fe97 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.