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/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | endImageDrag | End drag image. | private endImageDrag(): void {
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let displayCenter = new Point(this.d... | AST#method_declaration#Left private endImageDrag AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left crop =... | private endImageDrag(): void {
let crop = this.cropShow.getCropRect();
let points = MathUtils.rectToPoints(crop);
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let angle = -(this.rotationAngle * tX * tY + this.sliderAngle);
let displayCenter = new Point(this.d... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets#L526-L540 | 3785d0d6fda811613fc30b823c1ae8e8ad1a16ae | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets | arkts | generateCryptoKey | 生成非对称密钥
@param symAlgName 秘钥规格
@returns 指定秘钥规格的非对称公私
@param resultCoding 生成非对称秘钥的编码方式(hex/base64) | static generateCryptoKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<CryptoKey> {
// 创建非对称密钥生成器
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
// 通过非对称密钥生成器,随机生成非对称密钥
let promiseKeyPair = rsaGenerator.generateKeyPairSync();
// 转换成可以读懂的公私钥字符串
let pubKey = StrAnd... | AST#method_declaration#Left static generateCryptoKey AST#parameter_list#Left ( AST#parameter#Left symAlgName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left resultCoding : AST#type_annotation#Left AST#primary_type#Left AST... | static generateCryptoKey(symAlgName: string, resultCoding: buffer.BufferEncoding): OutDTO<CryptoKey> {
let rsaGenerator = crypto.createAsyKeyGenerator(symAlgName);
let promiseKeyPair = rsaGenerator.generateKeyPairSync();
let pubKey = StrAndUintUtil.unitArray2StrCoding(promiseKeyPair.pubKey.ge... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_crypto_dto/src/main/ets/crypto/util/CryptoSyncUtil.ets#L137-L146 | 13fd702c57b2c7ab01f7911965dfb6eda7169bac | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets | arkts | deleteGridItem | 删除gridItem
@param item 网格元素
@param itemAreaWidth 网格区域宽度 | deleteGridItem(item: T, itemAreaWidth: number): void {
const index: number = this.gridData.indexOf(item);
animateTo({
curve: Curve.Friction, duration: DELETE_ANIMATION_DURATION, onFinish: () => {
// 初始化偏移位置
this.modifier.forEach((item) => {
item.offsetX = 0;
item.offset... | AST#method_declaration#Left deleteGridItem 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 itemAreaWidth : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type... | deleteGridItem(item: T, itemAreaWidth: number): void {
const index: number = this.gridData.indexOf(item);
animateTo({
curve: Curve.Friction, duration: DELETE_ANIMATION_DURATION, onFinish: () => {
this.modifier.forEach((item) => {
item.offsetX = 0;
item.offsetY = 0;
... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/gridexchange/src/main/ets/model/GridItemDeletionCtrl.ets#L74-L108 | 0ec15089d8d0933c67af7872c16294f111ed377e | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ComponentReuse/entry/src/main/ets/common/Constants.ets | arkts | Common constants for all features | export class Constants {
/**
* Default List Interval.
*/
public static readonly LIST_SPACE: number = 12;
/**
* Maximum width.
*/
public static readonly LAYOUT_MAX: string = '100%';
/**
* Common initialization.
*/
public static readonly COMM_INIT: number = 0;
/**
* NavDestination i... | AST#export_declaration#Left export AST#class_declaration#Left class Constants AST#class_body#Left { /**
* Default List Interval.
*/ AST#property_declaration#Left public static readonly LIST_SPACE : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#express... | export class Constants {
public static readonly LIST_SPACE: number = 12;
public static readonly LAYOUT_MAX: string = '100%';
public static readonly COMM_INIT: number = 0;
public static readonly NAV_DESTINATION_ITEM_0: string = 'NavDestination_item_0';
public static readonly NAV_DESTINATION... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentReuse/entry/src/main/ets/common/Constants.ets#L21-L75 | 49578d7456b0d7b105c3cb56c3caa20a1a509206 | gitee | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/auth/src/main/ets/view/LoginPage.ets | arkts | 构建登录页面
@returns {void} 无返回值 | build(): void {
AppNavDestination({
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") }
}) {
this.LoginContent();
}
} | AST#build_method#Left build ( ) : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left AppNavDestination ( AST#component_parameters#Left { AST#component_parameter#Left... | build(): void {
AppNavDestination({
viewModel: this.vm,
pageBackgroundColor: $r("app.color.bg_white"),
titleOptions: { backgroundColor: $r("app.color.bg_white") }
}) {
this.LoginContent();
}
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/auth/src/main/ets/view/LoginPage.ets#L36-L44 | a9c6cd323e1b3a8d6eab4b59ce1aa4b38eab8a36 | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/WindowManagement/WindowManage/WindowComponent/index.ets | arkts | WindowComponent | 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 { WindowComponent } from './src/main/ets/components/MainPage/MainPage' | AST#export_declaration#Left export { WindowComponent } from './src/main/ets/components/MainPage/MainPage' AST#export_declaration#Right | export { WindowComponent } from './src/main/ets/components/MainPage/MainPage' | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/WindowManagement/WindowManage/WindowComponent/index.ets#L16-L16 | 0f57d2748ee22b322bdb79e9c442375fcfdec769 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/Message.ets | arkts | 消息体 | export interface Message {
id: string;
//发送者
sender: string;
//头像
avatar: string;
//消息类型
type: number;
//消息内容
content: string;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface Message AST#object_type#Left { AST#type_member#Left id : 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 sender : AST#type_annotation#Left... | export interface Message {
id: string;
sender: string;
avatar: string;
type: number;
content: string;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/voicerecordynamiceffect/src/main/ets/models/Message.ets#L19-L29 | e7dd11579204b032ffb3fb7b869241494cc3a164 | gitee | |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | WaterFlowSample/entry/src/main/ets/pages/DataLoadMorePage.ets | arkts | [EndExclude quick_start] | build() {
Column({ space: 0 }) {
Refresh({ refreshing: $$this.isRefreshing, builder: this.headerRefresh() }) {
WaterFlow({ scroller: this.scroller, sections: this.sections }) {
// [StartExclude quick_start]
LazyForEach(this.dataSource, (item: number) => {
FlowItem() {
... | 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#component_parameters#Left { AST#component_parameter#Left space : AST#expression#Left 0 AST#expression#Right AST#component_parameter#Right } AST#component_parameters#Right... | build() {
Column({ space: 0 }) {
Refresh({ refreshing: $$this.isRefreshing, builder: this.headerRefresh() }) {
WaterFlow({ scroller: this.scroller, sections: this.sections }) {
LazyForEach(this.dataSource, (item: number) => {
FlowItem() {
Stack() {
... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/WaterFlowSample/entry/src/main/ets/pages/DataLoadMorePage.ets#L228-L305 | 6ec42a7647a8abb348857c74b2759ea3490e8b48 | gitee | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets | arkts | this | 禁用x和y轴方向同时缩放,但是可以单独x轴方向或者y轴方向缩放 | this.model.setPinchZoom(false); | AST#method_declaration#Left this AST#ERROR#Left . model . setP in chZoom AST#ERROR#Right AST#parameter_list#Left ( AST#parameter#Left false AST#parameter#Right ) AST#parameter_list#Right ; AST#method_declaration#Right | this.model.setPinchZoom(false); | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/barchart/src/main/ets/view/BarChart.ets#L125-L125 | 6637aa7b545faf4ee2bca20779d271720d0dcb36 | gitee |
weiwei0928/Eyepetizer-harmony.git | fd5947c6f616c22d42256f36ba752093b782a910 | entry/src/main/ets/common/utils/SPUtil.ets | arkts | delete | 删除值
@param key
@param preferenceName
@returns | static async delete(key: string, preferenceName: string = defaultPreferenceName) {
let preferences = await SPUtil.getPreferences(preferenceName)
return await preferences.delete(key)
} | AST#method_declaration#Left static async delete 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 preferenceName : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | static async delete(key: string, preferenceName: string = defaultPreferenceName) {
let preferences = await SPUtil.getPreferences(preferenceName)
return await preferences.delete(key)
} | https://github.com/weiwei0928/Eyepetizer-harmony.git/blob/fd5947c6f616c22d42256f36ba752093b782a910/entry/src/main/ets/common/utils/SPUtil.ets#L51-L54 | ad35168e431d681d6f475edd96b5d664b032390b | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_utils/src/main/ets/utils/DateUtil.ets | arkts | getFormatDate | 获取格式化日期,将传入的日期格式化为Date
@param date number类型的时间戳10-13位数据
@returns | static getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) { //无参数
date = new Date();
} else if (typeof date == "string") { //字符串日期
if (date.length == 0) {
date = new Date();
} else if (RegexUtil.isDigits(date)) { //字符串类型的时间戳(10-13位)
date... | AST#method_declaration#Left static getFormatDate 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 getFormatDate(date?: number | string | Date): Date {
if (date == undefined || date == null) {
date = new Date();
} else if (typeof date == "string") {
if (date.length == 0) {
date = new Date();
} else if (RegexUtil.isDigits(date)) {
date = new Date(DateUtil.padTimesta... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_utils/src/main/ets/utils/DateUtil.ets#L32-L48 | 670ebb068421d6d073ca606e1adf8266de622399 | gitee |
openharmony/arkui_ace_engine | 30c7d1ee12fbedf0fabece54291d75897e2ad44f | examples/Select/entry/src/main/ets/pages/components/toggle/toggleEnable.ets | arkts | ToggleEnableBuilder | Copyright (c) 2025 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | @Builder
export function ToggleEnableBuilder(name: string, param: Object) {
ToggleEnableExample()
} | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export function ToggleEnableBuilder AST#parameter_list#Left ( AST#parameter#Left name : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left p... | @Builder
export function ToggleEnableBuilder(name: string, param: Object) {
ToggleEnableExample()
} | https://github.com/openharmony/arkui_ace_engine/blob/30c7d1ee12fbedf0fabece54291d75897e2ad44f/examples/Select/entry/src/main/ets/pages/components/toggle/toggleEnable.ets#L16-L19 | ac01d08263a3d1a46d1173a8e9b1dff25a3404bf | gitee |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/eventbus/EventBus.ets | arkts | off | 取消订阅 | off(event: string, callback?: EventCallback): void {
if (!this.events.has(event)) {
return;
}
if (callback) {
const callbacks = this.events.get(event);
if (callbacks) {
const index = callbacks.indexOf(callback);
if (index > -1) {
callbacks.splice(index, 1);
... | AST#method_declaration#Left off AST#parameter_list#Left ( AST#parameter#Left event : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback ? : AST#type_annotation#Left AST#primary_type#Left EventCallback AST#primary_type#... | off(event: string, callback?: EventCallback): void {
if (!this.events.has(event)) {
return;
}
if (callback) {
const callbacks = this.events.get(event);
if (callbacks) {
const index = callbacks.indexOf(callback);
if (index > -1) {
callbacks.splice(index, 1);
... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/eventbus/EventBus.ets#L48-L65 | 8a1810c60ee14ce2cc5d904afd20f372a97b6b56 | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/registerPage/register.ets | arkts | 叉号,显隐标识 | build(){
Column(){
//返回箭头
Row(){
Image($r('app.media.ic_back'))
.width(30)
.height(30)
.margin({top:15})
.onClick(()=>{
AlertDialog.show({
message:"输入手机号即可轻松完成注册,\n您确定要返回吗?"
,primaryButton:{
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { //返回箭头 AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#ar... | build(){
Column(){
Row(){
Image($r('app.media.ic_back'))
.width(30)
.height(30)
.margin({top:15})
.onClick(()=>{
AlertDialog.show({
message:"输入手机号即可轻松完成注册,\n您确定要返回吗?"
,primaryButton:{
... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/registerPage/register.ets#L23-L219 | 188a9ca076afcbf3dfc22f02046481a45184cb09 | github | |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_axios/src/main/ets/axios/EfClientApi.ets | arkts | appendHeader | 拼接header
@param headers 传入的header
@returns 拼接结果 | private static appendHeader(headers?: Record<string, Object>): AxiosHeaders {
let addHead: AxiosHeaders = new AxiosHeaders();
//是否有传入header
if (headers) {
Object.entries(headers).forEach((row) => {
addHead.set(row[0], row[1] as string, true);
});
}
//是否有公共header
if (efAxiosP... | AST#method_declaration#Left private static appendHeader AST#parameter_list#Left ( AST#parameter#Left headers ? : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Record AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right , ... | private static appendHeader(headers?: Record<string, Object>): AxiosHeaders {
let addHead: AxiosHeaders = new AxiosHeaders();
if (headers) {
Object.entries(headers).forEach((row) => {
addHead.set(row[0], row[1] as string, true);
});
}
if (efAxiosParams.headers) {
Obj... | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_axios/src/main/ets/axios/EfClientApi.ets#L40-L56 | 6be78acff247068657e3e5d040830ab9f1f51f50 | gitee |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/OtaUpdateManager.ets | arkts | getCurrentVersionDescription | 获取当前版本升级日志
@return 当前版本描述文件 | async getCurrentVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> {
return this.updateManager.getCurrentVersionDescription(update.DescriptionFormat.STANDARD,
DeviceUtils.getSystemLanguage());
} | AST#method_declaration#Left async getCurrentVersionDescription AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left UpgradeData AST#type_arguments... | async getCurrentVersionDescription(): Promise<UpgradeData<Array<update.ComponentDescription>>> {
return this.updateManager.getCurrentVersionDescription(update.DescriptionFormat.STANDARD,
DeviceUtils.getSystemLanguage());
} | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/OtaUpdateManager.ets#L121-L124 | 20af3a83464a0a5b32f064b87dc38f8aa148aa97 | gitee |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkWebHelper.ets | arkts | ArkWeb工具类 | export class ArkWebHelper {
private static context: common.UIAbilityContext; //common.UIAbilityContext,上下文
static debug: boolean = false; //是否是debug模式
static tag: string = 'ArkWeb'; //日志Tag
static level: hilog.LogLevel = hilog.LogLevel.INFO //日志Level
/**
* 初始化
* @param context UIAbilityContext
* @... | AST#export_declaration#Left export AST#class_declaration#Left class ArkWebHelper AST#class_body#Left { AST#property_declaration#Left private static context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . UIAbilityContext AST#qualified_type#Right AST#primary_type#Right AST#type_annotati... | export class ArkWebHelper {
private static context: common.UIAbilityContext;
static debug: boolean = false;
static tag: string = 'ArkWeb';
static level: hilog.LogLevel = hilog.LogLevel.INFO
static initialize(context: common.UIAbilityContext, debug: boolean = false, tag: string = 'ArkWeb',
level:... | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkWebHelper.ets#L10-L308 | b26fa1c83e2f10f37b78076272424e8415e2a201 | gitee | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/utils/MyMath.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 MyMath {
/**
* Constant by which to multiply an angular value in radians to obtain an
* angular value in degrees.
*/
private static radians: number = 57.29577951308232;
/**
* Constant by which to multiply an angular value in degrees to obtain an
* angular value in radians.
*... | AST#export_declaration#Left export default AST#class_declaration#Left class MyMath AST#class_body#Left { /**
* Constant by which to multiply an angular value in radians to obtain an
* angular value in degrees.
*/ AST#property_declaration#Left private static radians : AST#type_annotation#Left AST#primary_type#L... | export default class MyMath {
private static radians: number = 57.29577951308232;
private static degrees: number = 0.017453292519943295;
public static toRadians(ang: number): number {
return ang * MyMath.degrees;
}
public static toDegrees(ang: number) {
return ang * MyMath.radians
}
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/utils/MyMath.ets#L16-L50 | ab2f9c77a52b224a68473e67352a765e97dca7dc | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/ContactTypes.ets | arkts | 年龄分布接口 | export interface AgeDistribution {
under18: number;
age18to30: number;
age31to50: number;
over50: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface AgeDistribution AST#object_type#Left { AST#type_member#Left under18 : 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 age18to30 : AST#type_annot... | export interface AgeDistribution {
under18: number;
age18to30: number;
age31to50: number;
over50: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/ContactTypes.ets#L9-L14 | 0029ee2813554e19dcd07594fcae8619f44effb1 | github | |
liuchao0739/arkTS_universal_starter.git | 0ca845f5ae0e78db439dc09f712d100c0dd46ed3 | entry/src/main/ets/core/router/Routes.ets | arkts | 初始化路由表 | export function initRoutes(): void {
// 注册所有路由
Router.registerRoute({
path: Routes.SPLASH,
name: '启动页',
needAuth: false
});
Router.registerRoute({
path: Routes.LOGIN,
name: '登录页',
needAuth: false
});
Router.registerRoute({
path: Routes.REGISTER,
name: '注册页',
needAuth: f... | AST#export_declaration#Left export AST#function_declaration#Left function initRoutes AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { // 注册所有路由 AST#statement#Left AST#expression_statemen... | export function initRoutes(): void {
Router.registerRoute({
path: Routes.SPLASH,
name: '启动页',
needAuth: false
});
Router.registerRoute({
path: Routes.LOGIN,
name: '登录页',
needAuth: false
});
Router.registerRoute({
path: Routes.REGISTER,
name: '注册页',
needAuth: false
})... | https://github.com/liuchao0739/arkTS_universal_starter.git/blob/0ca845f5ae0e78db439dc09f712d100c0dd46ed3/entry/src/main/ets/core/router/Routes.ets#L40-L89 | 24b1056b01e31af14c35a393caed98e423c77a49 | github | |
buqiuz/Account.git | b843a38c24a833a9a4386f63cffec5fa5dadc674 | oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/ChartModel.ets | arkts | addViewportJob | Either posts a job immediately if the chart has already setup it's
dimensions or adds the job to the execution queue.
@param job | public addViewportJob(job: MoveViewJob) {
if (this.mViewPortHandler.hasChartDimens()) {
job.run();
} else {
this.mJobs.add(job);
}
} | AST#method_declaration#Left public addViewportJob AST#parameter_list#Left ( AST#parameter#Left job : AST#type_annotation#Left AST#primary_type#Left MoveViewJob AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#ui_control_flow#Left AST#ui... | public addViewportJob(job: MoveViewJob) {
if (this.mViewPortHandler.hasChartDimens()) {
job.run();
} else {
this.mJobs.add(job);
}
} | https://github.com/buqiuz/Account.git/blob/b843a38c24a833a9a4386f63cffec5fa5dadc674/oh_modules/.ohpm/@ohos+mpchart@3.0.15/oh_modules/@ohos/mpchart/src/main/ets/components/charts/ChartModel.ets#L294-L300 | ebc54438f958ef8027454926ca31d241b258b947 | github |
zqaini002/YaoYaoLingXian.git | 5095b12cbeea524a87c42d0824b1702978843d39 | YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets | arkts | 获取用户特定分类的梦想列表
@param userId 用户ID
@param category 分类名称
@returns 梦想列表 | export function getDreamsByUserIdAndCategory(userId: number, category: string): Promise<Dream[]> {
try {
return request<Dream[]>(RequestMethod.GET, `/dreams/user/${userId}/category/${category}`);
} catch (error) {
console.error(`获取用户${category}分类梦想列表失败: ${error instanceof Error ? error.message : String(erro... | AST#export_declaration#Left export AST#function_declaration#Left function getDreamsByUserIdAndCategory AST#parameter_list#Left ( AST#parameter#Left userId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left category : AST#type... | export function getDreamsByUserIdAndCategory(userId: number, category: string): Promise<Dream[]> {
try {
return request<Dream[]>(RequestMethod.GET, `/dreams/user/${userId}/category/${category}`);
} catch (error) {
console.error(`获取用户${category}分类梦想列表失败: ${error instanceof Error ? error.message : String(erro... | https://github.com/zqaini002/YaoYaoLingXian.git/blob/5095b12cbeea524a87c42d0824b1702978843d39/YaoYaoLingXian/entry/src/main/ets/services/ApiService.ets#L463-L470 | 747333137ec9f95b8724e6b5ad37ef4947735232 | github | |
openharmony/update_update_app | 0157b7917e2f48e914b5585991e8b2f4bc25108a | feature/ota/src/main/ets/manager/StateManager.ets | arkts | 状态--下载暂停
@since 2022-06-10 | export class DownloadPause extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.SHOW_NEW_VERSION);
this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW);
this.actionSet.push(UpdateAction.RESUME);
this.state = UpdateState.DOWNLOAD_PAUSE;
this.downloadStateText = $r('app.s... | AST#export_declaration#Left export AST#class_declaration#Left class DownloadPause extends AST#type_annotation#Left AST#primary_type#Left BaseState AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { AST#constructor_declaration#Left constructor AST#parameter_list#Left ( ) AST#parameter_list#Right AST#... | export class DownloadPause extends BaseState {
constructor() {
super();
this.actionSet.push(UpdateAction.SHOW_NEW_VERSION);
this.actionSet.push(UpdateAction.SHOW_PROCESS_VIEW);
this.actionSet.push(UpdateAction.RESUME);
this.state = UpdateState.DOWNLOAD_PAUSE;
this.downloadStateText = $r('app.s... | https://github.com/openharmony/update_update_app/blob/0157b7917e2f48e914b5585991e8b2f4bc25108a/feature/ota/src/main/ets/manager/StateManager.ets#L367-L392 | 3db7487d1d2d190ed1e10516d185f73de21bd792 | gitee | |
huangwei021230/HarmonyFlow.git | 427f918873b0c9efdc975ff4889726b1bfccc546 | entry/src/main/ets/ime/text/Key/KeyHintConfiguration.ets | arkts | Enumeration representing different modes of key hints. | export enum KeyHintMode {
DISABLED,
ACCENT_PRIORITY,
HINT_PRIORITY
} | AST#export_declaration#Left export AST#enum_declaration#Left enum KeyHintMode AST#enum_body#Left { AST#enum_member#Left DISABLED AST#enum_member#Right , AST#enum_member#Left ACCENT_PRIORITY AST#enum_member#Right , AST#enum_member#Left HINT_PRIORITY AST#enum_member#Right } AST#enum_body#Right AST#enum_declaration#Right ... | export enum KeyHintMode {
DISABLED,
ACCENT_PRIORITY,
HINT_PRIORITY
} | https://github.com/huangwei021230/HarmonyFlow.git/blob/427f918873b0c9efdc975ff4889726b1bfccc546/entry/src/main/ets/ime/text/Key/KeyHintConfiguration.ets#L4-L8 | 0e76e14e956637373686e13be036f80639b4353c | github | |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets | arkts | disableDashedHighlightLine | Disables the highlight-line to be drawn in dashed mode. | public disableDashedHighlightLine(): void {
this.mHighlightDashPathEffect = null;
} | AST#method_declaration#Left public disableDashedHighlightLine AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_type#Right AST#type_annotation#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#assignment_expr... | public disableDashedHighlightLine(): void {
this.mHighlightDashPathEffect = null;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets#L97-L99 | 5a90d4d563d8bc3294d633e686dd36b6cb3980a6 | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets | arkts | selectCA | 选择文件:CA、证书、私钥 | selectCA() {
this.selectFile((file: string) => {
caFileUri = file;
this.canLoad = true;
})
} | AST#method_declaration#Left selectCA AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left this AST#expression#Right . selectFile AST#member_expre... | selectCA() {
this.selectFile((file: string) => {
caFileUri = file;
this.canLoad = true;
})
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/NetWork_Kit/NetWorkKit_Datatransmission/Socket/entry/src/main/ets/connect/TwoWayTls.ets#L250-L255 | 070b5c87638897ce1059cca92baa8619a866566e | gitee |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | product/phone/src/main/ets/pages/dateAndTime.ets | arkts | changeValue | modify date and time | changeValue() {
this.dateAndTimeList = [
{
settingSummary: '',
settingTitle: $r('app.string.date'),
settingValue: this.date,
settingAlias: this.dateMark,
settingArrow: this.image,
},
{
settingSummary: '',
settingTitle: $r('app.string.time'),
... | AST#method_declaration#Left changeValue 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 . dateAndTimeList AST#member_expression#... | changeValue() {
this.dateAndTimeList = [
{
settingSummary: '',
settingTitle: $r('app.string.date'),
settingValue: this.date,
settingAlias: this.dateMark,
settingArrow: this.image,
},
{
settingSummary: '',
settingTitle: $r('app.string.time'),
... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/product/phone/src/main/ets/pages/dateAndTime.ets#L175-L192 | 9963fe6157e5ec2a27896e29c90b2a612e8548e9 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/utils/LunarCalendar.ets | arkts | getLunarFestival | 获取传统农历节日
@param month 农历月
@param day 农历日
@param isLeapMonth 是否闰月
@returns 节日名称,无节日返回空字符串 | static getLunarFestival(month: number, day: number, isLeapMonth: boolean = false): string {
if (isLeapMonth) {
return '';
}
const festivals: Record<string, string> = {
'1-1': '春节',
'1-2': '开年',
'1-3': '赤狗日',
'1-5': '破五',
'1-7': '人日',
'1-15': '元宵节',
'2-2': '龙抬... | AST#method_declaration#Left static getLunarFestival AST#parameter_list#Left ( AST#parameter#Left month : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left day : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | static getLunarFestival(month: number, day: number, isLeapMonth: boolean = false): string {
if (isLeapMonth) {
return '';
}
const festivals: Record<string, string> = {
'1-1': '春节',
'1-2': '开年',
'1-3': '赤狗日',
'1-5': '破五',
'1-7': '人日',
'1-15': '元宵节',
'2-2': '龙抬... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/utils/LunarCalendar.ets#L396-L443 | e8216d9827753c35544711138f808bd83a711d08 | github |
Application-Security-Automation/Arktan.git | 3ad9cb05235e38b00cd5828476aa59a345afa1c0 | dataset/accuracy/flow_sensitive/loop_stmt/dowhile_body_002_F.ets | arkts | Introduction 循环结构-dowhile | export function dowhile_body_002_F(taint_src : string) {
let res = ""
do {
taint.Sink(res)
res = taint_src
} | AST#export_declaration#Left export AST#function_declaration#Left function dowhile_body_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_statement#... | export function dowhile_body_002_F(taint_src : string) {
let res = ""
do {
taint.Sink(res)
res = taint_src
} | https://github.com/Application-Security-Automation/Arktan.git/blob/3ad9cb05235e38b00cd5828476aa59a345afa1c0/dataset/accuracy/flow_sensitive/loop_stmt/dowhile_body_002_F.ets#L6-L11 | b78912408ffa28e67dc43307ecf5194860be6664 | github | |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets | arkts | convertSelectedGoodsToCartList | 将已选商品列表转换为购物车列表
@param {SelectedGoods[]} goodsList 已选商品列表
@returns {Cart[]} 购物车列表 | private convertSelectedGoodsToCartList(goodsList: SelectedGoods[]): Cart[] {
// 按商品ID分组
const groupedMap = new Map<number, SelectedGoods[]>();
for (const goods of goodsList) {
const existingList = groupedMap.get(goods.goodsId);
if (existingList) {
existingList.push(goods);
} else ... | AST#method_declaration#Left private convertSelectedGoodsToCartList AST#parameter_list#Left ( AST#parameter#Left goodsList : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left SelectedGoods [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#... | private convertSelectedGoodsToCartList(goodsList: SelectedGoods[]): Cart[] {
const groupedMap = new Map<number, SelectedGoods[]>();
for (const goods of goodsList) {
const existingList = groupedMap.get(goods.goodsId);
if (existingList) {
existingList.push(goods);
} else {
... | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets#L135-L182 | 0f5b7095fecad596e26d5eaca6178cd8e3a5bb61 | github |
Rayawa/dashboard.git | 9107efe7fb69a58d799a378b79ea8ffa4041cec8 | entry/src/main/ets/common/utils.ets | arkts | 解析输入字符串,提取链接、包名和app_id
@param inputStr 输入的字符串
@returns 包含links, pkgs, app_ids的对象 | export function parseInputSplitLinksPkgsAndAppIds(inputStr: string): LinksPkgsAppIds {
inputStr = inputStr.trim();
if (!inputStr) {
return new LinksPkgsAppIdsClass();
}
// 支持更多分隔符:空格、换行、逗号、分号、竖线等
const parts = inputStr.split(/[\s\n,;|]+/);
const urlLike = /^https?:\/\/[^\s]+$/;
// ... | AST#export_declaration#Left export AST#function_declaration#Left function parseInputSplitLinksPkgsAndAppIds AST#parameter_list#Left ( AST#parameter#Left inputStr : 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#... | export function parseInputSplitLinksPkgsAndAppIds(inputStr: string): LinksPkgsAppIds {
inputStr = inputStr.trim();
if (!inputStr) {
return new LinksPkgsAppIdsClass();
}
const parts = inputStr.split(/[\s\n,;|]+/);
const urlLike = /^https?:\/\/[^\s]+$/;
const appIdRegex = /^[Cc... | https://github.com/Rayawa/dashboard.git/blob/9107efe7fb69a58d799a378b79ea8ffa4041cec8/entry/src/main/ets/common/utils.ets#L31-L173 | 65a778ef79b5e036f1f8a6fbbe6e40e08a6a65a2 | github | |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets | arkts | addData | Add data to targetData.
@param Data of the RecordItemBean type to be added. | addData(data: TaskItemViewModel) {
if (!data) {
Logger.error(TAG, 'addData error because data is: ' + data);
return;
}
this.targetData.push(data);
} | AST#method_declaration#Left addData AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left TaskItemViewModel AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#if_statement#Left if ... | addData(data: TaskItemViewModel) {
if (!data) {
Logger.error(TAG, 'addData error because data is: ' + data);
return;
}
this.targetData.push(data);
} | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets#L62-L68 | cbfe81e6fe8069154dbac326b0f19d1c40f33e6b | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets | arkts | prepared | video component prepared callback | prepared(duration: number) {
this.durationTime = duration;
let second: number = duration % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((duration / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_S... | AST#method_declaration#Left prepared AST#parameter_list#Left ( AST#parameter#Left duration : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left A... | prepared(duration: number) {
this.durationTime = duration;
let second: number = duration % COMMON_NUM_MINUTE;
let min: number = Number.parseInt((duration / COMMON_NUM_MINUTE).toString());
let head = min < COMMON_NUM_DOUBLE ? `${ZERO_STR}${min}` : min;
let end = second < COMMON_NUM_DOUBLE ? `${ZERO_S... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets#L87-L95 | 7d40bd5850a490c40c0643165319324b9d829d89 | gitee |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | get_all_match_domains | Gets a list of all tabs' domains.
@returns A string[][] array, the [scheme, domain]. | get_all_match_domains() {
let match: string[][] = [];
for (let index = 0; index < this.Tabs.length; index++) {
match.push(match_domain(this.Tabs[index].url));
}
return match;
} | AST#method_declaration#Left get_all_match_domains AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left let AST#variable_declarator#Left match : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] [ ] AST#array_type#Rig... | get_all_match_domains() {
let match: string[][] = [];
for (let index = 0; index < this.Tabs.length; index++) {
match.push(match_domain(this.Tabs[index].url));
}
return match;
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L584-L591 | 6c18c75d067d55bdb3be63a2eca06684eedbfc2c | gitee |
openharmony-tpc/ohos_mpchart | 4fb43a7137320ef2fee2634598f53d93975dfb4a | library/src/main/ets/components/buffer/AbstractBuffer.ets | arkts | setPhases | Set the phases used for animations.
@param phaseX
@param phaseY | public setPhases(phaseX: number, phaseY: number): void {
this.phaseX = phaseX;
this.phaseY = phaseY;
} | AST#method_declaration#Left public setPhases AST#parameter_list#Left ( AST#parameter#Left phaseX : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left phaseY : AST#type_annotation#Left AST#primary_type#Left number AST#primary_ty... | public setPhases(phaseX: number, phaseY: number): void {
this.phaseX = phaseX;
this.phaseY = phaseY;
} | https://github.com/openharmony-tpc/ohos_mpchart/blob/4fb43a7137320ef2fee2634598f53d93975dfb4a/library/src/main/ets/components/buffer/AbstractBuffer.ets#L78-L81 | 749e8be545ada78fd86fcbf3239778624ec29d00 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/services/storage/PreferencesService.ets | arkts | putNumber | 存储数字值
@param key 键
@param value 值 | async putNumber(key: string, value: number): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogCons... | AST#method_declaration#Left async putNumber AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left value : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Ri... | async putNumber(key: string, value: number): Promise<void> {
try {
this.checkInitialized();
await this.dataPreferences!.put(key, value);
await this.dataPreferences!.flush();
} catch (error) {
const businessError = error as BusinessError;
hilog.error(LogConstants.DOMAIN_APP, LogCons... | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/services/storage/PreferencesService.ets#L98-L108 | f3d47d371207d7e28c3a2cf1af2c3e8af9115485 | github |
salehelper/algorithm_arkts.git | 61af15272038646775a4745fca98a48ba89e1f4e | entry/src/main/ets/utils/Logger.ets | arkts | error | 输出错误日志
@param message 日志信息 | public static error(message: string): void {
console.error(`[${Logger.TAG}] ${message}`);
} | AST#method_declaration#Left public static error AST#parameter_list#Left ( AST#parameter#Left message : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left void AST#primary_t... | public static error(message: string): void {
console.error(`[${Logger.TAG}] ${message}`);
} | https://github.com/salehelper/algorithm_arkts.git/blob/61af15272038646775a4745fca98a48ba89e1f4e/entry/src/main/ets/utils/Logger.ets#L27-L29 | 0eb40a070c3a1729880beafc9d83bdc5fc02816a | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets | arkts | 此时可能预期全局变量someGlobalVar的值为100 | export function useGlobalVar() {
console.log(data1);
console.log(globalThis.someGlobalVar); // 此时由于main.ets中加载了sideEffectModule模块,someGlobalVar的值已经被改为200
} | AST#export_declaration#Left export AST#function_declaration#Left function useGlobalVar AST#parameter_list#Left ( ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#expression_statement#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expressi... | export function useGlobalVar() {
console.log(data1);
console.log(globalThis.someGlobalVar);
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkTS/ArkTSRuntime/ArkTSModule/ModuleLoadingSideEffects/entry/src/main/ets/pages/ModifyGlobalObject/moduleUseGlobalVar.ets#L19-L22 | b5fb7547b35b1626f3f21077220ba5f3dbd0d4a4 | gitee | |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.file.AlbumPickerComponent.d.ets | arkts | AlbumInfo: include album uri
@syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
@atomicservice
@since 12 | export declare class AlbumInfo {
/**
* Album uri
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/
uri?: string;
/**
* Album name
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#class_declaration#Left class AlbumInfo AST#class_body#Left { /**
* Album uri
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core
* @atomicservice
* @since 12
*/ AST#property_declaration#... | export declare class AlbumInfo {
uri?: string;
albumName?: string;
} | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.file.AlbumPickerComponent.d.ets#L131-L151 | 6a892483bab1bd4621b6aff3ea09efe805c9f975 | gitee | |
kumaleap/ArkSwipeDeck.git | 5afa77b9b2a2a531595d31f895c54a3371e4249a | library/src/main/ets/utils/AnimationUtils.ets | arkts | createSpringCurve | 创建弹簧曲线动画
@param stiffness - 刚度
@param damping - 阻尼
@param mass - 质量
@returns 弹簧曲线 | static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
} | AST#method_declaration#Left static createSpringCurve AST#parameter_list#Left ( AST#parameter#Left stiffness : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#member_expression#Left AST#expression#Left AnimationConstants AST#expression#Righ... | static createSpringCurve(
stiffness: number = AnimationConstants.SPRING_STIFFNESS,
damping: number = AnimationConstants.SPRING_DAMPING,
mass: number = AnimationConstants.SPRING_MASS
): ICurve {
return curves.springCurve(stiffness, damping, mass, 0);
} | https://github.com/kumaleap/ArkSwipeDeck.git/blob/5afa77b9b2a2a531595d31f895c54a3371e4249a/library/src/main/ets/utils/AnimationUtils.ets#L26-L32 | 001cb780e04f3451b4489a06f6a5d838244fa9ca | github |
L1rics06/arkTS-.git | 991fd131bfdb11e2933152133c97453d86092ac0 | entry/src/main/ets/pages/NetworkUtil.ets | arkts | mergeHeaders | 合并请求头 | static mergeHeaders(contentType: string): Record<string, string> {
const headers: Record<string, string> = {
"Content-Type": contentType,
"token": authToken
};
const authHeader = NetworkUtil.getAuthHeader();
if (authHeader.Authorization) {
headers.Authorization = authHeader.Authoriza... | AST#method_declaration#Left static mergeHeaders AST#parameter_list#Left ( AST#parameter#Left contentType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_ty... | static mergeHeaders(contentType: string): Record<string, string> {
const headers: Record<string, string> = {
"Content-Type": contentType,
"token": authToken
};
const authHeader = NetworkUtil.getAuthHeader();
if (authHeader.Authorization) {
headers.Authorization = authHeader.Authoriza... | https://github.com/L1rics06/arkTS-.git/blob/991fd131bfdb11e2933152133c97453d86092ac0/entry/src/main/ets/pages/NetworkUtil.ets#L252-L264 | 145b5d771e42907b1badfde167440d182ec0eb7d | github |
euler1129/Cloud-flash-payment.git | dfb70c1c67b3b69447f4384661e16b60f40495de | entry/src/main/ets/pages/card/components/publicComp/SubHead.ets | arkts | 模块的头部 | @Builder export default function SubHead (name: string, desc: string, right?: string, callBack?:()=>void) {
Row() {
Row() {
Text(name)
.fontWeight(FontWeight.Bold)
.fontSize(16)
.margin({right: 10})
Text(`| ${desc}`).fontSize(10).fontColor('#999')
}
Row() {
Text(`... | AST#decorated_export_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right export default AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#call_expre... | @Builder export default function SubHead (name: string, desc: string, right?: string, callBack?:()=>void) {
Row() {
Row() {
Text(name)
.fontWeight(FontWeight.Bold)
.fontSize(16)
.margin({right: 10})
Text(`| ${desc}`).fontSize(10).fontColor('#999')
}
Row() {
Text(`... | https://github.com/euler1129/Cloud-flash-payment.git/blob/dfb70c1c67b3b69447f4384661e16b60f40495de/entry/src/main/ets/pages/card/components/publicComp/SubHead.ets#L2-L22 | 54a276fdca40aecf5bc966e882711fc5f9697978 | github | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/game/GameificationService.ets | arkts | getAchievements | 获取成就列表 | getAchievements(includeHidden: boolean = false): Achievement[] {
if (!this.userGameData) {
return [];
}
return this.userGameData.achievements.filter(achievement =>
includeHidden || !achievement.isHidden || achievement.isUnlocked
);
} | AST#method_declaration#Left getAchievements AST#parameter_list#Left ( AST#parameter#Left includeHidden : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right = AST#expression#Left AST#boolean_literal#Left false AST#boolean_literal#Right AST#expression#Right AST#paramet... | getAchievements(includeHidden: boolean = false): Achievement[] {
if (!this.userGameData) {
return [];
}
return this.userGameData.achievements.filter(achievement =>
includeHidden || !achievement.isHidden || achievement.isUnlocked
);
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/game/GameificationService.ets#L450-L458 | 4f009e183a5626eaa9e010f160e074f77be8949a | github |
BohanSu/LumosAgent-HarmonyOS.git | 9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76 | entry/src/main/ets/services/TextToSpeechService.ets | arkts | cleanTextForTTS | 清理文本用于TTS播放
移除emoji、markdown格式等不适合朗读的内容 | private cleanTextForTTS(text: string): string {
let cleaned = text;
// 移除emoji(保留基本字符)
cleaned = cleaned.replace(/[\u{1F600}-\u{1F64F}]/gu, ''); // 表情
cleaned = cleaned.replace(/[\u{1F300}-\u{1F5FF}]/gu, ''); // 符号和图形
cleaned = cleaned.replace(/[\u{1F680}-\u{1F6FF}]/gu, ''); // 交通工具
cleaned = c... | AST#method_declaration#Left private cleanTextForTTS AST#parameter_list#Left ( AST#parameter#Left text : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | private cleanTextForTTS(text: string): string {
let cleaned = text;
cleaned = cleaned.replace(/[\u{1F600}-\u{1F64F}]/gu, '');
cleaned = cleaned.replace(/[\u{1F300}-\u{1F5FF}]/gu, '');
cleaned = cleaned.replace(/[\u{1F680}-\u{1F6FF}]/gu, '');
cleaned = cleaned.replace(/[\u{2600}-\u{26FF}]/gu... | https://github.com/BohanSu/LumosAgent-HarmonyOS.git/blob/9eee81c93b67318d9c1c5d5a831ffc1c1fa08e76/entry/src/main/ets/services/TextToSpeechService.ets#L300-L340 | 1f216c5b807b2584a494b669724c83a5d42b8c89 | github |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets | arkts | getReferenceLineBol | Persist the reference line, enter again to determine if the switch is turned on | getReferenceLineBol(bol: boolean) {
this.settingDataObj.referenceLineBol = bol;
this.referenceLineBol = bol;
} | AST#method_declaration#Left getReferenceLineBol AST#parameter_list#Left ( AST#parameter#Left bol : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_statement#Left AST#exp... | getReferenceLineBol(bol: boolean) {
this.settingDataObj.referenceLineBol = bol;
this.referenceLineBol = bol;
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/BasicFeature/Media/Camera/entry/src/main/ets/Dialog/SettingDialog.ets#L54-L57 | 1418a30d1c93f990805b68ae56f3e786389af9f6 | gitee |
YShelter/Accouting_ArkTS.git | 8c663c85f2c11738d4eabf269c23dc1ec84eb013 | entry/src/main/ets/view/Home/WeekCalendarComponent.ets | arkts | 默认滑动宽度后切换页面 | build() {
Row() {
Column() {
Row() {
this.ArrowIcon(false) // 左箭头
BalanceText({
title: this.homeStore.dateTitle,
fontSize: $r('app.float.default_16')
})
this.ArrowIcon(true) // 右箭头
}
.justifyContent(FlexAlign.Center)
... | AST#build_method#Left build ( ) AST#build_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Row ( ) AST#container_content_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts_ui_... | build() {
Row() {
Column() {
Row() {
this.ArrowIcon(false)
BalanceText({
title: this.homeStore.dateTitle,
fontSize: $r('app.float.default_16')
})
this.ArrowIcon(true)
}
.justifyContent(FlexAlign.Center)
.onClick(... | https://github.com/YShelter/Accouting_ArkTS.git/blob/8c663c85f2c11738d4eabf269c23dc1ec84eb013/entry/src/main/ets/view/Home/WeekCalendarComponent.ets#L17-L51 | 9a9d32d14843b9f9b67f8c6497156454cf4bb1fd | github | |
Lateautumn00/HarmonyOS_WeChat.git | 88993b308d5018c11d4e6ddf7838a96c6384201c | entry/src/main/ets/pages/Chat.ets | arkts | getListAll | 列表的每一列 群聊天 | @Builder getListAll(myCode:string,item:List){
Flex({justifyContent:FlexAlign.Start,alignItems:ItemAlign.Center,direction:myCode==item.code?FlexDirection.RowReverse:FlexDirection.Row}){
Image(item.image).width(50).height(50).borderRadius(50).margin({right:10,left:10})
Column(){
if(myCode!... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right getListAll AST#parameter_list#Left ( AST#parameter#Left myCode : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left item : AST#type_annotation#Left AS... | @Builder getListAll(myCode:string,item:List){
Flex({justifyContent:FlexAlign.Start,alignItems:ItemAlign.Center,direction:myCode==item.code?FlexDirection.RowReverse:FlexDirection.Row}){
Image(item.image).width(50).height(50).borderRadius(50).margin({right:10,left:10})
Column(){
if(myCode!... | https://github.com/Lateautumn00/HarmonyOS_WeChat.git/blob/88993b308d5018c11d4e6ddf7838a96c6384201c/entry/src/main/ets/pages/Chat.ets#L143-L167 | 5cc229f06afa22e63ec101730822ca3f3878a9db | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets | arkts | BaseNetWorkViewModel | @file 网络请求 ViewModel 基类
@description 提供通用的网络请求 ViewModel 基类,包含 UI 状态管理和请求执行逻辑。
@param T 网络请求数据项类型
@author Joker.X | @ObservedV2
export abstract class BaseNetWorkViewModel<T> extends BaseViewModel {
/**
* 通用网络请求 UI 状态
*/
@Trace
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
/**
* 请求成功后的数据
*/
@Trace
data: T | null = null;
/**
* 控制请求失败时是否显示 Toast 提示
*/
protected showErrorToast: boolean = fal... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export abstract class BaseNetWorkViewModel 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 BaseViewModel AST#primary_... | @ObservedV2
export abstract class BaseNetWorkViewModel<T> extends BaseViewModel {
@Trace
uiState: BaseNetWorkUiState = BaseNetWorkUiState.LOADING;
@Trace
data: T | null = null;
protected showErrorToast: boolean = false;
protected abstract requestRepository(): Promise<NetworkResponse<T>>;
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets#L12-L114 | b186cd90614c1dc15ef3589d4b56f16bbfbb8e20 | github |
Joker-x-dev/HarmonyKit.git | f97197ce157df7f303244fba42e34918306dfb08 | feature/main/src/main/ets/viewmodel/AboutViewModel.ets | arkts | @file 关于页面 ViewModel
@author Joker.X | @ObservedV2
export default class AboutViewModel extends BaseViewModel {
/**
* UIAbility 上下文
*/
private context: common.UIAbilityContext = ContextUtil.getUIAbilityCtx();
/**
* 关于页面链接列表
*/
readonly links: AboutLinkItem[] = [
{
title: $r("app.string.main_about_link_doc_title"),
url: $r(... | AST#decorated_export_declaration#Left AST#decorator#Left @ ObservedV2 AST#decorator#Right export default AST#class_declaration#Left class AboutViewModel extends AST#type_annotation#Left AST#primary_type#Left BaseViewModel AST#primary_type#Right AST#type_annotation#Right AST#class_body#Left { /**
* UIAbility 上下文
*... | @ObservedV2
export default class AboutViewModel extends BaseViewModel {
private context: common.UIAbilityContext = ContextUtil.getUIAbilityCtx();
readonly links: AboutLinkItem[] = [
{
title: $r("app.string.main_about_link_doc_title"),
url: $r("app.string.main_about_link_doc_url")
},
{
... | https://github.com/Joker-x-dev/HarmonyKit.git/blob/f97197ce157df7f303244fba42e34918306dfb08/feature/main/src/main/ets/viewmodel/AboutViewModel.ets#L11-L71 | 349d5bb5f940ad39a66f0889fdbd6c6ffca5e8dd | github | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets | arkts | getDlpPermission | 获取沙箱权限 | async getDlpPermission(): Promise<void> {
dlpPermission.getDLPPermissionInfo().then((data: dlpPermission.DLPPermissionInfo) => {
Logger.info(TAG, 'getDLPPermissionInfo, result: ' + JSON.stringify(data));
promptAction.showToast({ message: 'permission:' + decodeURIComponent(JSON.stringify(data)), duration... | AST#method_declaration#Left async getDlpPermission 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... | async getDlpPermission(): Promise<void> {
dlpPermission.getDLPPermissionInfo().then((data: dlpPermission.DLPPermissionInfo) => {
Logger.info(TAG, 'getDLPPermissionInfo, result: ' + JSON.stringify(data));
promptAction.showToast({ message: 'permission:' + decodeURIComponent(JSON.stringify(data)), duration... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/SystemFeature/Security/DLPManager/entry/src/main/ets/media/dlpPage.ets#L84-L91 | fb7d151dd4c272bf72ef8f3349816cabc40a3a60 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/services/accessibility/AccessibilityService.ets | arkts | toggleVoiceOver | 切换语音朗读 | async toggleVoiceOver(enabled: boolean): Promise<void> {
await this.updateSettings({ voiceOverEnabled: enabled });
this.isVoiceOverActive = enabled;
if (enabled) {
await this.speak('语音朗读已开启');
}
} | AST#method_declaration#Left async toggleVoiceOver AST#parameter_list#Left ( AST#parameter#Left enabled : AST#type_annotation#Left AST#primary_type#Left boolean AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_typ... | async toggleVoiceOver(enabled: boolean): Promise<void> {
await this.updateSettings({ voiceOverEnabled: enabled });
this.isVoiceOverActive = enabled;
if (enabled) {
await this.speak('语音朗读已开启');
}
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/services/accessibility/AccessibilityService.ets#L274-L281 | f44ca022c62f12bd45dc89cccc4b83371dea3670 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_web/src/main/ets/arkweb/ArkJsObject.ets | arkts | runJavaScriptFun | 异步执行JavaScript方法
@param funName 方法名
@param param 方法参数
@returns | async runJavaScriptFun(funName: string, param?: string): Promise<string> {
if (this.controller) {
return ArkWebHelper.runJavaScriptFun(this.controller, funName, param);
}
return '';
} | AST#method_declaration#Left async runJavaScriptFun AST#parameter_list#Left ( AST#parameter#Left funName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left param ? : AST#type_annotation#Left AST#primary_type#Left string AST#pr... | async runJavaScriptFun(funName: string, param?: string): Promise<string> {
if (this.controller) {
return ArkWebHelper.runJavaScriptFun(this.controller, funName, param);
}
return '';
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_web/src/main/ets/arkweb/ArkJsObject.ets#L67-L72 | ef2a01c5cf4eaaa922b2c9a6c131b106159cea8d | gitee |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | ComponentEncapsulation/entry/src/main/ets/pages/EmitterCallPage.ets | arkts | ChildComponent | [Start emitter] | @Component
export struct ChildComponent {
public static readonly EVENT_ID_SWITCH_COLOR = 'SWITCH_COLOR';
@State bgColor: ResourceColor = Color.White;
private switchColor = () => {
if (this.bgColor === Color.White) {
this.bgColor = Color.Red;
} else {
this.bgColor = Color.White;
}
}
ab... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct ChildComponent AST#component_body#Left { AST#property_declaration#Left public static readonly EVENT_ID_SWITCH_COLOR = AST#expression#Left 'SWITCH_COLOR' AST#expression#Right ; AST#property_declaration#Right AST#proper... | @Component
export struct ChildComponent {
public static readonly EVENT_ID_SWITCH_COLOR = 'SWITCH_COLOR';
@State bgColor: ResourceColor = Color.White;
private switchColor = () => {
if (this.bgColor === Color.White) {
this.bgColor = Color.Red;
} else {
this.bgColor = Color.White;
}
}
ab... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/ComponentEncapsulation/entry/src/main/ets/pages/EmitterCallPage.ets#L18-L32 | d176d16264212c153b8215f247de6c4ae34feb09 | gitee |
Duke_Bit/logan | 37ce340f90e508cbf3914162df2254aca76a525a | core/src/main/ets/Logan.ets | arkts | @brief 返回所有日志文件信息 | export async function getAllFilesInfo(): Promise<Map<string, number>> {
let dir = LoganControlCenter.instance().dir
let allFilesInfo = new Map<string, number>()
if (!dir) {
return allFilesInfo
}
if (!dir.endsWith('/')) {
dir = dir + "/"
}
return fileIo.listFile(dir).then((files) ... | AST#export_declaration#Left export AST#function_declaration#Left async function getAllFilesInfo AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promise AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Le... | export async function getAllFilesInfo(): Promise<Map<string, number>> {
let dir = LoganControlCenter.instance().dir
let allFilesInfo = new Map<string, number>()
if (!dir) {
return allFilesInfo
}
if (!dir.endsWith('/')) {
dir = dir + "/"
}
return fileIo.listFile(dir).then((files) ... | https://github.com/Duke_Bit/logan/blob/37ce340f90e508cbf3914162df2254aca76a525a/core/src/main/ets/Logan.ets#L92-L109 | 18d441b0cca7616f40d582a851ef45b1ee10449e | gitee | |
wuyuanwuhui99/harmony-arkts-music-app-ui.git | fc75b993b76293666f9122f527ea3bc6caf7f75c | entry/src/main/ets/components/MusicMyComponent.ets | arkts | useMusicFavoriteList | @description: 跳转到歌单列表页
@date: 2024-07-16 22:37
@author wuwenqiang | useMusicFavoriteList(item:FavoriteDirectoryInterface){
router.pushUrl({
url: 'pages/MusicFavoriteListPage', // 目标url
params: {
favoriteDirectory: item
}
});
} | AST#method_declaration#Left useMusicFavoriteList AST#parameter_list#Left ( AST#parameter#Left item : AST#type_annotation#Left AST#primary_type#Left FavoriteDirectoryInterface AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#builder_function_body#Left { AST#expression_s... | useMusicFavoriteList(item:FavoriteDirectoryInterface){
router.pushUrl({
url: 'pages/MusicFavoriteListPage',
params: {
favoriteDirectory: item
}
});
} | https://github.com/wuyuanwuhui99/harmony-arkts-music-app-ui.git/blob/fc75b993b76293666f9122f527ea3bc6caf7f75c/entry/src/main/ets/components/MusicMyComponent.ets#L49-L56 | 90f7989111242b6ff829999df43d4ff750cd11b9 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets | arkts | RGB颜色类型 | export interface ColorRgb {
// 红色(Red)
red: number;
// 绿色(Green)
green: number;
// 蓝色(Blue)
blue: number;
// 透明度
alpha: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ColorRgb AST#object_type#Left { // 红色(Red) AST#type_member#Left red : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#type_member#Right ; // 绿色(Green) AST#type_member#Left green : AST#t... | export interface ColorRgb {
red: number;
green: number;
blue: number;
alpha: number;
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/iconmaincolor/src/main/ets/components/utils/ColorUtils.ets#L19-L31 | acaf09e1568339b7da0a59a7ae13748543afd1f9 | gitee | |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | entry/src/main/ets/common/types/SettingsTypes.ets | arkts | 同步提供商枚举 | export enum SyncProvider {
ICLOUD = 'icloud',
GOOGLE = 'google',
MICROSOFT = 'microsoft',
CUSTOM = 'custom'
} | AST#export_declaration#Left export AST#enum_declaration#Left enum SyncProvider AST#enum_body#Left { AST#enum_member#Left ICLOUD = AST#expression#Left 'icloud' AST#expression#Right AST#enum_member#Right , AST#enum_member#Left GOOGLE = AST#expression#Left 'google' AST#expression#Right AST#enum_member#Right , AST#enum_mem... | export enum SyncProvider {
ICLOUD = 'icloud',
GOOGLE = 'google',
MICROSOFT = 'microsoft',
CUSTOM = 'custom'
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/entry/src/main/ets/common/types/SettingsTypes.ets#L440-L445 | acadcddd24cb8305a0e92821a4503d48e77dacd3 | github | |
awa_Liny/LinysBrowser_NEXT | a5cd96a9aa8114cae4972937f94a8967e55d4a10 | home/src/main/ets/hosts/bunch_of_tabs.ets | arkts | goForward_onWorkingTab | Try to go forward on current main tab.
@returns true if success.
@returns false if failed, perhaps there is no way forward. | goForward_onWorkingTab() {
if (this.Tabs[this.main_tab_idx].controller?.accessForward()) {
this.Tabs[this.main_tab_idx].controller?.forward();
}
} | AST#method_declaration#Left goForward_onWorkingTab 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#call_expression#Left AST#expression#Left AST#member_expression#Left AST#expression#Left AST#member_expre... | goForward_onWorkingTab() {
if (this.Tabs[this.main_tab_idx].controller?.accessForward()) {
this.Tabs[this.main_tab_idx].controller?.forward();
}
} | https://github.com/awa_Liny/LinysBrowser_NEXT/blob/a5cd96a9aa8114cae4972937f94a8967e55d4a10/home/src/main/ets/hosts/bunch_of_tabs.ets#L103-L107 | bc2544c7b65ccd099379e88f5def3d84c7838651 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/blendmode/src/main/ets/model/DataSource.ets | arkts | getData | 获取当前下标的数据
@param index 下标
@returns 当前下标所对应的数据 | getData(index: number): PendantType {
return this.pendantData[index];
} | AST#method_declaration#Left 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 PendantType AST#primary_type#Rig... | getData(index: number): PendantType {
return this.pendantData[index];
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/blendmode/src/main/ets/model/DataSource.ets#L93-L95 | 12610214d509f019022e2f696e0ef2307fdd0adc | gitee |
fengcreate/harmony-document | 798534b0f76399dc84e7940f5b14b3ae4e53c6a9 | BackupRestore/entry/src/main/ets/restore/sp/SpTransferManager.ets | arkts | moveSpFile | Move HarmonyOS 4.0 XML file to HarmonyOS NEXT.
@param context context.
@return success return true, failed return false. | private moveSpFile(context: common.Context): boolean {
try {
let sourceSpPath = '/data/storage/el2/backup/restore/com.example.backuprestore/ce/shared_prefs';
if (!fileIo.accessSync(sourceSpPath)) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, ${sourceSpPath} can't access`)... | AST#method_declaration#Left private moveSpFile AST#parameter_list#Left ( AST#parameter#Left context : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#typ... | private moveSpFile(context: common.Context): boolean {
try {
let sourceSpPath = '/data/storage/el2/backup/restore/com.example.backuprestore/ce/shared_prefs';
if (!fileIo.accessSync(sourceSpPath)) {
hilog.error(0x0000, 'BackupRestore SpTransferManager', `moveSpFile, ${sourceSpPath} can't access`)... | https://github.com/fengcreate/harmony-document/blob/798534b0f76399dc84e7940f5b14b3ae4e53c6a9/BackupRestore/entry/src/main/ets/restore/sp/SpTransferManager.ets#L81-L109 | 7ddcfcbb223f658348b39af83cf9148714eb9a9a | gitee |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets | arkts | tabBuilderTwo | [StartExclude switch_the_tab_to_a_specific_tab] | @Builder
tabBuilderTwo(title: ResourceStr, targetIndex: number) {
Column() {
Text(title)
.fontColor(this.currentIndexTwo === targetIndex ? '#F111C1' : '#6B6B6B')
}
} | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right tabBuilderTwo AST#parameter_list#Left ( AST#parameter#Left title : AST#type_annotation#Left AST#primary_type#Left ResourceStr AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left targetIndex : AST#type_anno... | @Builder
tabBuilderTwo(title: ResourceStr, targetIndex: number) {
Column() {
Text(title)
.fontColor(this.currentIndexTwo === targetIndex ? '#F111C1' : '#6B6B6B')
}
} | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/ArkUISample/ScrollableComponent/entry/src/main/ets/pages/tabs/ContentWillChange.ets#L40-L46 | 52b9e3c6d8c5b6161def78291ce00385130b971a | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handletabs/Index.ets | arkts | HandleTabsComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export {HandleTabsComponent} from './src/main/ets/pages/HandleTabs'; | AST#export_declaration#Left export { HandleTabsComponent } from './src/main/ets/pages/HandleTabs' ; AST#export_declaration#Right | export {HandleTabsComponent} from './src/main/ets/pages/HandleTabs'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/Index.ets#L15-L15 | e606ae32464f7da02d714fb06499303ee823f651 | gitee |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets | arkts | VideoPlayer | video controller component | @Component
export struct VideoPlayer {
private source: string | Resource = '';
private controller: VideoController = new VideoController();
private previewUris: Resource = $r('app.media.ic_preview');
@Provide currentTime: number = 0;
@Provide durationTime: number = 0;
@Provide durationStringTime: string = S... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct VideoPlayer AST#component_body#Left { AST#property_declaration#Left private source : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left string AST#primary_type#Right | AST#primary_type#Left Resource AS... | @Component
export struct VideoPlayer {
private source: string | Resource = '';
private controller: VideoController = new VideoController();
private previewUris: Resource = $r('app.media.ic_preview');
@Provide currentTime: number = 0;
@Provide durationTime: number = 0;
@Provide durationStringTime: string = S... | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/Media/SimpleVideo/entry/src/main/ets/view/VideoPlayer.ets#L34-L104 | 503e213942f659782696e6dd860ed3dc4a7e0e52 | gitee |
openharmony/interface_sdk-js | c349adc73e2ec1f61f6fca489b5af059e3ed6999 | api/@ohos.atomicservice.InterstitialDialogAction.d.ets | arkts | Defines the properties required by the dialog.
@interface DialogOptions
@syscap SystemCapability.ArkUI.ArkUI.Full
@atomicservice
@since 12 | export declare interface DialogOptions {
/**
* The UIContext required by the dialog.
*
* @type { UIContext }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since 12
*/
uiContext: UIContext;
/**
* The type of the bottom offset.
*
* @type { ?B... | AST#export_declaration#Left export AST#ERROR#Left declare AST#ERROR#Right AST#interface_declaration#Left interface DialogOptions AST#object_type#Left { /**
* The UIContext required by the dialog.
*
* @type { UIContext }
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @atomicservice
* @since ... | export declare interface DialogOptions {
uiContext: UIContext;
bottomOffsetType?: BottomOffset
title?: ResourceStr;
subtitle?: ResourceStr;
titleColor?: ResourceStr | Color;
subtitleColor?: ResourceStr | Color;
backgroundImage?: Resource;
foregroun... | https://github.com/openharmony/interface_sdk-js/blob/c349adc73e2ec1f61f6fca489b5af059e3ed6999/api/@ohos.atomicservice.InterstitialDialogAction.d.ets#L108-L217 | 7f214bb19f7730a090d4c5031b32088d4c85b5b5 | gitee | |
openharmony/applications_app_samples | a826ab0e75fe51d028c1c5af58188e908736b53b | code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets | arkts | 分享应用文件 | export async function shareFile(fileName: string): Promise<void> {
// 获取文件的沙箱路径
let pathInSandbox = context.filesDir + '/' + fileName + '.txt';
// 将沙箱路径转换为uri
let uri = fileUri.getUriFromPath(pathInSandbox);
// [End get_uri]
Logger.info('FilePath is : ' + uri);
let want: Want = {
// 配置被分享文件的读写权限,例如对被分... | AST#export_declaration#Left export AST#function_declaration#Left async function shareFile 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#Le... | export async function shareFile(fileName: string): Promise<void> {
let pathInSandbox = context.filesDir + '/' + fileName + '.txt';
let uri = fileUri.getUriFromPath(pathInSandbox);
Logger.info('FilePath is : ' + uri);
let want: Want = {
flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION |... | https://github.com/openharmony/applications_app_samples/blob/a826ab0e75fe51d028c1c5af58188e908736b53b/code/DocsSample/CoreFile/SandBoxShare/entry/src/main/ets/fileFs/FileFs.ets#L31-L53 | 16efd10bd698bc521678f223144c2566b8c16e73 | gitee | |
hqj201013136012/HarmonyMiliUiPro.git | 0625e681e07b771998a0ac4430824627d0eb60ed | entry/src/main/ets/itemview/ItemSetCommonView.ets | arkts | ItemSetCommonView | 通用的设置ItemView | @ComponentV2
export struct ItemSetCommonView {
@Require @Param itemData: SetItemData
build() {
Column() {
if (this.itemData.itemType == SetItemType.SwitchItem) {
RelativeContainer() {
Column() {
Text(this.itemData.name)
.fontColor('#ffffff')
.font... | AST#decorated_export_declaration#Left AST#decorator#Left @ ComponentV2 AST#decorator#Right export struct ItemSetCommonView AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Require AST#decorator#Right AST#decorator#Left @ Param AST#decorator#Right itemData : AST#type_annotation#Left AST#prima... | @ComponentV2
export struct ItemSetCommonView {
@Require @Param itemData: SetItemData
build() {
Column() {
if (this.itemData.itemType == SetItemType.SwitchItem) {
RelativeContainer() {
Column() {
Text(this.itemData.name)
.fontColor('#ffffff')
.font... | https://github.com/hqj201013136012/HarmonyMiliUiPro.git/blob/0625e681e07b771998a0ac4430824627d0eb60ed/entry/src/main/ets/itemview/ItemSetCommonView.ets#L6-L163 | 27cdc50b72ea30fc2a2ce79d11da489505a4dae6 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets | arkts | updateTableName | 修改表名
@param oldTableName 旧表名
@param newTableName 新表名 | async updateTableName(oldTableName: string, newTableName: string): Promise<void> {
if (store === undefined) {
return;
}
const updateTableSql: string = util.format(Constants.UPDATE_TABLE_SQL_TEMPLATE, oldTableName, newTableName);
try {
await store.executeSql(updateTableSql);
} catch (err)... | AST#method_declaration#Left async updateTableName AST#parameter_list#Left ( AST#parameter#Left oldTableName : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left newTableName : AST#type_annotation#Left AST#primary_type#Left stri... | async updateTableName(oldTableName: string, newTableName: string): Promise<void> {
if (store === undefined) {
return;
}
const updateTableSql: string = util.format(Constants.UPDATE_TABLE_SQL_TEMPLATE, oldTableName, newTableName);
try {
await store.executeSql(updateTableSql);
} catch (err)... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets#L96-L106 | ef83182677a608cda8ff69f1703ad30d242eb3ff | gitee |
sithvothykiv/dialog_hub.git | b676c102ef2d05f8994d170abe48dcc40cd39005 | entry/src/main/ets/dialog/DialogStyle.ets | arkts | 自定义预设样式 | export enum DialogPresetStyle {
/**
* 确认按钮样式
* 黑底、白字
*/
confirmBtn = 'confirmBtnStyle',
/**
* 确认按钮 黄色渐变样式
*/
confirmYellowLinearGradient1Btn = 'confirmYellowLinearGradient1Btn',
/**
* 确认按钮 黄色渐变样式2
*/
confirmYellowLinearGradient2Btn = 'confirmYellowLinearGradient2Btn',
/**
* 通用标题样式... | AST#export_declaration#Left export AST#enum_declaration#Left enum DialogPresetStyle AST#enum_body#Left { /**
* 确认按钮样式
* 黑底、白字
*/ AST#enum_member#Left confirmBtn = AST#expression#Left 'confirmBtnStyle' AST#expression#Right AST#enum_member#Right , /**
* 确认按钮 黄色渐变样式
*/ AST#enum_member#Left confirmYellowLine... | export enum DialogPresetStyle {
confirmBtn = 'confirmBtnStyle',
confirmYellowLinearGradient1Btn = 'confirmYellowLinearGradient1Btn',
confirmYellowLinearGradient2Btn = 'confirmYellowLinearGradient2Btn',
commonHeader = 'commonHeaderStyle',
insideTopRightYellowCloseAttach = 'insideTopRightYellowC... | https://github.com/sithvothykiv/dialog_hub.git/blob/b676c102ef2d05f8994d170abe48dcc40cd39005/entry/src/main/ets/dialog/DialogStyle.ets#L7-L31 | 5b45cf96cea23ad4188e6094cbd3b510ba056e61 | github | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets | arkts | getById | MARK: - 查询操作 | async getById(idxx: number): Promise<CDBSound | null> {
if (!this.db) return null;
const sql = `SELECT * FROM ${Tables.CSound.name}
WHERE ${Tables.CSound.Col.idxx} = ?`;
return await this.db.getData(sql, [idxx], rs => this.createCSoundFromRs(rs));
} | AST#method_declaration#Left async getById AST#parameter_list#Left ( AST#parameter#Left idxx : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Promi... | async getById(idxx: number): Promise<CDBSound | null> {
if (!this.db) return null;
const sql = `SELECT * FROM ${Tables.CSound.name}
WHERE ${Tables.CSound.Col.idxx} = ?`;
return await this.db.getData(sql, [idxx], rs => this.createCSoundFromRs(rs));
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/components/Sounds/Cloud/CSoundDbAccessor/CSoundDbAccessor.ets#L86-L93 | 024a5524d5406346c2c5cbdcfc5a9ea1a19d6947 | github |
openharmony/applications_settings | aac607310ec30e30d1d54db2e04d055655f72730 | common/component/src/main/ets/default/imageAnimatorComponent.ets | arkts | ImageAnimatorComponent | ImageAnimator component | @Component
export default struct ImageAnimatorComponent {
private imageWidth: number | Resource = 0
private imageHeight: number | Resource = 0
private whtl: number | string = ComponentConfig.value_20;
build() {
Column() {
ImageAnimator()
.images([
{
src: 'res/image/xxxhd... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export default struct ImageAnimatorComponent AST#component_body#Left { AST#property_declaration#Left private imageWidth : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left number AST#primary_type#Right | AST#primar... | @Component
export default struct ImageAnimatorComponent {
private imageWidth: number | Resource = 0
private imageHeight: number | Resource = 0
private whtl: number | string = ComponentConfig.value_20;
build() {
Column() {
ImageAnimator()
.images([
{
src: 'res/image/xxxhd... | https://github.com/openharmony/applications_settings/blob/aac607310ec30e30d1d54db2e04d055655f72730/common/component/src/main/ets/default/imageAnimatorComponent.ets#L20-L87 | 096555b464aab3c75402ba1fd7ffafd0886a70c6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets | arkts | fillGlobalStateDialog | 填充全局状态保留能力弹窗的布局以及内容
@param wrapBuilder 布局
@param params 内容 | fillGlobalStateDialog(wrapBuilder: WrappedBuilder<[ESObject]>, params: ESObject) {
this.wrapBuilder = wrapBuilder;
this.params = params;
this.refreshNode();
} | AST#method_declaration#Left fillGlobalStateDialog AST#parameter_list#Left ( AST#parameter#Left wrapBuilder : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left WrappedBuilder AST#type_arguments#Left < AST#type_annotation#Left AST#primary_type#Left AST#tuple_type#Left [ AST#type_annotation#Left AST#pri... | fillGlobalStateDialog(wrapBuilder: WrappedBuilder<[ESObject]>, params: ESObject) {
this.wrapBuilder = wrapBuilder;
this.params = params;
this.refreshNode();
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/shortvideo/src/main/ets/utils/GlobalStateDialog.ets#L78-L82 | 4f48d8f820f1e7bfb2fdf37cb98aab05d0044687 | gitee |
vhall/VHLive_SDK_Harmony | 29c820e5301e17ae01bc6bdcc393a4437b518e7c | watchKit/src/main/ets/util/EmitterUtil.ets | arkts | subscribe | 订阅Emitter消息
@param msgType 消息类型
@param callback 消息接收回调
@returns 订阅ID(用于取消订阅) | public static subscribe(msgType: string, callback: (data: EmitterMsgData) => void): void {
if (!msgType || !callback) {
console.error('EmitterUtil: 订阅参数不能为空');
}
// 创建订阅事件
emitter.on(msgType, (eventData: emitter.EventData) => {
try {
const msgData = eventData.data as EmitterMsgData;
... | AST#method_declaration#Left public static subscribe AST#parameter_list#Left ( AST#parameter#Left msgType : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left callback : AST#type_annotation#Left AST#function_type#Left AST#parame... | public static subscribe(msgType: string, callback: (data: EmitterMsgData) => void): void {
if (!msgType || !callback) {
console.error('EmitterUtil: 订阅参数不能为空');
}
emitter.on(msgType, (eventData: emitter.EventData) => {
try {
const msgData = eventData.data as EmitterMsgData;
c... | https://github.com/vhall/VHLive_SDK_Harmony/blob/29c820e5301e17ae01bc6bdcc393a4437b518e7c/watchKit/src/main/ets/util/EmitterUtil.ets#L24-L39 | 75458e4a3b1c2b64c3cdbd561c325d95006958ee | gitee |
ashcha0/line-inspection-terminal-frontend_arkts.git | c82616097e8a3b257b7b01e75b6b83ce428b518c | entry/src/main/ets/services/ConfigService.ets | arkts | 配置验证结果接口 | export interface ValidationResult {
valid: boolean;
errors: string[];
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ValidationResult AST#object_type#Left { AST#type_member#Left valid : 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 errors : AST#type_annotati... | export interface ValidationResult {
valid: boolean;
errors: string[];
} | https://github.com/ashcha0/line-inspection-terminal-frontend_arkts.git/blob/c82616097e8a3b257b7b01e75b6b83ce428b518c/entry/src/main/ets/services/ConfigService.ets#L47-L50 | 4d699a2760d09533a087150407e3dab9f0de5a7c | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets | arkts | 跳转的链接地址 | constructor(id: number | string, type: MyCustomSpanType = MyCustomSpanType.Normal, content: string, url?: string) {
this.id = id;
this.type = type;
this.content = content;
if (url) {
this.url = url;
}
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left id : 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#union_type#Right AST#type_annotation#Right AST#parameter#Right , AST#p... | constructor(id: number | string, type: MyCustomSpanType = MyCustomSpanType.Normal, content: string, url?: string) {
this.id = id;
this.type = type;
this.content = content;
if (url) {
this.url = url;
}
} | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/styledtext/src/main/ets/model/TextModel.ets#L48-L55 | 90c56835e59b21e196331796423487d9f7ba001d | gitee | |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets | arkts | verifySegmentSync | 对数据进行分段验签,同步
@param data 待验签数据
@param signDataBlob 签名数据
@param pubKey 公钥
@param algName 指定签名算法(RSA1024|PKCS1|SHA256、RSA2048|PKCS1|SHA256、ECC256|SHA256、SM2_256|SM3、、等)。
@param len 自定义的数据拆分长度。
@returns | static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData =... | AST#method_declaration#Left static verifySegmentSync AST#parameter_list#Left ( AST#parameter#Left data : AST#type_annotation#Left AST#primary_type#Left Uint8Array AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left signDataBlob : AST#type_annotation#Left AST#primary_type#Left AST#q... | static verifySegmentSync(data: Uint8Array, signDataBlob: cryptoFramework.DataBlob,
pubKey: cryptoFramework.PubKey, algName: string, len: number): boolean {
let verifier = cryptoFramework.createVerify(algName);
verifier.initSync(pubKey);
for (let i = 0; i < data.length; i += len) {
let updateData =... | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/oh_modules/.ohpm/@pura+harmony-utils@1.3.6/oh_modules/@pura/harmony-utils/src/main/ets/crypto/CryptoUtil.ets#L420-L432 | d119c4cc549f1ac2d059f921d3a66c994843ce67 | github |
tongyuyan/harmony-utils | 697472f011a43e783eeefaa28ef9d713c4171726 | harmony_speech/src/main/ets/Helper.ets | arkts | getFileName | 通过URI或路径,获取文件名。
@param uriOrPath URI或路径
@returns | static getFileName(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).name;
} | AST#method_declaration#Left static getFileName AST#parameter_list#Left ( AST#parameter#Left uriOrPath : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primar... | static getFileName(uriOrPath: string): string {
return Helper.getFileUri(uriOrPath).name;
} | https://github.com/tongyuyan/harmony-utils/blob/697472f011a43e783eeefaa28ef9d713c4171726/harmony_speech/src/main/ets/Helper.ets#L259-L261 | aed297022f2aeafb50e3210c6bc46493a0d9dfa9 | gitee |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/plan/plancurve/Plan.ets | arkts | add | / 向db中添加新的wordIds | async add(wordIds: number[]): Promise<void> {
await PlanManager.add(wordIds, this);
} | AST#method_declaration#Left async add AST#parameter_list#Left ( AST#parameter#Left wordIds : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left number [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#p... | async add(wordIds: number[]): Promise<void> {
await PlanManager.add(wordIds, this);
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/plan/plancurve/Plan.ets#L484-L486 | 5f0ddab66d97b553bbf0396775e9be5c243ef571 | github |
Vinson0709/arkdemo.git | 793491fe04b387f55dadfef86b30e28d0535d994 | entry/src/main/ets/pages/Texts.ets | arkts | bodyBuilder | 内容展示(自定义builder渲染) | @Builder bodyBuilder() {
Column(){
// Text 文本
Text('Text 文本')
.fontSize(14)
.margin({ top:20, bottom: 12})
Text('我是一个文本')
.textStyle()
.fontSize(12)
.textAlign(TextAlign.Start)
Text('我是绿色,向中间对其')
.textStyle()
.fontSize(14)
.text... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right bodyBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { // Text 文本 AST#ar... | @Builder bodyBuilder() {
Column(){
Text('Text 文本')
.fontSize(14)
.margin({ top:20, bottom: 12})
Text('我是一个文本')
.textStyle()
.fontSize(12)
.textAlign(TextAlign.Start)
Text('我是绿色,向中间对其')
.textStyle()
.fontSize(14)
.textAlign(Text... | https://github.com/Vinson0709/arkdemo.git/blob/793491fe04b387f55dadfef86b30e28d0535d994/entry/src/main/ets/pages/Texts.ets#L61-L167 | 60997ecff164d9ad73530a355a50ee864c5d527e | github |
openharmony/codelabs | d899f32a52b2ae0dfdbb86e34e8d94645b5d4090 | ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets | arkts | The mode display the different styles of Slider. | export enum SliderMode {
SPEED = 1,
SCALE = 2,
}; | AST#export_declaration#Left export AST#enum_declaration#Left enum SliderMode AST#enum_body#Left { AST#enum_member#Left SPEED = AST#expression#Left 1 AST#expression#Right AST#enum_member#Right , AST#enum_member#Left SCALE = AST#expression#Left 2 AST#expression#Right AST#enum_member#Right , } AST#enum_body#Right AST#enum... | export enum SliderMode {
SPEED = 1,
SCALE = 2,
}; | https://github.com/openharmony/codelabs/blob/d899f32a52b2ae0dfdbb86e34e8d94645b5d4090/ETSUI/SliderExample/entry/src/main/ets/common/Constants.ets#L46-L49 | 5cbc7cef1be111d6656ccef0b5e6393a7e4b9da2 | gitee | |
wangjinyuan/JS-TS-ArkTS-database.git | a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26 | npm/an0n-chat-lib/0.1.5/package/build/token.ets | arkts | 应用约束18:构造函数参数需要在类中声明字段 | constructor(service: string, type: TokenType, value: string) {
this.service = service;
this.type = type;
this.value = value;
} | AST#constructor_declaration#Left constructor AST#parameter_list#Left ( AST#parameter#Left service : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left type : AST#type_annotation#Left AST#primary_type#Left TokenType AST#primary_... | constructor(service: string, type: TokenType, value: string) {
this.service = service;
this.type = type;
this.value = value;
} | https://github.com/wangjinyuan/JS-TS-ArkTS-database.git/blob/a84793be4f73d4fc7ff0a44d2e15dbb93c5aab26/npm/an0n-chat-lib/0.1.5/package/build/token.ets#L15-L19 | 0476b1b152ddf03635ea573cf01b916aa0e35f65 | github | |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customstepper/src/main/ets/view/HeaderView.ets | arkts | HeaderView | 展示页面上方的返回/更多按钮(页面公共部分)及对应页面的Title | @Component
export struct HeaderView {
titleArray: string[] = []; // 承载每个页面的title,由父组件传值
@Link currentIndex: number; // 当前页面的索引,由索引及titleArray确定当前页面的Title
build() {
Column() {
Row() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back"))
.height($r("app.integer.stepper_header_image_hei... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct HeaderView AST#component_body#Left { AST#property_declaration#Left titleArray : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left string [ ] AST#array_type#Right AST#primary_type#Right AST#type_annota... | @Component
export struct HeaderView {
titleArray: string[] = [];
@Link currentIndex: number;
build() {
Column() {
Row() {
Image($r("sys.media.ohos_ic_compnent_titlebar_back"))
.height($r("app.integer.stepper_header_image_height"))
.aspectRatio(1)
.onClick(() => {... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customstepper/src/main/ets/view/HeaderView.ets#L22-L60 | c681498d9fb498eaa6aa96d9e495ba50fe32e8fb | gitee |
fmtjava/Ohs_ArkTs_Eyepetizer.git | 79578f394ccb926da1455e63b7fe0722df9b9a22 | entry/src/main/ets/common/Immersive.ets | arkts | 设置导航栏透明 | export function hideNavBar(ctx: common.Context | undefined): void {
// 1. 获取当前窗口
window.getLastWindow(ctx, (err: BusinessError, win: window.Window) => {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
// 2. 设置导航区域隐藏
win.setSpecificSystemBarEnabled('navigationIndicator',... | AST#export_declaration#Left export AST#function_declaration#Left function hideNavBar AST#parameter_list#Left ( AST#parameter#Left ctx : AST#type_annotation#Left AST#union_type#Left AST#primary_type#Left AST#qualified_type#Left common . Context AST#qualified_type#Right AST#primary_type#Right | AST#primary_type#Left unde... | export function hideNavBar(ctx: common.Context | undefined): void {
window.getLastWindow(ctx, (err: BusinessError, win: window.Window) => {
if (err.code) {
console.error(`获取窗口失败:${err.message}`);
return;
}
win.setSpecificSystemBarEnabled('navigationIndicator', false).then(() => {
... | https://github.com/fmtjava/Ohs_ArkTs_Eyepetizer.git/blob/79578f394ccb926da1455e63b7fe0722df9b9a22/entry/src/main/ets/common/Immersive.ets#L6-L20 | 565f67027dc2781df5c61f29910dcf346289ff88 | github | |
kaina404/HarmonyStock.git | 99233a46fb0dfb21e02294c730fd80e2fb404f9b | entry/src/main/ets/bean/FiveDayMinuteData.ets | arkts | 五日的莫一天的所有数据的集合 | export class FiveDayMinuteDataWrapper {
date: Date//五日的年月日
fiveDayMinuteDataAry: FiveDayItemMinuteData[]
maxPrice: number //该天的所有价格的最大值(fiveDayMinuteDataAry的价格最大值)
minPrice: number //该天的所有价格的最小值(fiveDayMinuteDataAry的价格最小值)
openPrice: number //该天的第一个价格(fiveDayMinuteDataAry的第一分钟的价格)
} | AST#export_declaration#Left export AST#class_declaration#Left class FiveDayMinuteDataWrapper AST#class_body#Left { AST#ERROR#Left date AST#ERROR#Left : AST#type_annotation#Left AST#primary_type#Left Date AST#primary_type#Right AST#type_annotation#Right AST#ERROR#Right //五日的年月日 AST#ERROR#Left fiveDayM in uteDataAry : AS... | export class FiveDayMinuteDataWrapper {
date: Date
fiveDayMinuteDataAry: FiveDayItemMinuteData[]
maxPrice: number
minPrice: number
openPrice: number
} | https://github.com/kaina404/HarmonyStock.git/blob/99233a46fb0dfb21e02294c730fd80e2fb404f9b/entry/src/main/ets/bean/FiveDayMinuteData.ets#L32-L38 | 618f13769f89a586ca587a56933f90ea7a95d666 | github | |
open9527/OpenHarmony | fdea69ed722d426bf04e817ec05bff4002e81a4e | libs/core/src/main/ets/utils/DateUtils.ets | arkts | getTodayStr | 获取今天的时间,字符串类型
@param format 格式化字符串,(yyyy-MM-dd HH:mm:ss)
@returns | static getTodayStr(format?: string): string {
return DateUtils.getFormatDateStr(new Date(), format)
} | AST#method_declaration#Left static getTodayStr AST#parameter_list#Left ( AST#parameter#Left format ? : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary... | static getTodayStr(format?: string): string {
return DateUtils.getFormatDateStr(new Date(), format)
} | https://github.com/open9527/OpenHarmony/blob/fdea69ed722d426bf04e817ec05bff4002e81a4e/libs/core/src/main/ets/utils/DateUtils.ets#L113-L115 | f2dca8d725f795182f7c4102e0026b0d5a05835e | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets | arkts | TabSheets | 隐藏关闭按钮时页签数量 | @Component
export struct TabSheets {
@Link tabArray: Array<number>; // 控制页签渲染的数组
@Link @Watch('onFocusIndexChange') focusIndex: number; // Tabs组件当前显示的页签下标
controller: TabsController = new TabsController(); // Tabs控制器
@State middleIndex: number = this.focusIndex; // 中间变量
private toastDuration: number = 2000; /... | AST#decorated_export_declaration#Left AST#decorator#Left @ Component AST#decorator#Right export struct TabSheets AST#component_body#Left { AST#property_declaration#Left AST#decorator#Left @ Link AST#decorator#Right tabArray : AST#type_annotation#Left AST#primary_type#Left AST#generic_type#Left Array AST#type_arguments#... | @Component
export struct TabSheets {
@Link tabArray: Array<number>;
@Link @Watch('onFocusIndexChange') focusIndex: number;
controller: TabsController = new TabsController();
@State middleIndex: number = this.focusIndex;
private toastDuration: number = 2000;
onFocusIndexChange() {
this.middleInd... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/handletabs/src/main/ets/pages/TabSheetComponent.ets#L22-L128 | 19a0d6a8eed2705c8c9f61b628044e9985a07e99 | gitee |
Joker-x-dev/CoolMallArkTS.git | 9f3fabf89fb277692cb82daf734c220c7282919c | feature/main/src/main/ets/viewmodel/CartViewModel.ets | arkts | toggleSpecSelected | 切换规格选中状态
@param {number} goodsId 商品ID
@param {number} specId 规格ID
@returns {void} 无返回值 | toggleSpecSelected(goodsId: number, specId: number): void {
const key = `${goodsId}_${specId}`;
const newSet = new Set(this.selectedSpecIds);
if (newSet.has(key)) {
newSet.delete(key);
} else {
newSet.add(key);
}
this.selectedSpecIds = newSet;
} | AST#method_declaration#Left toggleSpecSelected AST#parameter_list#Left ( AST#parameter#Left goodsId : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left specId : AST#type_annotation#Left AST#primary_type#Left number AST#primary... | toggleSpecSelected(goodsId: number, specId: number): void {
const key = `${goodsId}_${specId}`;
const newSet = new Set(this.selectedSpecIds);
if (newSet.has(key)) {
newSet.delete(key);
} else {
newSet.add(key);
}
this.selectedSpecIds = newSet;
} | https://github.com/Joker-x-dev/CoolMallArkTS.git/blob/9f3fabf89fb277692cb82daf734c220c7282919c/feature/main/src/main/ets/viewmodel/CartViewModel.ets#L113-L122 | 251a43f7e3696d0e559adaf1e39e357aa1986bd6 | github |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/common/utils/ReviewUtils.ets | arkts | getCurrentBundleName | 获取当前应用的包名
@returns 当前应用的包名 | static getCurrentBundleName(): string {
const bundleInfo = bundleManager.getBundleInfoForSelfSync(0);
return bundleInfo.name;
} | AST#method_declaration#Left static getCurrentBundleName AST#parameter_list#Left ( ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#block_statement#Left { AST#statement#Left AST#variable_declaration#Left const AST#variable_declarator#... | static getCurrentBundleName(): string {
const bundleInfo = bundleManager.getBundleInfoForSelfSync(0);
return bundleInfo.name;
} | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/common/utils/ReviewUtils.ets#L106-L109 | a03f0862169912684a95f96877d735f72ada19b9 | github |
knight6236/Pomodoro-Timer.git | 7810017895bdfaad31cb5b664edd08a712272080 | entry/src/main/ets/pages/Index.ets | arkts | DeleteDialogBuilder | 定义删除确认对话框内容 | @Builder
DeleteDialogBuilder() {
Column() {
Text('确认删除')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ top: 16, bottom: 16 })
Text(this.taskToDelete ? `是否删除任务"${this.taskToDelete.title}"?` : '')
.fontSize(16)
.fontColor(this.themeColors.textSecondary)
... | AST#method_declaration#Left AST#decorator#Left @ Builder AST#decorator#Right DeleteDialogBuilder AST#parameter_list#Left ( ) AST#parameter_list#Right AST#builder_function_body#Left { AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left Column ( ) AST#container_content_body#Left { AST#arkts... | @Builder
DeleteDialogBuilder() {
Column() {
Text('确认删除')
.fontSize(20)
.fontWeight(FontWeight.Bold)
.margin({ top: 16, bottom: 16 })
Text(this.taskToDelete ? `是否删除任务"${this.taskToDelete.title}"?` : '')
.fontSize(16)
.fontColor(this.themeColors.textSecondary)
... | https://github.com/knight6236/Pomodoro-Timer.git/blob/7810017895bdfaad31cb5b664edd08a712272080/entry/src/main/ets/pages/Index.ets#L121-L166 | 00d14b1051ef557c15422621df9fbf4010130685 | github |
harmonyos_samples/BestPracticeSnippets | 490ea539a6d4427dd395f3dac3cf4887719f37af | Weather/product/default/src/main/ets/pages/HoursWeather.ets | arkts | [EndExclude HoursWeather] | build() {
// Implement extensibility capability through list component.
List() {
LazyForEach(this.hoursDataResource, (hoursItem: Forecast) => {
ListItem() {
this.HoursWeatherItem(hoursItem,
this.curBp === 'lg' ? Style.WEATHER_ITEM_WIDTH + 2 : Style.WEATHER_ITEM_WIDTH)
... | AST#build_method#Left build ( ) AST#build_body#Left { // Implement extensibility capability through list component. AST#arkts_ui_element#Left AST#ui_element_with_modifiers#Left AST#ui_component#Left List ( ) AST#container_content_body#Left { AST#ui_control_flow#Left AST#lazy_for_each_statement#Left LazyForEach ( AST#ex... | build() {
List() {
LazyForEach(this.hoursDataResource, (hoursItem: Forecast) => {
ListItem() {
this.HoursWeatherItem(hoursItem,
this.curBp === 'lg' ? Style.WEATHER_ITEM_WIDTH + 2 : Style.WEATHER_ITEM_WIDTH)
}
}, (hoursItem: Forecast, index: number) => JSON.stri... | https://github.com/harmonyos_samples/BestPracticeSnippets/blob/490ea539a6d4427dd395f3dac3cf4887719f37af/Weather/product/default/src/main/ets/pages/HoursWeather.ets#L64-L79 | 613733f19af4f3472ff2636dcebd2836d2d3ad23 | gitee | |
xt1314520/IbestKnowTeach | 61f0a7a3d328ad5a52de8fd699b9e1e94de0203b | entry/src/main/ets/api/ArticleContentApi.type.ets | arkts | 分页查询最热文章内容入参 | export interface ArticleContentHotPageParam extends PageParam {
/**
* 标题
*/
title: string
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ArticleContentHotPageParam AST#extends_clause#Left extends PageParam AST#extends_clause#Right AST#object_type#Left { /**
* 标题
*/ AST#type_member#Left title : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST... | export interface ArticleContentHotPageParam extends PageParam {
title: string
} | https://github.com/xt1314520/IbestKnowTeach/blob/61f0a7a3d328ad5a52de8fd699b9e1e94de0203b/entry/src/main/ets/api/ArticleContentApi.type.ets#L76-L82 | 97bf5500ad28028584490a9ddc676e44976739eb | gitee | |
KoStudio/ArkTS-WordTree.git | 78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324 | entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets | arkts | loginWithCallback | 登录方法 - 回调方式 | public loginWithCallback(callback: SnsOneLoginCallback): void {
this.SnsOneLoginCallback = callback;
if (!this.iQQOpenApi) {
this.handleLoginError('QQOpenApi not initialized');
return;
}
const loginApiCallback: ApiCallback<AuthResponse> = {
onComplete: (response: AuthResponse): void ... | AST#method_declaration#Left public loginWithCallback AST#parameter_list#Left ( AST#parameter#Left callback : AST#type_annotation#Left AST#primary_type#Left SnsOneLoginCallback AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right : AST#type_annotation#Left AST#primary_type#Left... | public loginWithCallback(callback: SnsOneLoginCallback): void {
this.SnsOneLoginCallback = callback;
if (!this.iQQOpenApi) {
this.handleLoginError('QQOpenApi not initialized');
return;
}
const loginApiCallback: ApiCallback<AuthResponse> = {
onComplete: (response: AuthResponse): void ... | https://github.com/KoStudio/ArkTS-WordTree.git/blob/78c2a8f8ef6cf4c6be8bab2212f04bfcfa7e7324/entry/src/main/ets/models/managers/sns/qq/QQLoginManager.ets#L109-L144 | 1fff2ca04a361f99bd64b3f7fedd779e4f96fa98 | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/h5cache/Index.ets | arkts | H5Cache | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { H5Cache } from './src/main/ets/pages/H5Cache'; | AST#export_declaration#Left export { H5Cache } from './src/main/ets/pages/H5Cache' ; AST#export_declaration#Right | export { H5Cache } from './src/main/ets/pages/H5Cache'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/h5cache/Index.ets#L15-L15 | 8ca8f03ebcfa7d5de0cd36aaf8c43172011f58b6 | gitee |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/customdialog/Index.ets | arkts | CustomDialogComponent | Copyright (c) 2024 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | export { CustomDialogComponent } from './src/main/ets/view/CustomDialog'; | AST#export_declaration#Left export { CustomDialogComponent } from './src/main/ets/view/CustomDialog' ; AST#export_declaration#Right | export { CustomDialogComponent } from './src/main/ets/view/CustomDialog'; | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/customdialog/Index.ets#L15-L15 | 32928d2b22210b4f11ab508f672fdeca6c2e3363 | gitee |
jxdiaodeyi/YX_Sports.git | af5346bd3d5003c33c306ff77b4b5e9184219893 | YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets | arkts | transForm | 处理函数,将weekdata[],allTime,allCalorie装入 | transForm(datas:dailyWorkOutType[]){
let weekInfo:DailyWorkout[]=[];
datas.forEach((item,idx)=>{
weekInfo.push({calorie:item.allCalories,stime:item.allTime})
})
return weekInfo;
} | AST#method_declaration#Left transForm AST#parameter_list#Left ( AST#parameter#Left datas : AST#type_annotation#Left AST#primary_type#Left AST#array_type#Left dailyWorkOutType [ ] AST#array_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left... | transForm(datas:dailyWorkOutType[]){
let weekInfo:DailyWorkout[]=[];
datas.forEach((item,idx)=>{
weekInfo.push({calorie:item.allCalories,stime:item.allTime})
})
return weekInfo;
} | https://github.com/jxdiaodeyi/YX_Sports.git/blob/af5346bd3d5003c33c306ff77b4b5e9184219893/YX_Sports/entry/src/main/ets/pages/practice/TrainRecordPage.ets#L335-L341 | 38295515d4b7c9c22f72f99826484221863136a0 | github |
Piagari/arkts_example.git | a63b868eaa2a50dc480d487b84c4650cc6a40fc8 | hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets | arkts | deleteCustomResource | 删除自定义来源 | public deleteCustomResource(key: number) {
const list = key > 200 ? this._resource.income : this._resource.expense;
const idx = list.findIndex((item) => item.key === key)!;
if (typeof idx === 'number') {
list.splice(idx, 1);
return true;
}
return false;
} | AST#method_declaration#Left public deleteCustomResource AST#parameter_list#Left ( AST#parameter#Left key : AST#type_annotation#Left AST#primary_type#Left number AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right AST#block_statement#Left { AST#statement#Left AST#variable_decl... | public deleteCustomResource(key: number) {
const list = key > 200 ? this._resource.income : this._resource.expense;
const idx = list.findIndex((item) => item.key === key)!;
if (typeof idx === 'number') {
list.splice(idx, 1);
return true;
}
return false;
} | https://github.com/Piagari/arkts_example.git/blob/a63b868eaa2a50dc480d487b84c4650cc6a40fc8/hmos_app-main/hmos_app-main/MoneyTrack-master/components/bill_base/src/main/ets/utils/ResourceUtil.ets#L136-L144 | 88eb3a746452e6425ffbff8f6b2ad54f287d33bb | github |
harmonyos-cases/cases | eccdb71f1cee10fa6ff955e16c454c1b59d3ae13 | CommonAppDevelopment/feature/pipwindow/src/main/ets/model/PipManager.ets | arkts | onActionEvent | 监听画中画控制面板控件动作事件 | onActionEvent(control: PiPWindow.ControlEventParam) {
switch (control.controlType) {
// 视频播放、停止
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
// 停止视频
PipManager.getInstance().player.isPlaying = false;
} else i... | AST#method_declaration#Left onActionEvent AST#parameter_list#Left ( AST#parameter#Left control : AST#type_annotation#Left AST#primary_type#Left AST#qualified_type#Left PiPWindow . ControlEventParam AST#qualified_type#Right AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right ) AST#parameter_list#Right A... | onActionEvent(control: PiPWindow.ControlEventParam) {
switch (control.controlType) {
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
PipManager.getInstance().player.isPlaying = false;
} else if (control.status... | https://github.com/harmonyos-cases/cases/blob/eccdb71f1cee10fa6ff955e16c454c1b59d3ae13/CommonAppDevelopment/feature/pipwindow/src/main/ets/model/PipManager.ets#L56-L84 | 5c2965fef9bfe1bd78adef8eb669775bfb5c26b4 | gitee |
yunkss/ef-tool | 75f6761a0f2805d97183504745bf23c975ae514d | ef_core/src/main/ets/core/base/OutDTO.ets | arkts | OKByDataTable | 成功-包含多行数据
@param msg 提示消息
@param dataTable 多行数据
@param dataRow 单行数据(不传)
@returns | static OKByDataTable<T>(msg: string, dataTable: Array<T>, dataRow?: T): OutDTO<T> {
if (!dataRow) {
dataRow = Object as T;
}
let dto = new OutDTO<T>(true, msg, dataRow, dataTable, 200);
return dto;
} | AST#method_declaration#Left static OKByDataTable AST#type_parameters#Left < AST#type_parameter#Left T AST#type_parameter#Right > AST#type_parameters#Right AST#parameter_list#Left ( AST#parameter#Left msg : AST#type_annotation#Left AST#primary_type#Left string AST#primary_type#Right AST#type_annotation#Right AST#paramet... | static OKByDataTable<T>(msg: string, dataTable: Array<T>, dataRow?: T): OutDTO<T> {
if (!dataRow) {
dataRow = Object as T;
}
let dto = new OutDTO<T>(true, msg, dataRow, dataTable, 200);
return dto;
} | https://github.com/yunkss/ef-tool/blob/75f6761a0f2805d97183504745bf23c975ae514d/ef_core/src/main/ets/core/base/OutDTO.ets#L88-L94 | 30d349730192fb735c3027ed6d400e10dbd793c3 | gitee |
bigbear20240612/birthday_reminder.git | 647c411a6619affd42eb5d163ff18db4b34b27ff | harmonyos/src/main/ets/common/types/ContactTypes.ets | arkts | 联系人统计信息接口 | export interface ContactStatistics {
total: number;
byRelation: Record<RelationType, number>;
byGender: Record<Gender, number>;
byAge: AgeDistribution;
upcomingBirthdays: UpcomingBirthdayStats;
averageIntimacyLevel: number;
favoriteCount: number;
} | AST#export_declaration#Left export AST#interface_declaration#Left interface ContactStatistics AST#object_type#Left { AST#type_member#Left total : 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 byRelation : AST#type_anno... | export interface ContactStatistics {
total: number;
byRelation: Record<RelationType, number>;
byGender: Record<Gender, number>;
byAge: AgeDistribution;
upcomingBirthdays: UpcomingBirthdayStats;
averageIntimacyLevel: number;
favoriteCount: number;
} | https://github.com/bigbear20240612/birthday_reminder.git/blob/647c411a6619affd42eb5d163ff18db4b34b27ff/harmonyos/src/main/ets/common/types/ContactTypes.ets#L180-L188 | 48721d8417eed4c0ff0dea6eb9ef73368f8e259a | github | |
wuyuanwuhui999/harmony-arkts-chat-app-ui.git | 128861bc002adae9c34c6ce8fbf12686c26e51ec | entry/src/main/ets/pages/TenantManagerPage.ets | arkts | onCancel | @author: wuwenqiang
@description: 关闭弹窗
@date: 2025-09-20 13:21 | onCancel(){
this.dialogController?.close();
} | AST#method_declaration#Left onCancel 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#Left this AST... | onCancel(){
this.dialogController?.close();
} | https://github.com/wuyuanwuhui999/harmony-arkts-chat-app-ui.git/blob/128861bc002adae9c34c6ce8fbf12686c26e51ec/entry/src/main/ets/pages/TenantManagerPage.ets#L79-L81 | b780697e5c03586320d73fb9b4b765c66bf29d91 | github |
kico0909/crazy_miner.git | 13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9 | entry/src/main/ets/common/game/core/world.ets | arkts | createActionEvent | 每一次挖掘,触发的动作
创建具体动作内容 | function createActionEvent(world: WORLD, stepLong: number): t.TMinerActionEventItem {
const luck = world.player.attr.luck
const luckRand = utils.getRandomInt(0, 100)
if (luckRand <= luck + stepLong) { // 触发特殊事件
// 获得一个特殊事件 分类
const eventType = utils.getRandomObjectByProbability<t.TTypeEventBox>(world.even... | AST#function_declaration#Left function createActionEvent AST#parameter_list#Left ( AST#parameter#Left world : AST#type_annotation#Left AST#primary_type#Left WORLD AST#primary_type#Right AST#type_annotation#Right AST#parameter#Right , AST#parameter#Left stepLong : AST#type_annotation#Left AST#primary_type#Left number AS... | function createActionEvent(world: WORLD, stepLong: number): t.TMinerActionEventItem {
const luck = world.player.attr.luck
const luckRand = utils.getRandomInt(0, 100)
if (luckRand <= luck + stepLong) {
const eventType = utils.getRandomObjectByProbability<t.TTypeEventBox>(world.events)
const even... | https://github.com/kico0909/crazy_miner.git/blob/13eae3ac4d8ca11ecf2c97b375f82f24ab7919b9/entry/src/main/ets/common/game/core/world.ets#L64-L78 | 9d158ea7a403ab8aa4e52c8b5b4e4f204c98fcde | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.