nwo stringclasses 304
values | sha stringclasses 304
values | path stringlengths 9 214 | language stringclasses 1
value | identifier stringlengths 0 49 | docstring stringlengths 1 34.2k | function stringlengths 8 59.4k | ast_function stringlengths 71 497k | obf_function stringlengths 8 39.4k | url stringlengths 102 324 | function_sha stringlengths 40 40 | source stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | advanced_ui_component/treeview/source/treeview.ets | arkts | off | Destroy event.
@param type Registered Events.
@param callback Event callback.
@since 10 | public off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void {
if (type === null) {
this._events = [];
}
if (Array.isArray(type)) {
for (let i: number = 0, l: number = type.length; i < l; i++) {
this.off((type as TreeListenType[])[i], callback);
}
}... | AST#method_declaration#Left public off AST#parameter_list#Left ( AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TreeListenType 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_li... | public off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void {
if (type === null) {
this._events = [];
}
if (Array.isArray(type)) {
for (let i: number = 0, l: number = type.length; i < l; i++) {
this.off((type as TreeListenType[])[i], callback);
}
}... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/advanced_ui_component/treeview/source/treeview.ets#L850-L874 | 299cc0a35599ce80a60baeecb12dc4aad3609dcf | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/ApplicationModels/SystemRouter/harB/src/main/ets/components/MainPage.ets | arkts | MainPage | 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... | @Component
export struct MainPage {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width($r('app.string.full_percent'))
}
.height($r('app.string.full_percent'))
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct MainPage AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotatio... | @Component
export struct MainPage {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width($r('app.string.full_percent'))
}
.height($r('app.string.full_percent'))
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/ApplicationModels/SystemRouter/harB/src/main/ets/components/MainPage.ets#L16-L31 | d8cd89793420f6b916113697d7c6d32bf74b2e9b | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/UI/ListBeExchange/ListExchange/src/main/ets/common/commonConstants.ets | arkts | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export class CommonConstants {
// 初始化列表项高度
public static readonly LIST_ITEM_HEIGHT = 50;
// 初始化动画时间
public static readonly ANIMATE_DURATION = 300;
// 初始化列表项名称
public static readonly LIST_NAME = '标题1';
} | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { // 初始化列表项高度 AST#property_declaration#Left public static readonly LIST_ITEM_HEIGHT = AST#expression#Left 50 AST#expression#Right ; AST#property_declaration#Right // 初始化动画时间 AST#property_declaration#Left public stati... | export class CommonConstants {
public static readonly LIST_ITEM_HEIGHT = 50;
public static readonly ANIMATE_DURATION = 300;
public static readonly LIST_NAME = '标题1';
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/UI/ListBeExchange/ListExchange/src/main/ets/common/commonConstants.ets#L16-L23 | cd43472dffae213a10f70b52f45cab3fecb98b16 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets | arkts | fill | 日期不足两位补充0
@param value-数据值 | fill(value) {
return (value > 9 ? '' : '0') + value
} | AST#method_declaration#Left fill AST#parameter_list#Left ( AST#parameter#Left value AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#parenthesized_expression#Left ( AST#exp... | fill(value) {
return (value > 9 ? '' : '0') + value
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Telephony/Message/entry/src/main/ets/model/DateTimeUtil.ets#L41-L43 | 5866f6cde3bb3b4e2e3ba102cd26590b77d1e101 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getDownloadProgress | 取升级进度
@return 升级进度 | getDownloadProgress(): number {
return this._downloadProgress;
} | AST#method_declaration#Left getDownloadProgress 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_expr... | getDownloadProgress(): number {
return this._downloadProgress;
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L250-L252 | 402896fa23f0e175585a2916b8b0fced31dd4268 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | entry/src/main/ets/pages/scrollingCharts/data/Cosine.ets | arkts | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class Cosine {
public data: number[] = [
1.0, //#0
0.9998000066755178, //#1
0.9992001066967312, //#2
0.9982005400156222, //#3
0.996801706445518, //#4
0.9950041651292624, //#5
0.992808635283034, //#6
0.990215996129463, //#7
0.9872272839453933, //#8
0.9838436941753... | AST#export_declaration#Left export default AST#class_declaration#Left class Cosine AST#class_body#Left { AST#property_declaration#Left public data : 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#expression#Left A... | export default class Cosine {
public data: number[] = [
1.0,
0.9998000066755178,
0.9992001066967312,
0.9982005400156222,
0.996801706445518,
0.9950041651292624,
0.992808635283034,
0.990215996129463,
0.9872272839453933,
0.9838436941753507,
0.9800665802095645, 0
... | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/entry/src/main/ets/pages/scrollingCharts/data/Cosine.ets#L16-L769 | 2a0578397d522006b4d530a826a427cf7a299a27 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customanimationtab/src/main/ets/view/CustomAnimationTabView.ets | arkts | testBuilder | 功能说明: 本示例介绍使用List、Text等组件,以及animateTo等接口实现自定义Tab效果
推荐场景: 需要自定义动效的tab场景
核心组件:
1. CustomAnimationTab: 自定义动效tab构建组件
2. AnimationAttribute: 动效属性,可通过继承扩展动效属性
3. TabInfo: 设置TabBar的标题、TabContent以及TabBar样式的类
4. CustomAnimationTabController: 自定义动效Tab控制器,用于控制自定义动效Tab组件进行页签切换
5. IndicatorBarAttribute: 设置背景条属性
6. TabBarAttribute... | @Builder
function testBuilder() {
Column(){
}
.height("100%")
.width("100%")
.backgroundColor(Color.Gray)
} | AST#decorated_function_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right function testBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Lef... | @Builder
function testBuilder() {
Column(){
}
.height("100%")
.width("100%")
.backgroundColor(Color.Gray)
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customanimationtab/src/main/ets/view/CustomAnimationTabView.ets#L85-L92 | 1933e2829602b3983e0ca2dd6d952aa38a6ab11e | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/model/TypeConversion.ets | arkts | 类型转换 | export default class TypeConversionUtil {
/**
* Uint8Array 转 string
* @param arr Uint8Array
* @returns string
*/
static byteToString(arr: Uint8Array): string {
let str: string = ''
let _arr: Uint8Array = arr
for (let i = 0; i < _arr.length; i++) {
// 将数值转为二进制字符串
let binaryStr: s... | AST#export_declaration#Left export default AST#class_declaration#Left class TypeConversionUtil AST#class_body#Left { /**
* Uint8Array 转 string
* @param arr Uint8Array
* @returns string
*/ AST#method_declaration#Left static byteToString AST#parameter_list#Left ( AST#parameter#Left arr : AST#type_annotation#L... | export default class TypeConversionUtil {
static byteToString(arr: Uint8Array): string {
let str: string = ''
let _arr: Uint8Array = arr
for (let i = 0; i < _arr.length; i++) {
let binaryStr: string = _arr[i].toString(2)
let matchArray = binaryStr.match(new RegExp('/^1+?(?=0)/'))
... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/FileManagement/MediaCollections/entry/src/main/ets/model/TypeConversion.ets#L19-L98 | a7c9d751da627561a93d2c34cd82bf3f1083a986 | gitee | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets | arkts | Common constants for all features. | export class CommonConstants {
/**
* User Center Link.
*/
static readonly USER_CENTER_URL = 'https://id1.cloud.huawei.com/AMW/portal/userCenter/index.html?' +
'service=http://developer.huawei.com/consumer/cn/#/accountCenter/userCenter';
/**
* About Links.
*/
static readonly USER_ABOUT_URL = 'htt... | AST#export_declaration#Left export AST#class_declaration#Left class CommonConstants AST#class_body#Left { /**
* User Center Link.
*/ AST#property_declaration#Left static readonly USER_CENTER_URL = AST#expression#Left AST#binary_expression#Left AST#expression#Left 'https://id1.cloud.huawei.com/AMW/portal/userCente... | export class CommonConstants {
static readonly USER_CENTER_URL = 'https://id1.cloud.huawei.com/AMW/portal/userCenter/index.html?' +
'service=http://developer.huawei.com/consumer/cn/#/accountCenter/userCenter';
static readonly USER_ABOUT_URL = 'https://id1.cloud.huawei.com/AMW/portal/userCenter/index.html?... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/WebCookie/entry/src/main/ets/common/constants/CommonConstant.ets#L19-L147 | 175a5dc34ab942a7a1eb3bfc3af2b6a9f4fe818f | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets | arkts | pageTurningAnimate | 通过animateTo方法为组件添加动效,动效时长要小于setInterval函数调用周期 | private pageTurningAnimate() {
// TODO: 知识点: 使用animateTo方法添加动画效果,同时控制动画的时长,以及动画过程中各元素状态的改变。
animateTo(
{
duration: 700, onFinish: () => {
// 动画结束时,Text组件A显示的页面编号和B显示的页面编号相等
this.pageNumTextA = this.animatePageNumTextB;
// 动画结束时,Text组件A以中心线为轴旋转180度,用于显示左侧翻页动画结束时的页面编号
... | AST#method_declaration#Left private pageTurningAnimate AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // TODO: 知识点: 使用animateTo方法添加动画效果,同时控制动画的时长,以及动画过程中各元素状态的改变。 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left animateTo ( AST#component_parameter... | private pageTurningAnimate() {
animateTo(
{
duration: 700, onFinish: () => {
this.pageNumTextA = this.animatePageNumTextB;
this.rotateAngleTextA = 180;
this.rotateAngleTextB = 0;
this.animatePageNumTextB = (this.animatePageNumTex... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pageturninganimation/src/main/ets/view/PageTurningAnimation.ets#L90-L111 | 799ebf449f6fee03d50fdbca5486d41823dfcd7f | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | initScanData | 自定义扫码数据初始化
@returns {void} | initScanData() {
this.isScanLine = false;
this.isScanned = false;
this.scanResult = {} as ScanResults;
} | AST#method_declaration#Left initScanData AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . isScanLine AST#member_expression#Righ... | initScanData() {
this.isScanLine = false;
this.isScanned = false;
this.scanResult = {} as ScanResults;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets#L280-L284 | 5d0a2fd0bbb2c521c8eec9ab2ad0ebcdbe6444be | gitee |
CongDuang/PlayHarmony.git | 674a0459e1b20db9de8c837dff6a8d1f06330e79 | entry/src/main/ets/utils/HttpUtil.ets | arkts | post | post 请求
@param url
@param data
@returns | post<Resp, Data>(url: string, data: Data): Promise<AxiosResponse<BaseResp<Resp>, Data>> {
return HttpUtil.axiosInstance!.post<Resp, AxiosResponse<BaseResp<Resp>, Data>, Data>(url, data)
} | AST#method_declaration#Left post AST#type_parameters#Left < AST#type_parameter#Left Resp AST#type_parameter#Right , AST#type_parameter#Left Data AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left url : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#... | post<Resp, Data>(url: string, data: Data): Promise<AxiosResponse<BaseResp<Resp>, Data>> {
return HttpUtil.axiosInstance!.post<Resp, AxiosResponse<BaseResp<Resp>, Data>, Data>(url, data)
} | https://github.com/CongDuang/PlayHarmony.git/blob/674a0459e1b20db9de8c837dff6a8d1f06330e79/entry/src/main/ets/utils/HttpUtil.ets#L58-L60 | 68a80ca083d06212d90c01b186ccd874d6886800 | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ArrayUtils.ets | arkts | Copyright (C) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default class ArrayUtils {
static copyOfRange(arr: number[], fromIndex: number, toIndex: number): number[] {
//需将copya的类型指定为any,这样才能够使其能够任意添加属性
var copya: number[];
//最关键的是注意 下面 当a中有方法时,json.parse(json.stringify(xx))是无效的
for (var i = 0; i < arr.length; i++) {
if (typeof arr[i] == 'functio... | AST#export_declaration#Left export default AST#class_declaration#Left class ArrayUtils AST#class_body#Left { AST#method_declaration#Left static copyOfRange 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_ty... | export default class ArrayUtils {
static copyOfRange(arr: number[], fromIndex: number, toIndex: number): number[] {
var copya: number[];
for (var i = 0; i < arr.length; i++) {
if (typeof arr[i] == 'function') {
return [];
} else {
copya[i] = JSON.parse(JSON.stringify(arr[... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ArrayUtils.ets#L16-L30 | ceb80415226a20bb6b30ddd16b3f91f8df696663 | gitee | |
XiangRui_FuZi/harmony-oscourse | da885f9a777a1eace7a07e1cd81137746687974b | class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets | arkts | pause | 暂停播放 | static async pause() {
await AudioRendererManager.audioRender?.pause()
} | AST#method_declaration#Left static async pause AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Lef... | static async pause() {
await AudioRendererManager.audioRender?.pause()
} | https://github.com/XiangRui_FuZi/harmony-oscourse/blob/da885f9a777a1eace7a07e1cd81137746687974b/class1/entry/src/main/ets/commons/utils/AudioRendererManager.ets#L77-L79 | 749565b271064cb87c9e06dff99e299e4c9f81a9 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/XComponentVideo.ets | arkts | init | 初始化AVPlayer | async init(): Promise<void> {
await this.release();
const context = getContext(this);
// 获取fdSrc用于注册AVPlayer
context.resourceManager.getRawFd(this.fileName).then(async (value: resourceManager.RawFileDescriptor) => {
this.avPlayer = await media.createAVPlayer();
this.isCreate = true;
aw... | AST#method_declaration#Left async init 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#R... | async init(): Promise<void> {
await this.release();
const context = getContext(this);
context.resourceManager.getRawFd(this.fileName).then(async (value: resourceManager.RawFileDescriptor) => {
this.avPlayer = await media.createAVPlayer();
this.isCreate = true;
await this.setSourceInfo... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mediafullscreen/src/main/ets/view/XComponentVideo.ets#L107-L122 | 4aa10578b32aed25b2d9ce057b2f538ae6e1b647 | gitee |
JackJiang2011/harmonychat.git | bca3f3e1ce54d763720510f99acf595a49e37879 | entry/src/main/ets/pages/utils/ToolKits.ets | arkts | getTimeSegmentStr | 将一个两位24小时时间的转换为上午、下午这样的描述。
@param hh24 两位的24小时制时间的小时部分
@return 如果成功转换则返回形如:“凌晨”、“上午”等,否则返回空字符串(不是null)
@since 3.1 | static getTimeSegmentStr(hh24: string): string {
let ret: string = '';
if (hh24 && hh24.length >= 2) {
try {
// 取出“小时”部分
let a = parseInt(hh24.substring(0, 2));
if (a >= 0 && a <= 6) {
ret = "凌晨";
} else if (a > 6 && a <= 12) {
ret = "上午";
} else... | AST#method_declaration#Left static getTimeSegmentStr AST#parameter_list#Left ( AST#parameter#Left hh24 : 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#prima... | static getTimeSegmentStr(hh24: string): string {
let ret: string = '';
if (hh24 && hh24.length >= 2) {
try {
let a = parseInt(hh24.substring(0, 2));
if (a >= 0 && a <= 6) {
ret = "凌晨";
} else if (a > 6 && a <= 12) {
ret = "上午";
} else if (a > 12... | https://github.com/JackJiang2011/harmonychat.git/blob/bca3f3e1ce54d763720510f99acf595a49e37879/entry/src/main/ets/pages/utils/ToolKits.ets#L305-L328 | ca8fbe142b853fdbf1d8d672843f9d912139fc6b | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/pages/SettingsPage.ets | arkts | showClearDataDialog | 显示清空数据确认对话框 | private showClearDataDialog(): void {
AlertDialog.show({
title: '清空所有数据',
message: '此操作将删除所有联系人、纪念日和祝福历史记录,且无法恢复。确定要继续吗?',
alignment: DialogAlignment.Center,
primaryButton: {
value: '取消',
action: () => {
// 取消操作
}
},
secondaryButton: {
va... | AST#method_declaration#Left private showClearDataDialog 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 ... | private showClearDataDialog(): void {
AlertDialog.show({
title: '清空所有数据',
message: '此操作将删除所有联系人、纪念日和祝福历史记录,且无法恢复。确定要继续吗?',
alignment: DialogAlignment.Center,
primaryButton: {
value: '取消',
action: () => {
}
},
secondaryButton: {
value: '确... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/pages/SettingsPage.ets#L106-L125 | f33ae7918f5ded09899d415765397ccbe62675ec | github |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets | arkts | equalTo | Compares value, xIndex and data of the entries. Returns true if entries
are equal in those points, false if not. Does not check by hash-code like
it's done by the "equals" method.
@param e
@return | public equalTo(e: EntryOhos): boolean {
if (!e) {
return false;
}
if (e.getData() != this.getData()) {
return false;
}
if (Math.abs(e.x - this.x) > Utils.FLOAT_EPSILON) {
return false;
}
if (Math.abs(e.getY() - this.getY()) >... | AST#method_declaration#Left public equalTo AST#parameter_list#Left ( AST#parameter#Left e : AST#type_annotation#Left AST#primary_type#Left EntryOhos 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#R... | public equalTo(e: EntryOhos): boolean {
if (!e) {
return false;
}
if (e.getData() != this.getData()) {
return false;
}
if (Math.abs(e.x - this.x) > Utils.FLOAT_EPSILON) {
return false;
}
if (Math.abs(e.getY() - this.getY()) >... | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/EntryOhos.ets#L69-L87 | 0d8cbb95bf716a8779a43dc709920d58a9c0ffb2 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets | arkts | put | Add data to the distributed key-value database.
@param key Store key name.
@param value Store value. | put(key: string, value: string): void {
if (this.kvStore === undefined) {
return;
}
this.kvStore.put(key, value).then(() => {
Logger.info('KvStoreModel', `kvStore.put key=${key} finished}`);
}).catch((error: Error) => {
Logger.error('KvStoreModel',
`kvStore.put key=${key} fail... | AST#method_declaration#Left put AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type... | put(key: string, value: string): void {
if (this.kvStore === undefined) {
return;
}
this.kvStore.put(key, value).then(() => {
Logger.info('KvStoreModel', `kvStore.put key=${key} finished}`);
}).catch((error: Error) => {
Logger.error('KvStoreModel',
`kvStore.put key=${key} fail... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets#L86-L97 | e7a2f3c47e108ce40cfb852fda0a879bbe986b47 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customview/src/main/ets/view/CustomView.ets | arkts | CustomView | 实现步骤:
1. 页签实现:添加onClick方法,记录点击的index,index变化后,改变页签颜色、字体大小,使用animateTo方法实现页签切换动画
2. 内容区实现:使用List,添加滑动手势来进行页面的切换,手势响应后,使用scrollToIndex方法来实现平滑的滑动到相应index | @Component
export struct CustomView
{
// 当前选中的页签index
@State currentIndex: number = 0;
// 颜色条的偏移量
@State transitionX: number = 0;
// 即将前往的页签index
@State wantGoIndex: number = 0;
// 创建Scroller对象
scroller: Scroller = new Scroller();
// 页签显示数据
private titleArray: Array<string> = ['候补预测', '在线换座', '余票挖掘'... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct CustomView AST#component_body#Left { // 当前选中的页签index AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right currentIndex : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#R... | @Component
export struct CustomView
{
@State currentIndex: number = 0;
@State transitionX: number = 0;
@State wantGoIndex: number = 0;
scroller: Scroller = new Scroller();
private titleArray: Array<string> = ['候补预测', '在线换座', '余票挖掘', '个人中心'];
build() {
Column() {
DiscoverTopV... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customview/src/main/ets/view/CustomView.ets#L23-L50 | 6a1728ee8de7b89478004c40fa9baaae99795423 | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/components/AxisBase.ets | arkts | getSpaceMax | Gets extra spacing for `axisMaximum` to be added to automatically calculated `axisMaximum` | public getSpaceMax(): number {
return this.mSpaceMax;
} | AST#method_declaration#Left public getSpaceMax AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_expre... | public getSpaceMax(): number {
return this.mSpaceMax;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/components/AxisBase.ets#L816-L818 | 353a862d769674975397b7dd12d36d80f9bd0e95 | gitee |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getAmountDayStr | 获取前几天日期或后几天日期,返回字符串
@param date
@param amount 进行加减操作的具体数值。 | static getAmountDayStr(date: number | string | Date, amount: number, format: string = DATE_FORMAT4): string {
return DateUtils.getFormatDateStr(DateUtils.getAmountDay(date, amount), format);
} | AST#method_declaration#Left static getAmountDayStr AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Date AST#primary_type#Right AST#union_type... | static getAmountDayStr(date: number | string | Date, amount: number, format: string = DATE_FORMAT4): string {
return DateUtils.getFormatDateStr(DateUtils.getAmountDay(date, amount), format);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L270-L272 | e52dd12a7c48bd39e997ca6f1c1bf6020c4745bc | gitee |
JHB11Hinson/mineMointorAPP.git | b6b853cf534021ac39e66c9b3a35113896a272b2 | entry/src/main/ets/view/dust/DustMonitorCard.ets | arkts | getPm25Color | 辅助函数:根据PM2.5值返回颜色 | private getPm25Color(pm25: number): string {
if (pm25 > 150) return '#FF4D4F'; // 红色:重度污染
if (pm25 > 75) return '#FAAD14'; // 黄色:中度污染
if (pm25 > 35) return '#FADB14'; // 浅黄色:轻度污染
return '#52C41A'; // 绿色:良好
} | AST#method_declaration#Left private getPm25Color AST#parameter_list#Left ( AST#parameter#Left pm25 : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_t... | private getPm25Color(pm25: number): string {
if (pm25 > 150) return '#FF4D4F';
if (pm25 > 75) return '#FAAD14';
if (pm25 > 35) return '#FADB14';
return '#52C41A';
} | https://github.com/JHB11Hinson/mineMointorAPP.git/blob/b6b853cf534021ac39e66c9b3a35113896a272b2/entry/src/main/ets/view/dust/DustMonitorCard.ets#L147-L152 | b2b61028c3b22f61a262e6ff28a7c6cc8c860571 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets | arkts | getData | 获取指定索引数据。
@param {number} index - 索引值。
@returns {CustomDataType} 返回指定索引数据。 | public getData(index: number): CustomDataType {
return this.originDataArray[index];
} | AST#method_declaration#Left public getData AST#parameter_list#Left ( AST#parameter#Left index : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left CustomDataType AST#primar... | public getData(index: number): CustomDataType {
return this.originDataArray[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/secondarylinkage/src/main/ets/pages/DataType.ets#L63-L65 | 41ed4c113911c4d499ba7d3ee8dac952acbb511f | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/model/src/main/ets/entity/User.ets | arkts | fromResponse | 从接口响应构建安全的用户对象
@param {Partial<User>} data - 新的用户数据
@returns {User} 用户对象 | static fromResponse(data: Partial<User>): User {
return new User(data);
} | AST#method_declaration#Left static fromResponse AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Partial AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left User AST#primary_type#Right AST#type_annotation#Right > AST#type_argum... | static fromResponse(data: Partial<User>): User {
return new User(data);
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/model/src/main/ets/entity/User.ets#L77-L79 | 6d1e6592de13d140a1e7a319d4e83bc501321ce4 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CalendarViewModel.ets | arkts | lazy page number | export interface ScrollPage {
next: boolean;
direction?: Axis;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ScrollPage AST#object_type#Left { AST#type_member#Left next : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left direction ? : AST#type_annotation... | export interface ScrollPage {
next: boolean;
direction?: Axis;
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ExcellentCase/Healthy_life/entry/src/main/ets/viewmodel/CalendarViewModel.ets#L24-L27 | dcfc5de18b5870bf54e56fe6ad595e7cff224340 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets | arkts | 读取文件内容 | export function readFile(fileName: string): string {
let file = fs.openSync(filesDir + '/' + fileName + '.txt', fs.OpenMode.READ_WRITE);
// 创建一个大小为1024字节的ArrayBuffer对象,用于存储从文件中读取的数据
let arrayBuffer = new ArrayBuffer(1024);
let readOptions: ReadOptions = {
offset: 0, // 从文件的开头开始读取
length: arrayBuffer.byt... | AST#export_declaration#Left export AST#function_declaration#Left function readFile AST#parameter_list#Left ( AST#parameter#Left fileName : 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#... | export function readFile(fileName: string): string {
let file = fs.openSync(filesDir + '/' + fileName + '.txt', fs.OpenMode.READ_WRITE);
let arrayBuffer = new ArrayBuffer(1024);
let readOptions: ReadOptions = {
offset: 0,
length: arrayBuffer.byteLength
};
let readLen = fs.readSync(file.fd, arrayBu... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets#L69-L84 | 6fcc71403d22b3cc318b26098e21f27f4f20e1fa | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/drag/DefaultDrag.ets | arkts | PreDragChange | [End generate_pix_map] 长按50ms时提前准备自定义截图的pixmap | private PreDragChange(preDragStatus: PreDragStatus): void {
if (preDragStatus == PreDragStatus.ACTION_DETECTING_STATUS) {
this.getComponentSnapshot();
}
} | AST#method_declaration#Left private PreDragChange AST#parameter_list#Left ( AST#parameter#Left preDragStatus : AST#type_annotation#Left AST#primary_type#Left PreDragStatus AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left voi... | private PreDragChange(preDragStatus: PreDragStatus): void {
if (preDragStatus == PreDragStatus.ACTION_DETECTING_STATUS) {
this.getComponentSnapshot();
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/EventProject/entry/src/main/ets/pages/drag/DefaultDrag.ets#L90-L94 | 0a0a45d7d8bbc3a4ee453b7c9939c4d4917ff671 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/common/routermodule/src/main/ets/model/AppRouterInfo.ets | arkts | 路由信息 | export interface AppRouterInfo {
name: string;
pageModule: string;
registerFunction?: string;
pageSourceFile?: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AppRouterInfo AST#object_type#Left { AST#type_member#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left pageModule : AST#type_annotatio... | export interface AppRouterInfo {
name: string;
pageModule: string;
registerFunction?: string;
pageSourceFile?: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/common/routermodule/src/main/ets/model/AppRouterInfo.ets#L16-L21 | c201e4e55e1cfe4540e3a8e80104bf13cfdba089 | gitee | |
conrad_sheeran/TickAuth | 8ef852e12999d15cf70394cdab82d08ac5843143 | features/homepage/src/main/ets/common/Constants.ets | arkts | Copyright (c) 2024 Yang He
TickAuth is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be... | export class Constants {
static readonly DOMAIN: number = 0x00201;
static readonly SECRET_FILE_DIR: string = "/secret.json";
static readonly HOMEPAGE_SIZE: string = "100%";
static readonly TOTPVIEW_LIST_SIZE: string = "100%";
static readonly TOTPVIEW_LIST_SPACE: number = 12;
static readonly TOTPVIEW_LI... | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { AST#property_declaration#Left static readonly DOMAIN : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 0x00201 AST#expression#Right ; AST#prope... | export class Constants {
static readonly DOMAIN: number = 0x00201;
static readonly SECRET_FILE_DIR: string = "/secret.json";
static readonly HOMEPAGE_SIZE: string = "100%";
static readonly TOTPVIEW_LIST_SIZE: string = "100%";
static readonly TOTPVIEW_LIST_SPACE: number = 12;
static readonly TOTPVIEW_LI... | https://github.com/conrad_sheeran/TickAuth/blob/8ef852e12999d15cf70394cdab82d08ac5843143/features/homepage/src/main/ets/common/Constants.ets#L18-L48 | 2f92735409173bd4496fc7662b44ea2bf41d2113 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/mapthumbtack/src/main/ets/components/ThumbTackComponent.ets | arkts | createVerticalPostAnimation | 创建大头针针杆动画 | createVerticalPostAnimation() {
// 创建针杆位置偏移动画
this.postOffsetAnimator = animator.create({
// 100, 大头针针尖位置偏移动画持续时间100ms
duration: 100,
easing: 'fast-out-slow-in',
// 200, 动画延时200ms执行
delay: 200,
fill: 'forwards',
direction: 'alternate',
iterations: 2,
begin: ... | AST#method_declaration#Left createVerticalPostAnimation AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { // 创建针杆位置偏移动画 AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . postOffs... | createVerticalPostAnimation() {
this.postOffsetAnimator = animator.create({
duration: 100,
easing: 'fast-out-slow-in',
delay: 200,
fill: 'forwards',
direction: 'alternate',
iterations: 2,
begin: 0,
end: this.thumbTackWidth * ThumbTackCommonConstants... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/mapthumbtack/src/main/ets/components/ThumbTackComponent.ets#L56-L111 | e96d8faa89647d3c6be5dedc2ba64af925f351e1 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/entity/constraint.ets | arkts | 2025/01/05 14 | export const DATE_FORMAT10: string = "yyyy/MM/dd"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left DATE_FORMAT10 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "yyyy/MM/dd" AST#expression#Right AST#variable_declarator#Right ; AST#variable_... | export const DATE_FORMAT10: string = "yyyy/MM/dd"; | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/entity/constraint.ets#L22-L22 | 9316e32b3d20f10157ce2fc4152b998d8afaa339 | gitee | |
yycy134679/FoodieHarmony.git | e6971f0a8f7574ae278d02eb5c057e57e667dab5 | entry/src/main/ets/view/common/index.ets | arkts | MerchantCard | 通用组件导出 | export { MerchantCard } from './MerchantCard'; | AST#export_declaration#Left export { MerchantCard } from './MerchantCard' ; AST#export_declaration#Right | export { MerchantCard } from './MerchantCard'; | https://github.com/yycy134679/FoodieHarmony.git/blob/e6971f0a8f7574ae278d02eb5c057e57e667dab5/entry/src/main/ets/view/common/index.ets#L5-L5 | 0325a6bebc68e17e9aded972c67ed81c4ad8f1b8 | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | 农历计算系统 v3.0
基于权威天文数据和算法实现
支持1900-2100年完整农历公历转换
包含传统节日、闰月处理、二十四节气
农历年份配置接口 | export interface LunarYearConfig {
year: number;
months: number[]; // 各月天数
leapMonth: number; // 闰月月份,0表示无闰月
leapMonthDays: number; // 闰月天数
springFestivalDate: string; // 春节公历日期 (MM-DD格式)
totalDays: number; // 该农历年总天数
} | AST#export_declaration#Left export AST#interface_declaration#Left interface LunarYearConfig AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left months : AST#type_annotation#... | export interface LunarYearConfig {
year: number;
months: number[];
leapMonth: number;
leapMonthDays: number;
springFestivalDate: string;
totalDays: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L11-L18 | 0a5b620be7042a92e1b3dd9477f3f7519905d7d8 | github | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.app.appstartup.StartupTask.d.ets | arkts | onDependencyCompleted | Called when specific dependent task complete.
@param { string } dependency - Indicates name of specific dependent startup task.
@param { Object } result - Indicates result of specific dependent startup task.
@syscap SystemCapability.Ability.AppStartup
@stagemodelonly
@since 12 | onDependencyCompleted?(dependency: string, result: Object): void; | AST#method_declaration#Left onDependencyCompleted AST#ERROR#Left ? AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left dependency : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left result : AST#type_annotation#Left A... | onDependencyCompleted?(dependency: string, result: Object): void; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.app.appstartup.StartupTask.d.ets#L41-L41 | c9aa51675f0fa8179a1cb91336406484e6fd9b4b | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets | arkts | Defines the Web's request/response header.
@typedef WebHeader
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface WebHeader {
/**
* Gets the key of the request/response header.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
headerKey: string;
/**
* Gets the value of the request/response header.
*
... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface WebHeader AST#object_type#Left { /**
* Gets the key of the request/response header.
*
* @type { string }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since ... | export declare interface WebHeader {
headerKey: string;
headerValue: string;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.atomicservice.AtomicServiceWeb.d.ets#L447-L466 | 8d33adb93231f8904f0e2fdf9b0300eed491e4aa | github | |
openharmony/developtools_profiler | 73d26bb5acfcafb2b1f4f94ead5640241d1e5f73 | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets | arkts | getDataSets | Returns all DataSet objects this ChartData object holds.
@return | public getDataSets(): JArrayList<T> {
return this.mDataSets;
} | AST#method_declaration#Left public getDataSets AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left JArrayList AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right > AST#type_arg... | public getDataSets(): JArrayList<T> {
return this.mDataSets;
} | https://github.com/openharmony/developtools_profiler/blob/73d26bb5acfcafb2b1f4f94ead5640241d1e5f73/host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ChartData.ets#L270-L272 | 3e46aa70b55f8c170b3c0d7229e07aaa2d0d3c2d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/ai/GreetingGenerationService.ets | arkts | generateMultipleGreetings | 批量生成多个祝福语选项 | async generateMultipleGreetings(
params: GreetingGenerateParams,
count: number = 3
): Promise<GreetingGenerationResult> {
const startTime = Date.now();
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Generating ${count} greeting options for ${params.contact.name}`);
cons... | AST#method_declaration#Left async generateMultipleGreetings AST#parameter_list#Left ( AST#parameter#Left params : AST#type_annotation#Left AST#primary_type#Left GreetingGenerateParams AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left count : AST#type_annotation#Left AST#primary_t... | async generateMultipleGreetings(
params: GreetingGenerateParams,
count: number = 3
): Promise<GreetingGenerationResult> {
const startTime = Date.now();
try {
hilog.info(LogConstants.DOMAIN_APP, LogConstants.TAG_APP, `Generating ${count} greeting options for ${params.contact.name}`);
cons... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/ai/GreetingGenerationService.ets#L187-L227 | 83f30c13b3c9d08b54171cf8fcf30425382d8954 | github |
openharmony-tpc-incubate/photo-deal-demo | 01382ce30b1785f8fc8bc14f6b94f0a670a5b50b | library/src/main/ets/model/ImageEditModel.ets | arkts | 马赛克记录数据 | export class MosaicData {
/**
* 马赛克路径
*/
path: Path2D
/**
* 线宽
*/
lineWidth: number
/**
* 剩余记录数据
*/
leftTotalPaths?: MosaicData[]
constructor | AST#export_declaration#Left export AST#ERROR#Left class MosaicData { /**
* 马赛克路径
*/ path AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Path2D AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right /**
* 线宽
*/ AST#ERROR#Left l in eWidth AST#ERROR#Right : AST#primary_type#Left AST#... | export class MosaicData {
path: Path2D
lineWidth: number
leftTotalPaths?: MosaicData[]
constructor | https://github.com/openharmony-tpc-incubate/photo-deal-demo/blob/01382ce30b1785f8fc8bc14f6b94f0a670a5b50b/library/src/main/ets/model/ImageEditModel.ets#L94-L108 | 4fb2739f521a4f77d5f121c2d6aa7cd94a535e82 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets | arkts | generateSM4Key | 生成SM4的对称密钥
@param resultCoding 返回结果编码方式(hex/base64)-默认不传为base64格式
@returns SM4密钥 | static generateSM4Key(resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.generateSymKey('SM4_128', resultCoding);
} | AST#method_declaration#Left static generateSM4Key AST#parameter_list#Left ( AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left buffer . BufferEncoding AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'base64' AST#expres... | static generateSM4Key(resultCoding: buffer.BufferEncoding = 'base64'): string {
return CryptoSyncUtil.generateSymKey('SM4_128', resultCoding);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto/src/main/ets/crypto/encryption/SM4Sync.ets#L32-L34 | 01f83ba6d435f0fd0c6913d731eb40458ac8ccf6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/chatwithexpression/src/main/ets/model/Emoji.ets | arkts | 表情所表示的含义 | constructor(imgSrc: Resource, meaning: string) {
this.imgSrc = imgSrc;
this.meaning = meaning;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left imgSrc : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left meaning : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | constructor(imgSrc: Resource, meaning: string) {
this.imgSrc = imgSrc;
this.meaning = meaning;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/chatwithexpression/src/main/ets/model/Emoji.ets#L23-L26 | 93366c71451176ec9e7597ec44a4dcab6dd2e61e | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Speech/Wave/WaveView.ets | arkts | ===================== UI构建 ===================== | build() {
Column() {
Canvas(this.context) // 创建画布
.width('100%') // 宽度100%
.height(250) // 固定高度250vp
.backgroundColor('transparent') // 透明背景
.onReady(() => { // 画布准备就绪回调
const width = this.context.width; // 获取画布实际宽度
const height = this.context.he... | 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 Canvas ( AST#expression#Left AST#member_expression#Left... | build() {
Column() {
Canvas(this.context)
.width('100%')
.height(250)
.backgroundColor('transparent')
.onReady(() => {
const width = this.context.width;
const height = this.context.height;
this.startWaveAnimation(width, height);... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Speech/Wave/WaveView.ets#L28-L41 | 99e8a383addfb1328fb2cdd1076001ed6b19ad34 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/StrUtil.ets | arkts | notEqual | 判断两个传入的数值或者是字符串是否不相等
@param source
@param target
@returns | static notEqual(source: string | number, target: string | number): boolean {
return false === StrUtil.equal(source, target);
} | AST#method_declaration#Left static notEqual AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left number AST#primary_type#Right AST#union_type#Right AST#type_annotation#Right AST#parameter#Right , AS... | static notEqual(source: string | number, target: string | number): boolean {
return false === StrUtil.equal(source, target);
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/StrUtil.ets#L232-L234 | 0a0057626c15cfed5a9bf6114d1602f8a5348c12 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.uiExtensionHost.d.ets | arkts | Transition Controller
@interface UIExtensionHostWindowProxy
@syscap SystemCapability.ArkUI.ArkUI.Full
@systemapi
@since 11 | export interface UIExtensionHostWindowProxy {
/**
* Get the avoid area
*
* @param { window.AvoidAreaType } type - Type of the area
* @returns { window.AvoidArea } Area where the window cannot be displayed.
* @throws { BusinessError } 401 - Parameter error.
* @syscap SystemCapability.Ar... | AST#export_declaration#Left export AST#interface_declaration#Left interface UIExtensionHostWindowProxy AST#object_type#Left { /**
* Get the avoid area
*
* @param { window.AvoidAreaType } type - Type of the area
* @returns { window.AvoidArea } Area where the window cannot be displayed.
* @throws... | export interface UIExtensionHostWindowProxy {
getWindowAvoidArea(type: window.AvoidAreaType): window.AvoidArea;
on<T>(type: string, callback: Callback<T>):void;
off<T>(type: string, callback?: Callback<T>): void;
properties: UIExtensionHos... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.uiExtensionHost.d.ets#L68-L267 | 0ec0ae512bd545df55dbbd3701e340ef598578a3 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 月度分布数据接口 | export interface MonthlyDistribution {
month: number;
count: number;
percentage: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface MonthlyDistribution AST#object_type#Left { AST#type_member#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left count : AST#type_annotat... | export interface MonthlyDistribution {
month: number;
count: number;
percentage: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L15-L19 | f259a57e4183a780def34514b5ba45815e7bb45d | github | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Weather/common/src/main/ets/model/FormDate.ets | arkts | formMonthDay | 月+日 | formMonthDay(goal?: string) {
let date = goal ? new Date(goal) : new Date();
return `${this.fill(date.getMonth() + 1)}/${date.getDate()}`;
} | AST#method_declaration#Left formMonthDay AST#parameter_list#Left ( AST#parameter#Left goal ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left... | formMonthDay(goal?: string) {
let date = goal ? new Date(goal) : new Date();
return `${this.fill(date.getMonth() + 1)}/${date.getDate()}`;
} | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/common/src/main/ets/model/FormDate.ets#L24-L27 | 097e017f6d4e00ea53ec470b78b5791745b63132 | gitee |
gracienewd/openharmony-App-YunmoAi.git | 181952ab00aab5025a81b7b3a6b88d2a5258c76a | entry/src/main/ets/pages/home/index.ets | arkts | _notice | 3.通知公告 | @Builder
_notice() {
Swiper() {
Row() {
Image($r("app.media.announce")).height(20).margin({ right: 8 })
Text("注册新账户立即赠送5Credits")
.fontSize(14)
.fontColor(0xFFFFFF)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right _notice 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 Swiper ( ) AST#container_content_body#Left { AST#arkts_ui_element#... | @Builder
_notice() {
Swiper() {
Row() {
Image($r("app.media.announce")).height(20).margin({ right: 8 })
Text("注册新账户立即赠送5Credits")
.fontSize(14)
.fontColor(0xFFFFFF)
.alignRules({
center: { anchor: '__container__', align: VerticalAlign.Center },
... | https://github.com/gracienewd/openharmony-App-YunmoAi.git/blob/181952ab00aab5025a81b7b3a6b88d2a5258c76a/entry/src/main/ets/pages/home/index.ets#L83-L118 | 799b1c387cfef8b1aa68f1556d9ed20abcb720b5 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Solutions/InputMethod/KikaInput/entry/src/main/ets/model/KeyboardKeyData.ets | arkts | Copyright (c) 2022-2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... | export enum MenuType {
NORMAL = 0,
NUMBER = 1,
SPECIAL = 2
} | AST#export_declaration#Left export AST#enum_declaration#Left enum MenuType AST#enum_body#Left { AST#enum_member#Left NORMAL = AST#expression#Left 0 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left NUMBER = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SPECIAL =... | export enum MenuType {
NORMAL = 0,
NUMBER = 1,
SPECIAL = 2
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Solutions/InputMethod/KikaInput/entry/src/main/ets/model/KeyboardKeyData.ets#L16-L20 | a7f6c1d8a06f52644da7e53c19cbfc71fce4a053 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/analytics/AnalyticsService.ets | arkts | 星座分布数据接口 | export interface ZodiacDistribution {
zodiac: string;
count: number;
percentage: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ZodiacDistribution AST#object_type#Left { AST#type_member#Left zodiac : 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_annotat... | export interface ZodiacDistribution {
zodiac: string;
count: number;
percentage: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/analytics/AnalyticsService.ets#L36-L40 | be1439f0fb84246523b0093ba255a5a79aa04be1 | github | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/viewmodel/AddressItem.ets | arkts | AddressItem | Landmarks. | @Observed
export class AddressItem {
name?: Resource;
icon?: Resource;
locations: Array<Location> = [];
textColor?: Resource;
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class AddressItem AST#class_body#Left { AST#property_declaration#Left name ? : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right AST#prop... | @Observed
export class AddressItem {
name?: Resource;
icon?: Resource;
locations: Array<Location> = [];
textColor?: Resource;
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/viewmodel/AddressItem.ets#L19-L25 | f68024c1be0545bbef0a8dba9a498d2dac0ae0e9 | github |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | core/ui/src/main/ets/component/modal/DictSelectModal.ets | arkts | DictSelectModal | @file 字典选择弹窗组件
@author Joker.X | @ComponentV2
export struct DictSelectModal {
/**
* 是否显示弹窗
*/
@Param
@Require
visible: boolean = false;
/**
* 弹窗标题
*/
@Param
title: ResourceStr = $r("app.string.please_select");
/**
* 关闭回调
*/
@Param
onDismiss: () => void = () => {
};
/**
* 网络请求状态
*/
@Param
uiState: Bas... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct DictSelectModal AST#component_body#Left { /**
* 是否显示弹窗
*/ AST#property_declaration#Left AST#decorator#Left @ Param AST#decorator#Right AST#decorator#Left @ Require AST#decorator#Right visible : AST#type_annota... | @ComponentV2
export struct DictSelectModal {
@Param
@Require
visible: boolean = false;
@Param
title: ResourceStr = $r("app.string.please_select");
@Param
onDismiss: () => void = () => {
};
@Param
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
@Param
dictList: DictItem[]... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/core/ui/src/main/ets/component/modal/DictSelectModal.ets#L16-L231 | 76144ed17da983bbcaff812eb31f527c844f7ff3 | github |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.deviceInfo.d.ets | arkts | get | Obtains the version ID by a string.
@syscap SystemCapability.Startup.SystemInfo
@crossplatform
@since 20
@arkts 1.2 | static get versionId(): string; | AST#method_declaration#Left static get AST#ERROR#Left versionId AST#ERROR#Right 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#method_declaration#Right | static get versionId(): string; | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.deviceInfo.d.ets#L316-L316 | 45fbc50e453266c9afa3446b109b8e58477b441d | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/DateUtils.ets | arkts | getRelativeTime | 获取相对时间描述
@param date 目标日期
@param baseDate 基准日期,默认为现在
@returns 相对时间描述 | static getRelativeTime(date: Date, baseDate: Date = new Date()): string {
const diff = DateUtils.daysBetween(baseDate, date);
if (diff === 0) {
return '今天';
} else if (diff === 1) {
return '明天';
} else if (diff === -1) {
return '昨天';
} else if (diff > 0 && diff <= 7) {
r... | AST#method_declaration#Left static getRelativeTime AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left baseDate : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_... | static getRelativeTime(date: Date, baseDate: Date = new Date()): string {
const diff = DateUtils.daysBetween(baseDate, date);
if (diff === 0) {
return '今天';
} else if (diff === 1) {
return '明天';
} else if (diff === -1) {
return '昨天';
} else if (diff > 0 && diff <= 7) {
r... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/DateUtils.ets#L226-L244 | c9b2a583352d15a439daab324de083b7e746be06 | github |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/StringUtils.ets | arkts | toStr | 格式化字符串
@param source
@param defaultValue
@returns | static toStr(source: string | null | undefined, defaultValue = "") {
if (source == null || source == undefined) {
return defaultValue;
}
return String(source);
} | AST#method_declaration#Left static toStr AST#parameter_list#Left ( AST#parameter#Left source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right AST#union_type#Righ... | static toStr(source: string | null | undefined, defaultValue = "") {
if (source == null || source == undefined) {
return defaultValue;
}
return String(source);
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/StringUtils.ets#L88-L93 | 1f4d1112290511c452606c9cb7eae5e1fadb8e3d | gitee |
openharmony/xts_acts | 5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686 | arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/NavRouterView.ets | arkts | NavRouterView | Copyright (c) 2023 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Component
export struct NavRouterView {
@State isActive: boolean = false;
@State indexDev: number = 0;
@Link _position: Position;
private componentKey: string = '';
build() {
NavRouter() {
Row() {
Image($r('app.media.icon'))
.width(30)
.height(30)
.borderRadiu... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct NavRouterView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ State AST#decorator#Right isActive : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_an... | @Component
export struct NavRouterView {
@State isActive: boolean = false;
@State indexDev: number = 0;
@Link _position: Position;
private componentKey: string = '';
build() {
NavRouter() {
Row() {
Image($r('app.media.icon'))
.width(30)
.height(30)
.borderRadiu... | https://github.com/openharmony/xts_acts/blob/5eb33396ca0ffafd9e5d0ba4b5dedfde44aff686/arkui/ace_ets_component_common_attrss/ace_ets_component_common_attrss_position/entry/src/main/ets/MainAbility/view/position/NavRouterView.ets#L16-L62 | fdb4293966c81bd0351096753550faae028dc9f8 | gitee |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/search/src/main/ets/default/page/resultComponent.ets | arkts | result component | @Component
export default struct ResultComponent {
@Link highlightKeyword: string
@State icon: string = ''
@State data: SearchData = new SearchData()
@State columnSpace: string = '2vp';
private TEXT_TYPE_NORMAL = 1
private TEXT_TYPE_KEYWORD = 2
@Builder
HighlightText(
spans: Info[],
fontColor: ... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default AST#ERROR#Left struct ResultComponent { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right highlightKeyword : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#... | @Component
export default struct ResultComponent {
@Link highlightKeyword: string
@State icon: string = ''
@State data: SearchData = new SearchData()
@State columnSpace: string = '2vp';
private TEXT_TYPE_NORMAL = 1
private TEXT_TYPE_KEYWORD = 2
@Builder
HighlightText(
spans: Info[],
fontColor: ... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/search/src/main/ets/default/page/resultComponent.ets#L34-L69 | 208706815588a481cb0219757fdaa0939e49922d | gitee | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets | arkts | Size | Called when you check how much data is stored.
@since 7 | static Size(): number {
return AppStorage.size()
} | AST#method_declaration#Left static Size 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#call_expression#Lef... | static Size(): number {
return AppStorage.size()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/frameworks/bridge/arkts_frontend/koala_mirror/arkoala-arkts/arkui/src/Storage.ets#L246-L248 | 28a3c910f9458e6ce8d5fd339db882adc15a696b | gitee |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/util/src/main/ets/storage/PreferencesUtil.ets | arkts | set | 写入键值并立即 flush 持久化
@param {string} key 键
@param {preferences.ValueType} value 值(支持 string/number/boolean)
@returns {Promise<void>} Promise<void> | async set(key: string, value: preferences.ValueType): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.put(key, value);
await prefs.flush();
} catch (error) {
throw this.wrapError(error, `写入键 ${key} 失败`);
}
} | AST#method_declaration#Left async set AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left preferen... | async set(key: string, value: preferences.ValueType): Promise<void> {
try {
const prefs: preferences.Preferences = await this.getPrefs();
await prefs.put(key, value);
await prefs.flush();
} catch (error) {
throw this.wrapError(error, `写入键 ${key} 失败`);
}
} | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/util/src/main/ets/storage/PreferencesUtil.ets#L45-L53 | 945e465d02249444e1b4cb5e1686a36017e13e8b | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/designsystem/src/main/ets/constants/LayoutPercent.ets | arkts | 75% 百分比 | export const P75: string = "75%"; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left P75 : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left "75%" AST#expression#Right AST#variable_declarator#Right ; AST#variable_declaration#Right... | export const P75: string = "75%"; | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/designsystem/src/main/ets/constants/LayoutPercent.ets#L84-L84 | ccb54b220ef34eace70da22c4b93742630f9e213 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/ObservedArray.ets | arkts | ObservedArray | Wraps an array as an observed object | @Observed
export class ObservedArray<T> extends Array<T> {
constructor(args?: T[]) {
if (args instanceof Array) {
super(...args);
} else {
super();
}
}
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Observed AST#decorator#Right export class ObservedArray AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right extends AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_argumen... | @Observed
export class ObservedArray<T> extends Array<T> {
constructor(args?: T[]) {
if (args instanceof Array) {
super(...args);
} else {
super();
}
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/statusbaranimation/src/main/ets/model/ObservedArray.ets#L19-L28 | b4608dd611724eceac78a8651d99109e85c7de8b | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | get | / 获取已经学习的单字(未删除)状态的wordIds
获取已经学习的单字(未删除)状态的wordIds
每个字只记录一次(即:只要是学习或复习过的字,不管复习过多少次,都只算一次已学习记录)
by ko 2021.03.20
@param learns 当前plan的学习记录数组
@returns 已学习的字列表 | get learnedWordIds(): number[] | null {
// 获取所有learn对象的wordId,并过滤掉null
const wordIds: number[] = this.learns.map(l => l.wordId).filter(l => l !== null) as number[];
// 去除重复元素
return ArrayUtils.removedDuplicates(wordIds);
} | AST#method_declaration#Left get AST#ERROR#Left learnedWordIds AST#ERROR#Right AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right | AST#primary_type#Left null AST#primary_type... | get learnedWordIds(): number[] | null {
const wordIds: number[] = this.learns.map(l => l.wordId).filter(l => l !== null) as number[];
return ArrayUtils.removedDuplicates(wordIds);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L239-L245 | d4585ff109229d32318372dcd97f52665163f3c2 | github |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/DateUtil.ets | arkts | formatTimestamp | 将时间戳(毫秒)格式化为日期时间字符串
默认格式:yyyy/MM/dd HH:mm
@param milliseconds 13 位毫秒时间戳
@returns 如:2024/12/20 14:30:45 | static formatTimestamp(milliseconds: number): string {
if (milliseconds <= 0) {
return '';
}
const date: Date = new Date(milliseconds);
const year: number = date.getFullYear();
const month: number = date.getMonth() + 1; // 0-11 → 1-12
const day: number = date.getDate();
const hours: nu... | AST#method_declaration#Left static formatTimestamp AST#parameter_list#Left ( AST#parameter#Left milliseconds : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST... | static formatTimestamp(milliseconds: number): string {
if (milliseconds <= 0) {
return '';
}
const date: Date = new Date(milliseconds);
const year: number = date.getFullYear();
const month: number = date.getMonth() + 1;
const day: number = date.getDate();
const hours: number = date.ge... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/DateUtil.ets#L11-L24 | b2510ccd8072161ebbf5038d1d329c7a0b307725 | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | getParam | @deprecated
@see {ZRouter.getInstance().getParam}
@returns | public static getParam(): ObjectOrNull {
return ZRouter.getRouterMgr().getParam()
} | AST#method_declaration#Left public static getParam AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ObjectOrNull AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#ca... | public static getParam(): ObjectOrNull {
return ZRouter.getRouterMgr().getParam()
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L533-L535 | 6b95cabde311d8a3df457ac4eae5c7879b6528b2 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/user/src/main/ets/viewmodel/ProfileViewModel.ets | arkts | onLogoutClick | 退出登录点击
@returns {void} 无返回值 | onLogoutClick(): void {
this.requestLogout();
} | AST#method_declaration#Left onLogoutClick 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#expression... | onLogoutClick(): void {
this.requestLogout();
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/user/src/main/ets/viewmodel/ProfileViewModel.ets#L42-L44 | 5603e11aeb560b3e74e21e858c0ebf8ead6def48 | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/WebComponent/entry/src/main/ets/common/Constant.ets | arkts | Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export const WEB_PAGE_URI: string = 'pages/WebPage'; | AST#export_declaration#Left export AST#variable_declaration#Left const AST#variable_declarator#Left WEB_PAGE_URI : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left 'pages/WebPage' AST#expression#Right AST#variable_declarator#Right ; AST#variabl... | export const WEB_PAGE_URI: string = 'pages/WebPage'; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/WebComponent/entry/src/main/ets/common/Constant.ets#L16-L16 | ca3f8fe73c581f6b000c07550c0e7ba86adeb542 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/ImageUtil.ets | arkts | createPixelMapFromResource | 从Resource创造PixelMap | static async createPixelMapFromResource(resource: Resource, context: Context): Promise<image.PixelMap> {
let colorsBuffer = await ImageUtils.getResourceArrayBufferFromResourceManager(resource, context);
let imageSource: image.ImageSource = image.createImageSource(colorsBuffer);
return ImageUtils.createPixel... | AST#method_declaration#Left static async createPixelMapFromResource AST#parameter_list#Left ( AST#parameter#Left resource : AST#type_annotation#Left AST#primary_type#Left Resource AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left context : AST#type_annotation#Left AST#primary_typ... | static async createPixelMapFromResource(resource: Resource, context: Context): Promise<image.PixelMap> {
let colorsBuffer = await ImageUtils.getResourceArrayBufferFromResourceManager(resource, context);
let imageSource: image.ImageSource = image.createImageSource(colorsBuffer);
return ImageUtils.createPixel... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/Performance/PerformanceLibrary/feature/ThreadDataTransfer/src/main/ets/utils/ImageUtil.ets#L23-L27 | f86dd19d47e6cfb80168be40ff620cad5b4b6521 | gitee |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | NEXT/XiaoXunAI/entry/src/main/ets/model/TongYiResponse.ets | arkts | 通义千问大语言模型请求响应数据结构类(阿里云)
@author 却家庭
@version 1.0
@date 2024.10.10 | export class TongYiResponse {
/**
* 系统生成的标志本次调用的id
*/
request_id?: string;
/**
* 调用结果信息对象
*/
output?: TongYiResp_output;
/**
* 计量信息对象
*/
usage?: TongYiResp_usage;
} | AST#export_declaration#Left export AST#class_declaration#Left class TongYiResponse AST#class_body#Left { /**
* 系统生成的标志本次调用的id
*/ AST#property_declaration#Left request_id ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right ; AST#property_declaration#Right /**
... | export class TongYiResponse {
request_id?: string;
output?: TongYiResp_output;
usage?: TongYiResp_usage;
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/NEXT/XiaoXunAI/entry/src/main/ets/model/TongYiResponse.ets#L8-L23 | 0781f8fa9087f3697f6db8afb7f9135983a2b327 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/todo/TodoService.ets | arkts | generateId | 生成唯一ID | private generateId(): string {
return `todo_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
} | AST#method_declaration#Left private generateId 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_lit... | private generateId(): string {
return `todo_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/todo/TodoService.ets#L127-L129 | 8ed3e242879174de04ef882eed1e033877ea4abe | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/entry/src/main/ets/managers/SharedValuesBucket.ets | arkts | [Start define_data_format] | export interface IValueBucket {
id: number;
name: string;
age: number;
salary: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface IValueBucket AST#object_type#Left { AST#type_member#Left id : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left name : AST#type_annotation#Left AS... | export interface IValueBucket {
id: number;
name: string;
age: number;
salary: number;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTsConcurrent/ApplicationMultithreadingDevelopment/PracticalCases/entry/src/main/ets/managers/SharedValuesBucket.ets#L17-L22 | 5f459e1ee01e14e192bbce089063da55d2337a73 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets | arkts | calcImageDefaultSize | 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小
@param imageWHRatio:图片原始宽高比
@param size:窗口大小{with:number,height:number}
@returns image.Size | calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size {
let width = 0
let height = 0;
if (imageWHRatio > size.width / size.height) {
// 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示
width = size.width;
height = size.width / imageWHRatio;
} else {
height = size.height;
widt... | AST#method_declaration#Left calcImageDefaultSize AST#parameter_list#Left ( AST#parameter#Left imageWHRatio : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left size : AST#type_annotation#Left AST#primary_type#Left AST#qualified... | calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size {
let width = 0
let height = 0;
if (imageWHRatio > size.width / size.height) {
width = size.width;
height = size.width / imageWHRatio;
} else {
height = size.height;
width = size.height * imageWHRati... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/imageviewer/src/main/ets/view/ImageItemView.ets#L50-L62 | 169eb1497e55c190623d07d7934dfbd1c85109af | gitee |
ThePivotPoint/ArkTS-LSP-Server-Plugin.git | 6231773905435f000d00d94b26504433082ba40b | packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets | arkts | Defines chip symbolglyph options.
@interface ChipSymbolGlyphOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@crossplatform
@atomicservice
@since 12 | export interface ChipSymbolGlyphOptions {
/**
* Symbol normal.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/
normal?: SymbolGlyphModifier;
/**
* Symbol activated.
*
* @typ... | AST#export_declaration#Left export AST#interface_declaration#Left interface ChipSymbolGlyphOptions AST#object_type#Left { /**
* Symbol normal.
*
* @type { ?SymbolGlyphModifier }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @crossplatform
* @atomicservice
* @since 12
*/ AST#type_... | export interface ChipSymbolGlyphOptions {
normal?: SymbolGlyphModifier;
activated?: SymbolGlyphModifier;
} | https://github.com/ThePivotPoint/ArkTS-LSP-Server-Plugin.git/blob/6231773905435f000d00d94b26504433082ba40b/packages/declarations/ets/api/@ohos.arkui.advanced.Chip.d.ets#L223-L244 | 817abfa3f6bbb463cc6e2ca8c5ece31bed6cf3d3 | github | |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/common/MyComponent.ets | arkts | MyComponent | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Preview
@Component
export struct MyComponent {
title: string = 'test'
func: () => void = () => {
}
@Styles
pressedStyle(){
.backgroundColor(0x238E23)
}
@Styles
normalStyles() {
.backgroundColor(0x0000ff)
}
build() {
Text(this.title)
.key(this.title)
.fontSize(10)
.b... | AST#decorated_export_declaration#Left AST#decorator#Left @ Preview AST#decorator#Right AST#decorator#Left @ Component AST#decorator#Right export struct MyComponent AST#component_body#Left { AST#property_declaration#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annota... | @Preview
@Component
export struct MyComponent {
title: string = 'test'
func: () => void = () => {
}
@Styles
pressedStyle(){
.backgroundColor(0x238E23)
}
@Styles
normalStyles() {
.backgroundColor(0x0000ff)
}
build() {
Text(this.title)
.key(this.title)
.fontSize(10)
.b... | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/common/MyComponent.ets#L16-L43 | 52ab34c68037817bdf33d4249623ac04d593c64d | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets | arkts | onPlayerVolume | 播放器音量
@param volume :当前播放器音量值 | onPlayerVolume(volume: number) {
} | AST#method_declaration#Left onPlayerVolume AST#parameter_list#Left ( AST#parameter#Left volume : 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#builder_function_body#Right AST#me... | onPlayerVolume(volume: number) {
} | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/components/player/VHWatchLivePlayerComponent.ets#L228-L229 | 3b46dd34a2806963186dd3f03a5c50005e60057f | gitee |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/components/MarkdownRenderer.ets | arkts | MarkdownRenderer | MarkdownRenderer.ets - 主组件 | @Component
export default struct MarkdownRenderer {
private markdownText: string = ''
private textColor: ResourceColor = Color.Black
private fontSize: number = 16
private paddingValue: Padding | number = 16
build() {
Column() {
this.buildMarkdownElements()
}
.width('100%')
.padding(this... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct MarkdownRenderer AST#component_body#Left { AST#property_declaration#Left private markdownText : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right = AST#expr... | @Component
export default struct MarkdownRenderer {
private markdownText: string = ''
private textColor: ResourceColor = Color.Black
private fontSize: number = 16
private paddingValue: Padding | number = 16
build() {
Column() {
this.buildMarkdownElements()
}
.width('100%')
.padding(this... | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/components/MarkdownRenderer.ets#L204-L358 | f85643b485663fcd911a6c39d037917ec0d285bb | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment1.ets | arkts | Properties of uiStyle used by multiple components | build() {
Column() {
// Components that use state variables
SpecialImage({ specialImageUiStyle: this.uiStyle })
Column() {
// 需要替换为开发者所需的图像资源文件
Image($r('app.media.startIcon'))
.height('150vp')
.width('150vp')
.scale({
x: this.uiStyle.scale... | 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 { // Components that use state variables AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left SpecialImage ( A... | build() {
Column() {
SpecialImage({ specialImageUiStyle: this.uiStyle })
Column() {
Image($r('app.media.startIcon'))
.height('150vp')
.width('150vp')
.scale({
x: this.uiStyle.scaleX,
y: this.uiStyle.scaleY
})
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ArkUI/Component_Redundancy_Refresh_Optimization/entry/src/main/ets/segment/segment1.ets#L23-L76 | de29b09ee2253517a61d74ff848fca31e7d2d7c4 | gitee | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/utils/DateUtils.ets | arkts | format | 格式化日期 | static format(date: Date, format: string = 'YYYY-MM-DD HH:mm:ss'): string {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String... | AST#method_declaration#Left static format AST#parameter_list#Left ( AST#parameter#Left date : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left format : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Righ... | static format(date: Date, format: string = 'YYYY-MM-DD HH:mm:ss'): string {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/utils/DateUtils.ets#L9-L24 | 5ece328c38c4a781f20a35a60acbbc1804a2c6be | github |
harmonyos/samples | f5d967efaa7666550ee3252d118c3c73a77686f5 | ETSUI/eTSBuildCommonView/entry/src/main/ets/default/app.ets | arkts | Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
} | AST#export_declaration#Left export default AST#expression#Left AST#object_literal#Left { AST#property_assignment#Left AST#property_name#Left onCreate AST#property_name#Right AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Le... | export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
} | https://github.com/harmonyos/samples/blob/f5d967efaa7666550ee3252d118c3c73a77686f5/ETSUI/eTSBuildCommonView/entry/src/main/ets/default/app.ets#L16-L23 | aad78b2e66f5873601cd9e47b54b98344083ede6 | gitee | |
IceYuanyyy/OxHornCampus.git | bb5686f77fa36db89687502e35898cda218d601f | entry/src/main/ets/pages/IntroductionPage.ets | arkts | initializeZoneId | Initialize the zone id accord to the type of jumping to this page. | initializeZoneId() {
if (this.cardID !== -1) {
this.currentZoneId = this.cardID;
} else if (this.isContinuation === 'false' || this.getUIContext().getRouter().getParams() !== undefined) {
this.currentZoneId = (this.getUIContext().getRouter().getParams() as RouterParmaInterface).id;
}
} | AST#method_declaration#Left initializeZoneId AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui_if_statement#Left if ( AST#expression#Left AST#binary_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#... | initializeZoneId() {
if (this.cardID !== -1) {
this.currentZoneId = this.cardID;
} else if (this.isContinuation === 'false' || this.getUIContext().getRouter().getParams() !== undefined) {
this.currentZoneId = (this.getUIContext().getRouter().getParams() as RouterParmaInterface).id;
}
} | https://github.com/IceYuanyyy/OxHornCampus.git/blob/bb5686f77fa36db89687502e35898cda218d601f/entry/src/main/ets/pages/IntroductionPage.ets#L249-L255 | 3aad2b7308cb349cb53af7cc59eced5c032d9e0e | github |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | 公历日期接口 | export interface SolarDate {
year: number;
month: number;
day: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface SolarDate AST#object_type#Left { AST#type_member#Left year : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; AST#type_member#Left month : AST#type_annotation#Left AS... | export interface SolarDate {
year: number;
month: number;
day: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L46-L50 | 6c2bef3dd3263164cebae46da8fdad093ae2b5f8 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | appendMemBoxes | / 从内存中添加boxes | appendMemBoxes(boxes: Box[]): void {
this.boxes.push(...boxes);
} | AST#method_declaration#Left appendMemBoxes AST#parameter_list#Left ( AST#parameter#Left boxes : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left Box [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#p... | appendMemBoxes(boxes: Box[]): void {
this.boxes.push(...boxes);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L194-L196 | be2656f9c220b711f0d4bf0e9864746ff869b433 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/completeness/variable_scope/private_variable/private_variable_002_F.ets | arkts | Introduction 类私有变量 | export function private_variable_002_F(taint_src : string) {
let _t = taint_src
let _clean = "clean"
let a = new A();
a.setData(_clean);
taint.Sink(a.getData());
} | AST#export_declaration#Left export AST#function_declaration#Left function private_variable_002_F AST#parameter_list#Left ( AST#parameter#Left taint_src : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statem... | export function private_variable_002_F(taint_src : string) {
let _t = taint_src
let _clean = "clean"
let a = new A();
a.setData(_clean);
taint.Sink(a.getData());
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/completeness/variable_scope/private_variable/private_variable_002_F.ets#L6-L12 | f2e738a6501ce90262d1d92bcda7c313a652f765 | github | |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/JSONUtil.ets | arkts | isJSONStr | 判断是否是字符串格式json
@param str 待验证字符串
@returns | static isJSONStr(str: string | undefined | null): boolean {
try {
JSON.parse(str);
return true;
} catch (error) {
return false;
}
} | AST#method_declaration#Left static isJSONStr AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left undefined AST#primary_type#Right | AST#primary_type#Left null AST#primary_type#Right AST#union_type#Rig... | static isJSONStr(str: string | undefined | null): boolean {
try {
JSON.parse(str);
return true;
} catch (error) {
return false;
}
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/JSONUtil.ets#L137-L144 | 8bc1bf7adc9fe6d6c88dd1556a7602f791d4e245 | gitee |
zhongte/TaoYao | 80850f3800dd6037216d3f7c58a2bf34a881c93f | taoyao/src/main/ets/shijing/taoyao/TaoYao.ets | arkts | hasPermission | 仅仅检测是否有权限,如果没有权限,不会申请权限
@param permissions
@returns true 有权限 | static hasPermission(permissions: Array<Permissions>): boolean {
const generalChecker = new GeneralChecker()
return generalChecker.hasPermission(permissions)
} | AST#method_declaration#Left static hasPermission AST#parameter_list#Left ( AST#parameter#Left permissions : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left Permissions AST#primary_type#Right AST#type_annotation#Right > A... | static hasPermission(permissions: Array<Permissions>): boolean {
const generalChecker = new GeneralChecker()
return generalChecker.hasPermission(permissions)
} | https://github.com/zhongte/TaoYao/blob/80850f3800dd6037216d3f7c58a2bf34a881c93f/taoyao/src/main/ets/shijing/taoyao/TaoYao.ets#L76-L79 | 5fd227c3243349f500229b2ad5b0cadd8d5d5cc6 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreview.ets | arkts | PreviewBuilder | 菜单预览图 | @Builder
export function PreviewBuilder() {
Image($r('app.media.app_icon'))
.width(200)
.height(120)
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function PreviewBuilder 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 Image ( AST#expression#Left AST#r... | @Builder
export function PreviewBuilder() {
Image($r('app.media.app_icon'))
.width(200)
.height(120)
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Overlay/entry/src/main/ets/pages/components/menu/bindContextMenuPreview.ets#L22-L27 | c9796b5768e0a367ed9db26435527dec26f35f34 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/array/ArrayStringUtils.ets | arkts | getCharIndexInAllTexts | 根据 texts 数组计算全局字符索引
- texts: 每个元素是一段文本(例如每页或每条)
- textIndex: 指定属于 texts 的第几个元素(0-based)
- charIndexInAText: 在该文本内的字符索引(0-based)
返回值:
- 成功:返回全局索引(从 0 开始计数)
- 参数非法或越界:返回 -1 | static getCharIndexInAllTexts(texts: string[], textIndex: number, charIndexInAText: number): number {
// 参数基本校验
if (!Array.isArray(texts)) return -1;
if (texts.length === 0) return -1;
if (!Number.isInteger(textIndex) || !Number.isInteger(charIndexInAText)) return -1;
if (textIndex < 0 || textIndex ... | AST#method_declaration#Left static getCharIndexInAllTexts AST#parameter_list#Left ( AST#parameter#Left texts : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left textIndex : AST#type... | static getCharIndexInAllTexts(texts: string[], textIndex: number, charIndexInAText: number): number {
if (!Array.isArray(texts)) return -1;
if (texts.length === 0) return -1;
if (!Number.isInteger(textIndex) || !Number.isInteger(charIndexInAText)) return -1;
if (textIndex < 0 || textIndex >= texts.... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/array/ArrayStringUtils.ets#L58-L78 | b203bce10af8b3811bff349fe0bfd90ff60c4ee8 | github |
linhanlove/hormany-os-notion | a65f47bfc1a2bbce531b9af97831eb1ba934c2f8 | entry/src/main/ets/view/SplashPage.ets | arkts | aboutToAppear | 周期函数aboutToAppear里添加一个2秒的定时任务跳转到主页 | aboutToAppear() {
this.timer = setTimeout(()=>{
router.replaceUrl({url:Constants.loadingToJump})
.catch(err=>{
promptAction.showToast({
message:err==200002? $r('app.string.not_found_url'):$r('app.string.loading_to_jump_error'),
duration: 2000,
});
})... | AST#method_declaration#Left aboutToAppear AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . timer AST#member_expression#Right = ... | aboutToAppear() {
this.timer = setTimeout(()=>{
router.replaceUrl({url:Constants.loadingToJump})
.catch(err=>{
promptAction.showToast({
message:err==200002? $r('app.string.not_found_url'):$r('app.string.loading_to_jump_error'),
duration: 2000,
});
})... | https://github.com/linhanlove/hormany-os-notion/blob/a65f47bfc1a2bbce531b9af97831eb1ba934c2f8/entry/src/main/ets/view/SplashPage.ets#L52-L62 | e5c33935a3c2bcb2e32636f681eca90ee89577db | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/views/setting/ReclaimView.ets | arkts | refreshUIState | 刷新UI状态 | private refreshUIState() {
const trimmedContent = this.content.trim();
this.characterCount = trimmedContent.length;
this.isSendButtonEnabled =
this.characterCount > this.MIN_COUNT &&
this.characterCount <= this.MAX_COUNT;
} | AST#method_declaration#Left private refreshUIState AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#Left trimmedContent = AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#L... | private refreshUIState() {
const trimmedContent = this.content.trim();
this.characterCount = trimmedContent.length;
this.isSendButtonEnabled =
this.characterCount > this.MIN_COUNT &&
this.characterCount <= this.MAX_COUNT;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/views/setting/ReclaimView.ets#L125-L131 | d390ad29efd9c918e46cf021c979f7c3b2f348ef | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets | arkts | addGridItem | 向首页应用里添加应用的动画
@param item 被点击的gridItem
@param appInfoList 首页应用里的所有GridItem | addGridItem(item: T, appInfoList: AppInfo[]): void {
const index: number = this.sortAppData.indexOf(item);
const appId: string = (item as AppInfo).name.toString();
animateTo({
curve: Curve.ExtremeDeceleration, duration: ADD_ANIMATION_DURATION, onFinish: () => {
this.modifier[index].attribute?.... | AST#method_declaration#Left addGridItem AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left T AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left appInfoList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left AppInfo ... | addGridItem(item: T, appInfoList: AppInfo[]): void {
const index: number = this.sortAppData.indexOf(item);
const appId: string = (item as AppInfo).name.toString();
animateTo({
curve: Curve.ExtremeDeceleration, duration: ADD_ANIMATION_DURATION, onFinish: () => {
this.modifier[index].attribute?.... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L147-L195 | 62a23ecd6badbd5d9a5442c6df3e47a57fabb946 | gitee |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/model/ChatLog.ets | arkts | fromRow | Create ChatLog from database row | static fromRow(row: ChatLogRow): ChatLog {
return new ChatLog(
row.id,
row.date,
row.content,
row.is_user === 1,
row.emotion,
row.timestamp
);
} | AST#method_declaration#Left static fromRow AST#parameter_list#Left ( AST#parameter#Left row : AST#type_annotation#Left AST#primary_type#Left ChatLogRow AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left ChatLog AST#primary_typ... | static fromRow(row: ChatLogRow): ChatLog {
return new ChatLog(
row.id,
row.date,
row.content,
row.is_user === 1,
row.emotion,
row.timestamp
);
} | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/model/ChatLog.ets#L56-L65 | 6978b5bdf2a161191bb061da158f624b803b6e83 | github |
lentozi/DailyPlan.git | 96ce0bec8f545511c51b577c4aa8327c2c5bb0c8 | entry/src/main/ets/tabcontent/HomeContent.ets | arkts | dateItem | 封装日历中的单条内容 | @Builder dateItem(dateItem: DateItem) {
Column() {
Row() {
Row() {
Text(dateItem.date.toString())
.height('100%')
.width('100%')
.textAlign(TextAlign.Center)
.fontColor(dateItem.date == this.selectedDate.date ? dateItem.date == this.currentDate... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right dateItem AST#parameter_list#Left ( AST#parameter#Left dateItem : AST#type_annotation#Left AST#primary_type#Left DateItem AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#... | @Builder dateItem(dateItem: DateItem) {
Column() {
Row() {
Row() {
Text(dateItem.date.toString())
.height('100%')
.width('100%')
.textAlign(TextAlign.Center)
.fontColor(dateItem.date == this.selectedDate.date ? dateItem.date == this.currentDate... | https://github.com/lentozi/DailyPlan.git/blob/96ce0bec8f545511c51b577c4aa8327c2c5bb0c8/entry/src/main/ets/tabcontent/HomeContent.ets#L176-L226 | f7448849c54fe1724a98c4acd8c119a763e4eae9 | github |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/dateAndTime.ets | arkts | existApp | Cancel Dialog | existApp() {
LogUtil.info(MODULE_TAG + 'Cancel dialog!');
} | AST#method_declaration#Left existApp 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 LogUtil AST#expression#Right . info AST#member_expressi... | existApp() {
LogUtil.info(MODULE_TAG + 'Cancel dialog!');
} | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/dateAndTime.ets#L168-L170 | 9afd60bb7cfb6e1ea010fd056ca28c2d1650f290 | gitee |
sedlei/Smart-park-system.git | 253228f73e419e92fd83777f564889d202f7c699 | src/main/ets/pages/EnvironmentMonitoringPage.ets | arkts | updateEnvironmentStatus | 更新环境状态 | private updateEnvironmentStatus() {
this.environmentData.tempStatus = checkTemperatureStatus(this.environmentData.temperature)
this.environmentData.humidityStatus = checkHumidityStatus(this.environmentData.humidity)
} | AST#method_declaration#Left private updateEnvironmentStatus AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expression#Left AST#member_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left... | private updateEnvironmentStatus() {
this.environmentData.tempStatus = checkTemperatureStatus(this.environmentData.temperature)
this.environmentData.humidityStatus = checkHumidityStatus(this.environmentData.humidity)
} | https://github.com/sedlei/Smart-park-system.git/blob/253228f73e419e92fd83777f564889d202f7c699/src/main/ets/pages/EnvironmentMonitoringPage.ets#L177-L180 | b618bc65555d6cc4da461abbfdd3656ebf062ceb | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets | arkts | securityPatchTag | 安全补丁级别 | static securityPatchTag(): string {
return deviceInfo.securityPatchTag
} | AST#method_declaration#Left static securityPatchTag AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#return_statement#Left return AST#expression#Left AST#member_... | static securityPatchTag(): string {
return deviceInfo.securityPatchTag
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/DeviceManagement/DeviceManagementCollection/feature/capabilities/src/main/ets/util/DeviceUtil.ets#L106-L108 | e1f59611206cc08d4e935a9baae94099361b0751 | gitee |
lulululing/calendar.git | c87b7e3ffb50a34941a5db50afe6a513c113bd0b | entry/src/main/ets/manager/NotificationManager.ets | arkts | publishSystemReminder | 完善后的系统提醒代理发布(单次提醒) | private async publishSystemReminder(event: EventModel, eventDateTime: Date): Promise<number> {
const reminderTime = new Date(eventDateTime.getTime() - event.reminderMinutes * 60 * 1000)
if (reminderTime.getTime() <= Date.now()) {
throw new Error('提醒时间已过,无法设置')
}
console.info(`📅 设置提醒时间: ... | AST#method_declaration#Left private async publishSystemReminder AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left EventModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left eventDateTime : AST#type_annotation#Left AST#primary_ty... | private async publishSystemReminder(event: EventModel, eventDateTime: Date): Promise<number> {
const reminderTime = new Date(eventDateTime.getTime() - event.reminderMinutes * 60 * 1000)
if (reminderTime.getTime() <= Date.now()) {
throw new Error('提醒时间已过,无法设置')
}
console.info(`📅 设置提醒时间: ... | https://github.com/lulululing/calendar.git/blob/c87b7e3ffb50a34941a5db50afe6a513c113bd0b/entry/src/main/ets/manager/NotificationManager.ets#L90-L116 | 03dd5b5b85a3978ee2d4d55fc9cae1617a4bb23d | github |
mayuanwei/harmonyOS_bilibili | 8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5 | AtomicService/DxinPoetry/entry/src/main/ets/model/MustLearnPoetryModel.ets | arkts | 诗词 | export interface Poetry {
title: string
dynasty: string
author: string
content: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Poetry AST#object_type#Left { AST#type_member#Left title : 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 dynasty : AST#type_annotation#Left AST#... | export interface Poetry {
title: string
dynasty: string
author: string
content: string
} | https://github.com/mayuanwei/harmonyOS_bilibili/blob/8a36b68b1ddf4433e2e17ee10fee4993cce2a6c5/AtomicService/DxinPoetry/entry/src/main/ets/model/MustLearnPoetryModel.ets#L16-L21 | 331bbba00810bdfc7e3ad06853efe4818c8ace19 | gitee | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets | arkts | decode | 解密
@param decodeStr 待解密的字符串
@param priKey SM2私钥
@param keyCoding 密钥编码方式(utf8/hex/base64) 普通字符串则选择utf8格式
@param dataCoding 入参字符串编码方式(hex/base64) - 不传默认为base64 | static decode(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.decodeAsym(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false);
} | AST#method_declaration#Left static decode AST#parameter_list#Left ( AST#parameter#Left str : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left priKey : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Rig... | static decode(str: string, priKey: string, keyCoding: buffer.BufferEncoding,
dataCoding: buffer.BufferEncoding = 'base64'): OutDTO<string> {
return CryptoSyncUtil.decodeAsym(str, priKey, 'SM2_256', 'SM2_256|SM3', 256, keyCoding, dataCoding, false);
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/encryption/sm2/SM2Sync.ets#L58-L61 | ff1f2359ffc02ed035176c26f99466ccdd2dfd09 | gitee |
Active-hue/ArkTS-Accounting.git | c432916d305b407557f08e35017c3fd70668e441 | entry/src/main/ets/pages/ReminderSetting.ets | arkts | generateMinuteList | 生成分钟列表方法 | generateMinuteList(): number[] {
const minutes: number[] = [];
for (let i = 0; i < 60; i++) {
minutes.push(i);
}
return minutes;
} | AST#method_declaration#Left generateMinuteList AST#parameter_list#Left ( ) AST#parameter_list#Right : 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#block_statement#Left { AST#statement#Left AST#variable_declaration... | generateMinuteList(): number[] {
const minutes: number[] = [];
for (let i = 0; i < 60; i++) {
minutes.push(i);
}
return minutes;
} | https://github.com/Active-hue/ArkTS-Accounting.git/blob/c432916d305b407557f08e35017c3fd70668e441/entry/src/main/ets/pages/ReminderSetting.ets#L28-L34 | eefc627552f5353595acba5e6a3adadea751437f | github |
IceTeacher/DrawingBook.git | c101a1b904388fcfa72de1ff402307bb9036b68b | entry/src/main/ets/pages/BookDetailPage.ets | arkts | getBookRecommend | 获取书籍推荐列表 | async getBookRecommend() {
let params: ESObject = router.getParams() as ESObject;
let httpObject = http.createHttp();
let url = "https://van.mama.cn/hb/api/comment/getList?goods_id=" + params.id + "&perpage=10"
let res = await httpObject.request(url)
res = JSON.parse(res["result"] as string);
le... | AST#method_declaration#Left async getBookRecommend AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left params : AST#type_annotation#Left AST#primary_type#Left ESObject AST#primary_type#Right AST#type_annotation... | async getBookRecommend() {
let params: ESObject = router.getParams() as ESObject;
let httpObject = http.createHttp();
let url = "https://van.mama.cn/hb/api/comment/getList?goods_id=" + params.id + "&perpage=10"
let res = await httpObject.request(url)
res = JSON.parse(res["result"] as string);
le... | https://github.com/IceTeacher/DrawingBook.git/blob/c101a1b904388fcfa72de1ff402307bb9036b68b/entry/src/main/ets/pages/BookDetailPage.ets#L66-L74 | d86f2d5b70cd4d1708b4105f00062431abb51ebf | github |
common-apps/ZRouter | 5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6 | RouterApi/src/main/ets/api/Router.ets | arkts | pop | @deprecated
@see {ZRouter.getInstance().pop}
@param animated | public static pop(animated: boolean = true) {
ZRouter.getRouterMgr().pop(animated)
} | AST#method_declaration#Left public static pop AST#parameter_list#Left ( AST#parameter#Left animated : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left true AST#boolean_literal#Right AST#expression#Right AST#parameter#R... | public static pop(animated: boolean = true) {
ZRouter.getRouterMgr().pop(animated)
} | https://github.com/common-apps/ZRouter/blob/5adc9c4bcca6ba7d9b323451ed464e1e9b47eee6/RouterApi/src/main/ets/api/Router.ets#L447-L449 | 8375af64d84a418a61eaae1631204c986f1c2347 | gitee |
WinWang/HarmoneyOpenEye.git | 57f0542795336009aa0d46fd9fa5b07facc2ae87 | entry/src/main/ets/http/apiService.ets | arkts | 获取视频详情接口
@param id | export function getRelationList(id: number) {
return axiosClient.get<HomeModel>(
{
url: baseUrl + "api/v4/video/related",
params: { "id": id }
}
)
} | AST#export_declaration#Left export AST#function_declaration#Left function getRelationList 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#block_statement#Left { AST... | export function getRelationList(id: number) {
return axiosClient.get<HomeModel>(
{
url: baseUrl + "api/v4/video/related",
params: { "id": id }
}
)
} | https://github.com/WinWang/HarmoneyOpenEye.git/blob/57f0542795336009aa0d46fd9fa5b07facc2ae87/entry/src/main/ets/http/apiService.ets#L108-L115 | 6f7c857a751c7f6c0966d84239a271f5e11099ce | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.